Skip to content

Instantly share code, notes, and snippets.

@wanabe
Created February 26, 2011 12:03
Show Gist options
  • Save wanabe/845151 to your computer and use it in GitHub Desktop.
Save wanabe/845151 to your computer and use it in GitHub Desktop.
still SEGV.
commit 34b55803d7da002e0e75a2ac482134c4947508d1
Author: wanabe <[email protected]>
Date: Sat Feb 26 20:44:46 2011 +0900
extension library name is "*.so" on windows.
diff --git a/kernel/common/native_method.rb b/kernel/common/native_method.rb
index 0484f1c..2892f61 100644
--- a/kernel/common/native_method.rb
+++ b/kernel/common/native_method.rb
@@ -28,7 +28,7 @@ module Rubinius
ver = lib.find_symbol("__X_rubinius_version")
- unless ver
+ unless ver || Rubinius::OS_TYPE == :windows
raise LoadError::InvalidExtensionError, "Out-of-date or not compatible. Recompile or reinstall gem (#{library})"
end
diff --git a/lib/rbconfig.rb b/lib/rbconfig.rb
index f24b0b4..cc96549 100644
--- a/lib/rbconfig.rb
+++ b/lib/rbconfig.rb
@@ -151,8 +151,9 @@ module RbConfig
CONFIG["ARCHFILE"] = ""
CONFIG["RDOCTARGET"] = ""
CONFIG["LIBRUBY_A"] = ""
- CONFIG["LIBRUBY_SO"] = "lib$(RUBY_SO_NAME).$(DLEXT)"
- CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_SO_NAME).$(DLEXT)"
+ os_dlext = Rubinius::BUILD_CONFIG[:windows] ? ".dll" : "$(DLEXT)"
+ CONFIG["LIBRUBY_SO"] = "lib$(RUBY_SO_NAME).#{os_dlext}"
+ CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_SO_NAME).#{os_dlext}"
CONFIG["LIBRUBY"] = "$(LIBRUBY_SO)"
CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_STATIC)"
CONFIG["LIBRUBYARG_STATIC"] = ""
diff --git a/vm/builtin/ffi_pointer.cpp b/vm/builtin/ffi_pointer.cpp
index a2a115c..faa12f0 100644
--- a/vm/builtin/ffi_pointer.cpp
+++ b/vm/builtin/ffi_pointer.cpp
@@ -70,7 +70,7 @@ namespace rubinius {
// Legacy. Fix the kernel to not need this.
String* main_suffix;
#ifdef _WIN32
- main_suffix = String::create(state, ".dll");
+ main_suffix = String::create(state, ".so");
#else
#ifdef __APPLE_CC__
main_suffix = String::create(state, ".bundle");
commit 2df3a469d8f7155c7fa0dcef3b69bf547d8412b2
Author: wanabe <[email protected]>
Date: Sat Feb 26 16:06:30 2011 +0900
File.open pass io-mode to IO.new because windows doesn't have fcntl.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 3e55f2a..9c5f5ac 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -82,7 +82,21 @@ class File < IO
end
@path = path
- super(fd)
+ if Rubinius::OS_TYPE == :windows
+ case mode
+ when /[a+]/
+ io_mode = RDWR
+ when /r/
+ io_mode = RDONLY
+ when /w/
+ io_mode = WRONLY
+ else
+ raise IOError, "invalid mode: #{mode}"
+ end
+ super(fd, io_mode)
+ else
+ super(fd)
+ end
end
end
diff --git a/kernel/common/io.rb b/kernel/common/io.rb
index 358de62..1948517 100644
--- a/kernel/common/io.rb
+++ b/kernel/common/io.rb
@@ -638,9 +638,13 @@ class IO
# The +sync+ attribute will also be set.
#
def self.setup(io, fd, mode = nil, sync = false)
- cur_mode = FFI::Platform::POSIX.fcntl(fd, F_GETFL, 0)
- Errno.handle if cur_mode < 0
- cur_mode &= ACCMODE
+ if Rubinius::OS_TYPE == :windows
+ cur_mode = 0 # TODO
+ else
+ cur_mode = FFI::Platform::POSIX.fcntl(fd, F_GETFL, 0)
+ Errno.handle if cur_mode < 0
+ cur_mode &= ACCMODE
+ end
if mode
if !Type.obj_kind_of?(mode, Integer)
@@ -650,7 +654,7 @@ class IO
mode &= ACCMODE
- if (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
+ if Rubinius::OS_TYPE != :windows and (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
raise Errno::EINVAL, "Invalid new mode '#{str_mode}' for existing descriptor #{fd}"
end
end
commit f390a3f413d70eab37ed3483c4d74d622a1b6975
Author: wanabe <[email protected]>
Date: Sat Feb 26 15:41:57 2011 +0900
expand_path for windows.
diff --git a/kernel/common/codeloader.rb b/kernel/common/codeloader.rb
index f7df33b..1c6f8f9 100644
--- a/kernel/common/codeloader.rb
+++ b/kernel/common/codeloader.rb
@@ -177,8 +177,12 @@ module Rubinius
# Returns true if the +path+ is an absolute path or a relative path (e.g.
# "./" or "../").
def qualified_path?(path)
- # TODO: fix for Windows
- path[0] == ?/ or path.prefix?("./") or path.prefix?("../")
+ if Rubinius::OS_TYPE == :windows
+ return true if path =~ /^[a-z]:/i
+ else
+ return true if path[0] == ?/
+ end
+ path.prefix?("./") or path.prefix?("../")
end
# Searches $LOAD_PATH for a file named +name+. Does not append any file
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index c232a5b..3e55f2a 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -357,6 +357,7 @@ class File < IO
# File.expand_path("~oracle/bin") #=> "/home/oracle/bin"
# File.expand_path("../../bin", "/tmp/x") #=> "/bin"
def self.expand_path(path, dir=nil)
+ separator = Rubinius::OS_TYPE == :windows ? /[\/\\]/ : /\//
path = StringValue(path)
first = path[0]
@@ -367,7 +368,7 @@ class File < IO
when nil
return ENV["HOME"]
else
- unless length = path.index("/", 1)
+ unless length = path.index(separator, 1)
length = path.size
end
@@ -378,7 +379,7 @@ class File < IO
path = dir + path.substring(length, path.size - length)
end
- elsif first != ?/
+ elsif Rubinius::OS_TYPE == :windows ? path !~ /^[a-z]:/i : first != ?/
if dir
dir = File.expand_path dir
else
@@ -392,7 +393,7 @@ class File < IO
start = 0
size = path.size
- while index = path.index("/", start) or (start < size and index = size)
+ while index = path.index(separator, start) or (start < size and index = size)
length = index - start
if length > 0
@@ -410,7 +411,7 @@ class File < IO
return "/" if items.empty?
- str = ""
+ str = Rubinius::OS_TYPE == :windows ? "#{items.shift}" : ""
items.each { |x| str.append "/#{x}" }
return str
commit 1701a8a13fd574ec826f0d026fd7e695a2b9d30c
Author: wanabe <[email protected]>
Date: Sat Feb 26 15:27:39 2011 +0900
superuser? and rsuperuser? return false always on windows. TODO.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 7e48ec1..c232a5b 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -1348,11 +1348,13 @@ class File::Stat
private :rowned?
def rsuperuser?
+ return false if Rubinius::OS_TYPE == :windows # TODO
POSIX.getuid == 0
end
private :rsuperuser?
def superuser?
+ return false if Rubinius::OS_TYPE == :windows # TODO
POSIX.geteuid == 0
end
private :superuser?
commit 95aaacb9974f2372ff1ee3f361110d293d482cdb
Author: wanabe <[email protected]>
Date: Sat Feb 26 15:12:34 2011 +0900
st_uid == 0 on Windows.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index f00e062..7e48ec1 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -1242,6 +1242,7 @@ class File::Stat
end
def owned?
+ return true if Rubinius::OS_TYPE == :windows
@stat[:st_uid] == POSIX.geteuid
end
commit 471d206d4f3804995ccad1674e3149bafa9a352e
Author: wanabe <[email protected]>
Date: Sat Feb 26 13:39:59 2011 +0900
print backtrace each raise for debug.
diff --git a/kernel/delta/kernel.rb b/kernel/delta/kernel.rb
index ec18b57..6c643c9 100644
--- a/kernel/delta/kernel.rb
+++ b/kernel/delta/kernel.rb
@@ -33,7 +33,7 @@ module Kernel
exc.capture_backtrace!(2) unless exc.backtrace?
end
- if $DEBUG and $VERBOSE != nil
+ if true || $DEBUG and $VERBOSE != nil
if loc = exc.locations
pos = loc[1].position
else
commit bd0de889418f0966bf391e8a61d0e86c638fc2fa
Author: wanabe <[email protected]>
Date: Sat Feb 26 13:39:16 2011 +0900
msvcrt.dll doesn't have rlimit.
diff --git a/kernel/common/process.rb b/kernel/common/process.rb
index 31878a4..8873f2e 100644
--- a/kernel/common/process.rb
+++ b/kernel/common/process.rb
@@ -28,65 +28,67 @@ module Process
end
include Constants
- class Rlimit < FFI::Struct
- config "rbx.platform.rlimit", :rlim_cur, :rlim_max
- end
-
- def self.setrlimit(resource, cur_limit, max_limit=undefined)
- rlimit = Rlimit.new
- rlimit[:rlim_cur] = cur_limit
- rlimit[:rlim_max] = max_limit.equal?(undefined) ? cur_limit : max_limit
- Errno.handle if -1 == FFI::Platform::POSIX.setrlimit(resource, rlimit.pointer)
- nil
- end
+ unless Rubinius::OS_TYPE == :windows
+ class Rlimit < FFI::Struct
+ config "rbx.platform.rlimit", :rlim_cur, :rlim_max
+ end
- def self.getrlimit(resource)
- lim_max = []
- rlimit = Rlimit.new
- Errno.handle if -1 == FFI::Platform::POSIX.getrlimit(resource, rlimit.pointer)
- lim_max = [rlimit[:rlim_cur], rlimit[:rlim_max]]
- lim_max
- end
+ def self.setrlimit(resource, cur_limit, max_limit=undefined)
+ rlimit = Rlimit.new
+ rlimit[:rlim_cur] = cur_limit
+ rlimit[:rlim_max] = max_limit.equal?(undefined) ? cur_limit : max_limit
+ Errno.handle if -1 == FFI::Platform::POSIX.setrlimit(resource, rlimit.pointer)
+ nil
+ end
- def self.setsid
- pgid = FFI::Platform::POSIX.setsid
- Errno.handle if -1 == pgid
- pgid
- end
+ def self.getrlimit(resource)
+ lim_max = []
+ rlimit = Rlimit.new
+ Errno.handle if -1 == FFI::Platform::POSIX.getrlimit(resource, rlimit.pointer)
+ lim_max = [rlimit[:rlim_cur], rlimit[:rlim_max]]
+ lim_max
+ end
- def self.fork
- pid = perform_fork
- pid = nil if pid == 0
- if block_given? and pid.nil?
- begin
- yield nil
- status = 0
- rescue SystemExit => e
- status = e.status
- rescue Exception => e
- e.render "An exception occured in a forked block"
- status = 1
- end
+ def self.setsid
+ pgid = FFI::Platform::POSIX.setsid
+ Errno.handle if -1 == pgid
+ pgid
+ end
- # TODO should we call back into the Loader to run finalizers and such?
- until Rubinius::AtExit.empty?
+ def self.fork
+ pid = perform_fork
+ pid = nil if pid == 0
+ if block_given? and pid.nil?
begin
- Rubinius::AtExit.shift.call
+ yield nil
+ status = 0
rescue SystemExit => e
status = e.status
+ rescue Exception => e
+ e.render "An exception occured in a forked block"
+ status = 1
+ end
+
+ # TODO should we call back into the Loader to run finalizers and such?
+ until Rubinius::AtExit.empty?
+ begin
+ Rubinius::AtExit.shift.call
+ rescue SystemExit => e
+ status = e.status
+ end
end
- end
- ObjectSpace.run_finalizers
+ ObjectSpace.run_finalizers
- # Do not use Kernel.exit. This raises a SystemExit exception, which
- # will run ensure blocks. This is not what MRI does and causes bugs
- # in programs. See issue http://github.com/evanphx/rubinius/issues#issue/289 for
- # an example
+ # Do not use Kernel.exit. This raises a SystemExit exception, which
+ # will run ensure blocks. This is not what MRI does and causes bugs
+ # in programs. See issue http://github.com/evanphx/rubinius/issues#issue/289 for
+ # an example
- Kernel.exit! status
+ Kernel.exit! status
+ end
+ pid
end
- pid
end
def self.times
commit 174e10e7e897079d73f139d11dd739d97e5b1855
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:51:20 2011 +0900
mingw32's stat doesn't have st_blksize and st_blocks.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 3186ee5..f00e062 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -1021,9 +1021,15 @@ end
class File::Stat
class Struct < FFI::Struct
+ if Rubinius::OS_TYPE == :windows
config "rbx.platform.stat", :st_dev, :st_ino, :st_mode, :st_nlink,
- :st_uid, :st_gid, :st_rdev, :st_size, :st_blksize, :st_blocks,
+ :st_uid, :st_gid, :st_rdev, :st_size,
:st_atime, :st_mtime, :st_ctime
+ else
+ config "rbx.platform.stat", :st_dev, :st_ino, :st_mode, :st_nlink,
+ :st_uid, :st_gid, :st_rdev, :st_size, :st_blksize, :st_blocks,
+ :st_atime, :st_mtime, :st_ctime
+ end
end
EXISTS_STRUCT = Struct.new
@@ -1125,12 +1131,14 @@ class File::Stat
Time.at @stat[:st_atime]
end
- def blksize
- @stat[:st_blksize]
- end
+ unless Rubinius::OS_TYPE == :windows
+ def blksize
+ @stat[:st_blksize]
+ end
- def blocks
- @stat[:st_blocks]
+ def blocks
+ @stat[:st_blocks]
+ end
end
def blockdev?
commit 4490b6a5d78fda1cb41db79e6277bb2b479d14f1
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:49:00 2011 +0900
msvcrt's stat API.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 1ed4333..8ff7067 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -175,15 +175,15 @@ module FFI::Platform::POSIX
attach_function3 :setsid, [], :pid_t
# related to stat()
- attach_function :major, 'ffi_major', [:dev_t], :dev_t
- attach_function :minor, 'ffi_minor', [:dev_t], :dev_t
+ attach_function3 :major, 'ffi_major', [:dev_t], :dev_t
+ attach_function3 :minor, 'ffi_minor', [:dev_t], :dev_t
# stat
# FIXME: these are TEMPORARY until we determine how to
# have FFI resolve symbols that may be macros. This is
# used rather than a primitive so that it is easier to
# replace (unlike primitives).
- attach_function :stat, 'ffi_stat', [:string, :pointer], :int
- attach_function :fstat, 'ffi_fstat', [:int, :pointer], :int
- attach_function :lstat, 'ffi_lstat', [:string, :pointer], :int
+ attach_function2 :stat, 'ffi_stat', [:string, :pointer], :int
+ attach_function3 :fstat, 'ffi_fstat', [:int, :pointer], :int
+ attach_function3 :lstat, 'ffi_lstat', [:string, :pointer], :int
end
commit c3a99b2a0aa328cf77fe1c59c66cb68d36b37ddf
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:48:31 2011 +0900
attach_function2 allow cname.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 321ba6b..1ed4333 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -6,7 +6,15 @@ module FFI::Platform::POSIX
class << self
if Rubinius::OS_TYPE == :windows
- def attach_function2(name, args, ret)
+ def attach_function2(name, *argv)
+ case argv.length
+ when 2
+ args, ret = argv
+ when 3
+ cname, args, ret = *argv
+ else
+ raise ArgumentError
+ end
attach_function(name, "_#{name}", args, ret)
end
def attach_function3(*args)
commit beb75c5a351dcc24497eabed8a608d932bc27ba8
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:37:59 2011 +0900
msvcrt.dll doesn't have processes and signals API except getpid.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index c8db685..321ba6b 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -158,13 +158,13 @@ module FFI::Platform::POSIX
attach_function3 :endgrent, [], :void
# processes and signals
- attach_function :kill, [:pid_t, :int], :int
- attach_function :getpgid, [:pid_t], :pid_t
- attach_function :setpgid, [:pid_t, :pid_t], :int
- attach_function :getpid, [], :pid_t
- attach_function :getppid, [], :pid_t
- attach_function :getpgrp, [], :pid_t
- attach_function :setsid, [], :pid_t
+ attach_function3 :kill, [:pid_t, :int], :int
+ attach_function3 :getpgid, [:pid_t], :pid_t
+ attach_function3 :setpgid, [:pid_t, :pid_t], :int
+ attach_function2 :getpid, [], :pid_t
+ attach_function3 :getppid, [], :pid_t
+ attach_function3 :getpgrp, [], :pid_t
+ attach_function3 :setsid, [], :pid_t
# related to stat()
attach_function :major, 'ffi_major', [:dev_t], :dev_t
commit 2914927671231af7eca2df40129050fc65fc9f05
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:25:01 2011 +0900
mingw32 can't password and group file access.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 36e5011..c8db685 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -145,17 +145,17 @@ module FFI::Platform::POSIX
attach_function3 :getrlimit, [:int, :pointer], :int
# password and group file access
- attach_function :getpwnam, [:string], :pointer
- attach_function :getpwuid, [:uint], :pointer
- attach_function :setpwent, [], :void
- attach_function :getpwent, [], :pointer
- attach_function :endpwent, [], :void
-
- attach_function :getgrnam, [:string], :pointer
- attach_function :getgrgid, [:gid_t], :pointer
- attach_function :setgrent, [], :void
- attach_function :getgrent, [], :pointer
- attach_function :endgrent, [], :void
+ attach_function3 :getpwnam, [:string], :pointer
+ attach_function3 :getpwuid, [:uint], :pointer
+ attach_function3 :setpwent, [], :void
+ attach_function3 :getpwent, [], :pointer
+ attach_function3 :endpwent, [], :void
+
+ attach_function3 :getgrnam, [:string], :pointer
+ attach_function3 :getgrgid, [:gid_t], :pointer
+ attach_function3 :setgrent, [], :void
+ attach_function3 :getgrent, [], :pointer
+ attach_function3 :endgrent, [], :void
# processes and signals
attach_function :kill, [:pid_t, :int], :int
commit 9b72cd4054c3e0c003f783954477e9a11a640604
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:23:41 2011 +0900
windows doesn't have UID/GID API.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index b6452b6..36e5011 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -117,32 +117,32 @@ module FFI::Platform::POSIX
attach_function3 :gettimeofday, [:pointer, :pointer], :int
# UID/GID
- attach_function :getuid, [], :uid_t
- attach_function :getgid, [], :gid_t
- attach_function :geteuid, [], :uid_t
- attach_function :getegid, [], :gid_t
+ attach_function3 :getuid, [], :uid_t
+ attach_function3 :getgid, [], :gid_t
+ attach_function3 :geteuid, [], :uid_t
+ attach_function3 :getegid, [], :gid_t
- attach_function :setgid, [:gid_t], :int
- attach_function :setuid, [:uid_t], :int
- attach_function :setegid, [:gid_t], :int
- attach_function :seteuid, [:uid_t], :int
+ attach_function3 :setgid, [:gid_t], :int
+ attach_function3 :setuid, [:uid_t], :int
+ attach_function3 :setegid, [:gid_t], :int
+ attach_function3 :seteuid, [:uid_t], :int
- attach_function :setregid, [:gid_t, :gid_t], :int
- attach_function :setreuid, [:uid_t, :uid_t], :int
+ attach_function3 :setregid, [:gid_t, :gid_t], :int
+ attach_function3 :setreuid, [:uid_t, :uid_t], :int
# These are linux specific
#attach_function 'setresgid', [gid_t, gid_t, gid_t], :int
#attach_function 'setresuid', [uid_t, uid_t, uid_t], :int
- attach_function :getpriority, [:int, :id_t], :int
- attach_function :setpriority, [:int, :id_t, :int], :int
+ attach_function3 :getpriority, [:int, :id_t], :int
+ attach_function3 :setpriority, [:int, :id_t, :int], :int
- attach_function :getgroups, [:int, :pointer], :int
- attach_function :setgroups, [:int, :pointer], :int
- attach_function :initgroups, [:string, :gid_t], :int
+ attach_function3 :getgroups, [:int, :pointer], :int
+ attach_function3 :setgroups, [:int, :pointer], :int
+ attach_function3 :initgroups, [:string, :gid_t], :int
- attach_function :setrlimit, [:int, :pointer], :int
- attach_function :getrlimit, [:int, :pointer], :int
+ attach_function3 :setrlimit, [:int, :pointer], :int
+ attach_function3 :getrlimit, [:int, :pointer], :int
# password and group file access
attach_function :getpwnam, [:string], :pointer
commit 94cc48f84cc0cacd96b7b3b8cb520794e5f7af54
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:21:52 2011 +0900
mingw32 doesn't have timezone, tzname nor gettimeofday.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 48907ea..b6452b6 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -112,9 +112,9 @@ module FFI::Platform::POSIX
# Time
attach_function :time, [:pointer], :time_t
- attach_function :timezone, 'ffi_timezone', [], :time_t
- attach_function :tzname, 'ffi_tzname', [:int], :string
- attach_function :gettimeofday, [:pointer, :pointer], :int
+ attach_function3 :timezone, 'ffi_timezone', [], :time_t
+ attach_function3 :tzname, 'ffi_tzname', [:int], :string
+ attach_function3 :gettimeofday, [:pointer, :pointer], :int
# UID/GID
attach_function :getuid, [], :uid_t
commit 347a803dade01b46dad5e2443d7292aa1409af85
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:21:11 2011 +0900
mingw32 doesn't have flock.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 59ca0bb..48907ea 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -108,7 +108,7 @@ module FFI::Platform::POSIX
attach_function3 :ftruncate, [:int, :off_t], :int
# locking
- attach_function :flock, [:int, :int], :int
+ attach_function3 :flock, [:int, :int], :int
# Time
attach_function :time, [:pointer], :time_t
commit 8e07e7afc34a8d25d280276af28420bf28750108
Author: wanabe <[email protected]>
Date: Sat Feb 26 11:20:26 2011 +0900
add attach_function3 for not exist functions on mingw32.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 838efa7..59ca0bb 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -9,8 +9,12 @@ module FFI::Platform::POSIX
def attach_function2(name, args, ret)
attach_function(name, "_#{name}", args, ret)
end
+ def attach_function3(*args)
+ # do nothing
+ end
else
alias_method :attach_function2, :attach_function
+ alias_method :attach_function3, :attach_function
end
end
@@ -42,46 +46,40 @@ module FFI::Platform::POSIX
attach_function2 :unlink, [:string], :int
attach_function2 :getcwd, [:string, :size_t], :string
attach_function2 :umask, [:mode_t], :int
- unless Rubinius::OS_TYPE == :windows
- attach_function :fchmod, [:int, :mode_t], :int
- # Removed, fails on OS X Tiger, OpenBSD and we are not using it.
- # attach_function 'lchmod', [:string, :mode_t], :int
- attach_function :chown, [:string, :uid_t, :gid_t], :int
- attach_function :fchown, [:int, :uid_t, :gid_t], :int
- attach_function :lchown, [:string, :uid_t, :gid_t], :int
- attach_function :link, [:string, :string], :int
- attach_function :symlink, [:string, :string], :int
- attach_function :readlink, [:string, :pointer, :int], :int
- attach_function :utimes, [:string, :pointer], :int
- end
- attach_function :rename, [:string, :string], :int
+ attach_function3 :fchmod, [:int, :mode_t], :int
+ # Removed, fails on OS X Tiger, OpenBSD and we are not using it.
+ # attach_function 'lchmod', [:string, :mode_t], :int
+ attach_function3 :chown, [:string, :uid_t, :gid_t], :int
+ attach_function3 :fchown, [:int, :uid_t, :gid_t], :int
+ attach_function3 :lchown, [:string, :uid_t, :gid_t], :int
+ attach_function3 :link, [:string, :string], :int
+ attach_function3 :symlink, [:string, :string], :int
+ attach_function3 :readlink, [:string, :pointer, :int], :int
+ attach_function3 :utimes, [:string, :pointer], :int
+ attach_function :rename, [:string, :string], :int
# directories
attach_function2 :chdir, [:string], :int
attach_function2 :mkdir, [:string, :short], :int
attach_function2 :rmdir, [:string], :int
- unless Rubinius::OS_TYPE == :windows
- attach_function :opendir, [:string], :pointer
- attach_function :readdir, [:pointer], :pointer
- attach_function :rewinddir, [:pointer], :void
- attach_function :closedir, [:pointer], :int
- attach_function :chroot, [:string], :int
-
- attach_function :fnmatch, [:string, :string, :int], :int
- end
+ attach_function3 :opendir, [:string], :pointer
+ attach_function3 :readdir, [:pointer], :pointer
+ attach_function3 :rewinddir, [:pointer], :void
+ attach_function3 :closedir, [:pointer], :int
+ attach_function3 :chroot, [:string], :int
+
+ attach_function3 :fnmatch, [:string, :string, :int], :int
# File/IO
- attach_function :fcntl, [:int, :int, :int], :int unless Rubinius::OS_TYPE == :windows
+ attach_function3 :fcntl, [:int, :int, :int], :int
# opening/closing
attach_function2 :open, [:string, :int, :int], :int
attach_function2 :fdopen, [:int, :string], :pointer
attach_function2 :dup, [:int], :int
- unless Rubinius::OS_TYPE == :windows
- attach_function :fsync, [:int], :int
- end
- attach_function :fopen, [:string, :string], :pointer
- attach_function :fclose, [:pointer], :int
+ attach_function3 :fsync, [:int], :int
+ attach_function :fopen, [:string, :string], :pointer
+ attach_function :fclose, [:pointer], :int
# buffering
attach_function :fflush, [:pointer], :int
@@ -106,10 +104,8 @@ module FFI::Platform::POSIX
attach_function :ungetc, [:int, :pointer], :int
# truncating
- unless Rubinius::OS_TYPE == :windows
- attach_function :truncate, [:string, :off_t], :int
- attach_function :ftruncate, [:int, :off_t], :int
- end
+ attach_function3 :truncate, [:string, :off_t], :int
+ attach_function3 :ftruncate, [:int, :off_t], :int
# locking
attach_function :flock, [:int, :int], :int
commit 3723b3d302d6f015cc578c80e67fe34c5ee07f10
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:56:08 2011 +0900
msvcrt.dll doesn't have truncate and ftruncate.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 71523df..838efa7 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -106,8 +106,10 @@ module FFI::Platform::POSIX
attach_function :ungetc, [:int, :pointer], :int
# truncating
- attach_function :truncate, [:string, :off_t], :int
- attach_function :ftruncate, [:int, :off_t], :int
+ unless Rubinius::OS_TYPE == :windows
+ attach_function :truncate, [:string, :off_t], :int
+ attach_function :ftruncate, [:int, :off_t], :int
+ end
# locking
attach_function :flock, [:int, :int], :int
commit 694811fcf04ab8744ca3d7a0396e5297e12dfc92
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:53:41 2011 +0900
mingw32 doesn't have time_t and suseconds_t.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 29bbc28..2f67d13 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -37,8 +37,8 @@ file 'runtime/platform.conf' => deps do |task|
timeval = FFI::StructGenerator.new 'timeval' do |s|
s.include "sys/time.h"
s.name 'struct timeval'
- s.field :tv_sec, :time_t
- s.field :tv_usec, :suseconds_t
+ s.field :tv_sec, BUILD_CONFIG[:windows] ? :long : :time_t
+ s.field :tv_usec, BUILD_CONFIG[:windows] ? :long : :suseconds_t
end
sockaddr_in = FFI::StructGenerator.new 'sockaddr_in' do |s|
commit ede0af76b1e982e9377e42d457f0cefeaad3ca30
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:53:10 2011 +0900
for filesystem API of mingw32.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 3b607e4..71523df 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -87,14 +87,14 @@ module FFI::Platform::POSIX
attach_function :fflush, [:pointer], :int
# inspecting
- attach_function :fileno, [:pointer], :int
- attach_function :feof, [:pointer], :int
- attach_function :ferror, [:pointer], :int
- attach_function :clearerr, [:pointer], :void
- attach_function :fseek, [:pointer, :int, :int], :int
- attach_function :ftell, [:pointer], :int
- attach_function :lseek, [:int, :int, :int], :int
- attach_function :isatty, [:int], :int
+ attach_function2 :fileno, [:pointer], :int
+ attach_function :feof, [:pointer], :int
+ attach_function :ferror, [:pointer], :int
+ attach_function :clearerr, [:pointer], :void
+ attach_function :fseek, [:pointer, :int, :int], :int
+ attach_function :ftell, [:pointer], :int
+ attach_function2 :lseek, [:int, :int, :int], :int
+ attach_function2 :isatty, [:int], :int
# reading
attach_function :fread, [:string, :size_t, :size_t, :pointer], :size_t
commit 1bca78686a57523b40c69551269cc2bbdf2dfba0
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:50:23 2011 +0900
add attach_function2 for prefix '_' like _putenv.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index c1c235c..3b607e4 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -4,13 +4,23 @@
module FFI::Platform::POSIX
extend FFI::Library
+ class << self
+ if Rubinius::OS_TYPE == :windows
+ def attach_function2(name, args, ret)
+ attach_function(name, "_#{name}", args, ret)
+ end
+ else
+ alias_method :attach_function2, :attach_function
+ end
+ end
+
# errors
if Rubinius::OS_TYPE == :windows
- attach_function :errno, '_errno', [], :int
- attach_function :errno=, '_set_errno', [:int], :void
+ attach_function :errno, '_errno', [], :int
+ attach_function :errno=, '_set_errno', [:int], :void
else
- attach_function :errno, 'ffi_errno', [], :int
- attach_function :errno=, 'ffi_set_errno', [:int], :void
+ attach_function :errno, 'ffi_errno', [], :int
+ attach_function :errno=, 'ffi_set_errno', [:int], :void
end
attach_function :strerror, [:int], :string
attach_function :perror, [:string], :void
@@ -27,24 +37,18 @@ module FFI::Platform::POSIX
attach_function :rand, [], :uint
# file system
- if Rubinius::OS_TYPE == :windows
- attach_function :access, '_access', [:string, :int], :int
- attach_function :chmod, '_chmod', [:string, :mode_t], :int
- attach_function :unlink, '_unlink', [:string], :int
- attach_function :getcwd, '_getcwd', [:string, :size_t], :string
- attach_function :umask, '_umask', [:mode_t], :int
- else
- attach_function :access, [:string, :int], :int
- attach_function :chmod, [:string, :mode_t], :int
+ attach_function2 :access, [:string, :int], :int
+ attach_function2 :chmod, [:string, :mode_t], :int
+ attach_function2 :unlink, [:string], :int
+ attach_function2 :getcwd, [:string, :size_t], :string
+ attach_function2 :umask, [:mode_t], :int
+ unless Rubinius::OS_TYPE == :windows
attach_function :fchmod, [:int, :mode_t], :int
# Removed, fails on OS X Tiger, OpenBSD and we are not using it.
# attach_function 'lchmod', [:string, :mode_t], :int
attach_function :chown, [:string, :uid_t, :gid_t], :int
attach_function :fchown, [:int, :uid_t, :gid_t], :int
attach_function :lchown, [:string, :uid_t, :gid_t], :int
- attach_function :unlink, [:string], :int
- attach_function :getcwd, [:string, :size_t], :string
- attach_function :umask, [:mode_t], :int
attach_function :link, [:string, :string], :int
attach_function :symlink, [:string, :string], :int
attach_function :readlink, [:string, :pointer, :int], :int
@@ -53,18 +57,14 @@ module FFI::Platform::POSIX
attach_function :rename, [:string, :string], :int
# directories
- if Rubinius::OS_TYPE == :windows
- attach_function :chdir, '_chdir', [:string], :int
- attach_function :mkdir, '_mkdir', [:string, :short], :int
- attach_function :rmdir, '_rmdir', [:string], :int
- else
- attach_function :chdir, [:string], :int
+ attach_function2 :chdir, [:string], :int
+ attach_function2 :mkdir, [:string, :short], :int
+ attach_function2 :rmdir, [:string], :int
+ unless Rubinius::OS_TYPE == :windows
attach_function :opendir, [:string], :pointer
attach_function :readdir, [:pointer], :pointer
attach_function :rewinddir, [:pointer], :void
attach_function :closedir, [:pointer], :int
- attach_function :mkdir, [:string, :short], :int
- attach_function :rmdir, [:string], :int
attach_function :chroot, [:string], :int
attach_function :fnmatch, [:string, :string, :int], :int
@@ -74,17 +74,12 @@ module FFI::Platform::POSIX
attach_function :fcntl, [:int, :int, :int], :int unless Rubinius::OS_TYPE == :windows
# opening/closing
- if Rubinius::OS_TYPE == :windows
- attach_function :open, '_open', [:string, :int, :int], :int
- attach_function :fdopen, '_fdopen', [:int, :string], :pointer
- attach_function :dup, '_dup', [:int], :int
- else
- attach_function :open, [:string, :int, :int], :int
- attach_function :fdopen, [:int, :string], :pointer
+ attach_function2 :open, [:string, :int, :int], :int
+ attach_function2 :fdopen, [:int, :string], :pointer
+ attach_function2 :dup, [:int], :int
+ unless Rubinius::OS_TYPE == :windows
attach_function :fsync, [:int], :int
-
- attach_function :dup, [:int], :int
- end
+ end
attach_function :fopen, [:string, :string], :pointer
attach_function :fclose, [:pointer], :int
commit 7679befda93f60cc3f6fb48a97b97fa4ca492d12
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:24:57 2011 +0900
for filesystem API of mingw32.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 79f6b99..c1c235c 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -53,28 +53,40 @@ module FFI::Platform::POSIX
attach_function :rename, [:string, :string], :int
# directories
- attach_function :chdir, [:string], :int
- attach_function :opendir, [:string], :pointer
- attach_function :readdir, [:pointer], :pointer
- attach_function :rewinddir, [:pointer], :void
- attach_function :closedir, [:pointer], :int
- attach_function :mkdir, [:string, :short], :int
- attach_function :rmdir, [:string], :int
- attach_function :chroot, [:string], :int
-
- attach_function :fnmatch, [:string, :string, :int], :int
+ if Rubinius::OS_TYPE == :windows
+ attach_function :chdir, '_chdir', [:string], :int
+ attach_function :mkdir, '_mkdir', [:string, :short], :int
+ attach_function :rmdir, '_rmdir', [:string], :int
+ else
+ attach_function :chdir, [:string], :int
+ attach_function :opendir, [:string], :pointer
+ attach_function :readdir, [:pointer], :pointer
+ attach_function :rewinddir, [:pointer], :void
+ attach_function :closedir, [:pointer], :int
+ attach_function :mkdir, [:string, :short], :int
+ attach_function :rmdir, [:string], :int
+ attach_function :chroot, [:string], :int
+
+ attach_function :fnmatch, [:string, :string, :int], :int
+ end
# File/IO
- attach_function :fcntl, [:int, :int, :int], :int
+ attach_function :fcntl, [:int, :int, :int], :int unless Rubinius::OS_TYPE == :windows
# opening/closing
- attach_function :open, [:string, :int, :int], :int
- attach_function :fdopen, [:int, :string], :pointer
+ if Rubinius::OS_TYPE == :windows
+ attach_function :open, '_open', [:string, :int, :int], :int
+ attach_function :fdopen, '_fdopen', [:int, :string], :pointer
+ attach_function :dup, '_dup', [:int], :int
+ else
+ attach_function :open, [:string, :int, :int], :int
+ attach_function :fdopen, [:int, :string], :pointer
+ attach_function :fsync, [:int], :int
+
+ attach_function :dup, [:int], :int
+ end
attach_function :fopen, [:string, :string], :pointer
attach_function :fclose, [:pointer], :int
- attach_function :fsync, [:int], :int
-
- attach_function :dup, [:int], :int
# buffering
attach_function :fflush, [:pointer], :int
commit 6d2410a3092ffa6fd5442210e3ca2cf1ed00277e
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:11:44 2011 +0900
for filesystem API of mingw32.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 4224e98..79f6b99 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -27,22 +27,30 @@ module FFI::Platform::POSIX
attach_function :rand, [], :uint
# file system
- attach_function :access, [:string, :int], :int
- attach_function :chmod, [:string, :mode_t], :int
- attach_function :fchmod, [:int, :mode_t], :int
- # Removed, fails on OS X Tiger, OpenBSD and we are not using it.
-# attach_function 'lchmod', [:string, :mode_t], :int
- attach_function :chown, [:string, :uid_t, :gid_t], :int
- attach_function :fchown, [:int, :uid_t, :gid_t], :int
- attach_function :lchown, [:string, :uid_t, :gid_t], :int
- attach_function :unlink, [:string], :int
- attach_function :getcwd, [:string, :size_t], :string
- attach_function :umask, [:mode_t], :int
- attach_function :link, [:string, :string], :int
- attach_function :symlink, [:string, :string], :int
- attach_function :readlink, [:string, :pointer, :int], :int
+ if Rubinius::OS_TYPE == :windows
+ attach_function :access, '_access', [:string, :int], :int
+ attach_function :chmod, '_chmod', [:string, :mode_t], :int
+ attach_function :unlink, '_unlink', [:string], :int
+ attach_function :getcwd, '_getcwd', [:string, :size_t], :string
+ attach_function :umask, '_umask', [:mode_t], :int
+ else
+ attach_function :access, [:string, :int], :int
+ attach_function :chmod, [:string, :mode_t], :int
+ attach_function :fchmod, [:int, :mode_t], :int
+ # Removed, fails on OS X Tiger, OpenBSD and we are not using it.
+ # attach_function 'lchmod', [:string, :mode_t], :int
+ attach_function :chown, [:string, :uid_t, :gid_t], :int
+ attach_function :fchown, [:int, :uid_t, :gid_t], :int
+ attach_function :lchown, [:string, :uid_t, :gid_t], :int
+ attach_function :unlink, [:string], :int
+ attach_function :getcwd, [:string, :size_t], :string
+ attach_function :umask, [:mode_t], :int
+ attach_function :link, [:string, :string], :int
+ attach_function :symlink, [:string, :string], :int
+ attach_function :readlink, [:string, :pointer, :int], :int
+ attach_function :utimes, [:string, :pointer], :int
+ end
attach_function :rename, [:string, :string], :int
- attach_function :utimes, [:string, :pointer], :int
# directories
attach_function :chdir, [:string], :int
commit 2f83aea53e2ff8510aabf677079413e7b38fd988
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:07:36 2011 +0900
can't load ffi_errno on mingw32.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index f1a7b16..4224e98 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -5,8 +5,13 @@ module FFI::Platform::POSIX
extend FFI::Library
# errors
- attach_function :errno, 'ffi_errno', [], :int
- attach_function :errno=, 'ffi_set_errno', [:int], :void
+ if Rubinius::OS_TYPE == :windows
+ attach_function :errno, '_errno', [], :int
+ attach_function :errno=, '_set_errno', [:int], :void
+ else
+ attach_function :errno, 'ffi_errno', [], :int
+ attach_function :errno=, 'ffi_set_errno', [:int], :void
+ end
attach_function :strerror, [:int], :string
attach_function :perror, [:string], :void
commit b9a01f07a443129e1b2013bb5b47fdc9529c61dc
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:04:01 2011 +0900
msvcrt.dll doesn't have a{cos,sin, tan}h, hypot, erf, erfc.
diff --git a/kernel/platform/math.rb b/kernel/platform/math.rb
index ba64e4f..9cb9f84 100644
--- a/kernel/platform/math.rb
+++ b/kernel/platform/math.rb
@@ -14,18 +14,22 @@ module FFI::Platform::Math
attach_function :cosh, [:double], :double
attach_function :sinh, [:double], :double
attach_function :tanh, [:double], :double
- attach_function :acosh, [:double], :double
- attach_function :asinh, [:double], :double
- attach_function :atanh, [:double], :double
+ unless Rubinius::OS_TYPE == :windows
+ attach_function :acosh, [:double], :double
+ attach_function :asinh, [:double], :double
+ attach_function :atanh, [:double], :double
+ end
attach_function :exp, [:double], :double
attach_function :log, [:double], :double
attach_function :log10, [:double], :double
attach_function :sqrt, [:double], :double
attach_function :frexp, [:double, :pointer], :double
attach_function :ldexp, [:double, :int], :double
- attach_function :hypot, [:double, :double], :double
- attach_function :erf, [:double], :double
- attach_function :erfc, [:double], :double
+ unless Rubinius::OS_TYPE == :windows
+ attach_function :hypot, [:double, :double], :double
+ attach_function :erf, [:double], :double
+ attach_function :erfc, [:double], :double
+ end
# Rubinius-specific, used in Marshal
attach_function :modf, [:double, :pointer], :double
commit 99355d42e440384bfde36b28e71e76a8a5515e23
Author: wanabe <[email protected]>
Date: Sat Feb 26 10:03:05 2011 +0900
mingw32 doesn't have putenv(but has _putenv), setenv, unsetenv, environ.
diff --git a/kernel/platform/env.rb b/kernel/platform/env.rb
index 78e689b..914a7f3 100644
--- a/kernel/platform/env.rb
+++ b/kernel/platform/env.rb
@@ -3,9 +3,13 @@ module Rubinius
extend FFI::Library
attach_function :getenv, [:string], :string
- attach_function :putenv, [:string], :int
- attach_function :setenv, [:string, :string, :int], :int
- attach_function :unsetenv, [:string], :int
- attach_function :environ, 'ffi_environ', [], :pointer
+ if OS_TYPE == :windows
+ attach_function :_putenv, "_putenv", [:string], :int
+ else
+ attach_function :putenv, [:string], :int
+ attach_function :setenv, [:string, :string, :int], :int
+ attach_function :unsetenv, [:string], :int
+ attach_function :environ, 'ffi_environ', [], :pointer
+ end
end
end
commit 4dfbd40df82195d9eee5f13afa53fe06d0cbf831
Author: wanabe <[email protected]>
Date: Sat Feb 26 09:17:19 2011 +0900
Windows can't dlopen(CURRENT_PROCESS).
Load LIBC alternatively.
diff --git a/kernel/platform/library.rb b/kernel/platform/library.rb
index f88fde8..f793560 100644
--- a/kernel/platform/library.rb
+++ b/kernel/platform/library.rb
@@ -241,6 +241,6 @@ module FFI
DynamicLibrary.last_error
end
- CURRENT_PROCESS = DynamicLibrary.new(nil)
+ CURRENT_PROCESS = DynamicLibrary.new(Rubinius::OS_TYPE == :windows ? Library::LIBC : nil)
end
end
commit 1711ada9089a62fe5f694323ca422f0bac7fcbaf
Author: wanabe <[email protected]>
Date: Sat Feb 26 09:15:00 2011 +0900
mingw32 doesn't have dlopen.
diff --git a/kernel/platform/library.rb b/kernel/platform/library.rb
index cf19d4f..f88fde8 100644
--- a/kernel/platform/library.rb
+++ b/kernel/platform/library.rb
@@ -187,10 +187,10 @@ module FFI
pointer_as_function :open_library, FFI::Pointer::DLOPEN, [:string, :int], :pointer
pointer_as_function :last_error, FFI::Pointer::DLERROR, [], :string
- RTLD_LAZY = Rubinius::Config['rbx.platform.dlopen.RTLD_LAZY']
- RTLD_NOW = Rubinius::Config['rbx.platform.dlopen.RTLD_NOW']
- RTLD_GLOBAL = Rubinius::Config['rbx.platform.dlopen.RTLD_GLOBAL']
- RTLD_LOCAL = Rubinius::Config['rbx.platform.dlopen.RTLD_LOCAL']
+ RTLD_LAZY = Rubinius::Config['rbx.platform.dlopen.RTLD_LAZY'] || 0
+ RTLD_NOW = Rubinius::Config['rbx.platform.dlopen.RTLD_NOW'] || 0
+ RTLD_GLOBAL = Rubinius::Config['rbx.platform.dlopen.RTLD_GLOBAL'] || 0
+ RTLD_LOCAL = Rubinius::Config['rbx.platform.dlopen.RTLD_LOCAL'] || 0
class << self
alias_method :open, :new
commit feadc71572463b79d62a44139d81da7bb2d9523a
Author: wanabe <[email protected]>
Date: Sat Feb 26 09:00:42 2011 +0900
affect LDFLAGS and CFLAGS when configure to build extensions.
diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb
index dd46b96..a7006ae 100644
--- a/rakelib/ext_helper.rb
+++ b/rakelib/ext_helper.rb
@@ -21,13 +21,13 @@ $CXX = env "CXX", "g++"
$LDSHARED = env "LDSHARED", $CXX
$YACC = env "YACC", "bison"
-$CFLAGS = env "CFLAGS"
+$CFLAGS = env "CFLAGS", Rubinius::BUILD_CONFIG[:user_cflags]
$CXXFLAGS = env "CXXFLAGS"
$ELIBSDIR = env "ELIBSDIR", File.expand_path("../../vm/external_libs", __FILE__)
$LIBS = env "LIBS"
$LDDIRS = env "LDDIRS"
-$LDFLAGS = env "LDFLAGS"
+$LDFLAGS = env "LDFLAGS", Rubinius::BUILD_CONFIG[:user_ldflags]
$DLEXT = env "DLEXT", DEFAULT["DLEXT"]
$LIBEXT = env "LIBEXT", DEFAULT["LIBEXT"]
commit 4a9ff53e06eddbba954a9b15d5d9980a7e8bc407
Author: wanabe <[email protected]>
Date: Sat Feb 26 07:06:42 2011 +0900
mingw32 need librbx.a to build extensions.
diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb
index b8e0b1e..dd46b96 100644
--- a/rakelib/ext_helper.rb
+++ b/rakelib/ext_helper.rb
@@ -118,6 +118,11 @@ def add_rbx_capi
add_cflag "-ggdb3 -O2"
add_cxxflag "-ggdb3 -O2"
add_include_dir File.expand_path("../../vm/capi/include", __FILE__)
+ case RUBY_PLATFORM
+ when /mswin32/, /mingw32/, /bccwin32/
+ add_link_dir File.expand_path("../../vm", __FILE__)
+ add_shared_lib "rbx"
+ end
end
# Setup some initial computed values
commit 1d8a8d19696d042153748458625eb6153abfc823
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:58:46 2011 +0900
mingw32 doesn't have dlopen.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 05f3b5f..29bbc28 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -584,7 +584,7 @@ file 'runtime/platform.conf' => deps do |task|
process_cg.dump_constants f
signal_cg.dump_constants f
zlib_cg.dump_constants f
- dlopen_cg.dump_constants f
+ dlopen_cg.dump_constants f unless BUILD_CONFIG[:windows]
f.puts FFI::TypesGenerator.generate
end
commit 7b4d0f65191146895c5aefa7a1b74dabe471bea0
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:57:50 2011 +0900
mingw32 doesn't have rlimit.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index ecd7a04..05f3b5f 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -575,7 +575,7 @@ file 'runtime/platform.conf' => deps do |task|
sockaddr_un.dump_config f if !BUILD_CONFIG[:windows] && sockaddr_un.found?
servent.dump_config f
stat.dump_config f
- rlimit.dump_config f
+ rlimit.dump_config f unless BUILD_CONFIG[:windows]
file_cg.dump_constants f
io_cg.dump_constants f
commit 2a36c08e7be0451bf64be8b731c32d4eafcc6427
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:57:01 2011 +0900
mingw32 doesn't have sockaddr_un.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index ac52581..ecd7a04 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -572,7 +572,7 @@ file 'runtime/platform.conf' => deps do |task|
dirent.dump_config f
timeval.dump_config f
sockaddr_in.dump_config f
- sockaddr_un.dump_config f if sockaddr_un.found?
+ sockaddr_un.dump_config f if !BUILD_CONFIG[:windows] && sockaddr_un.found?
servent.dump_config f
stat.dump_config f
rlimit.dump_config f
commit 0e3532e7e1525ee4168fa65cd314c433759abdbd
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:56:35 2011 +0900
mingw32 doesn't have <dlfcn.h>.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 1d076fd..ac52581 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -563,7 +563,7 @@ file 'runtime/platform.conf' => deps do |task|
]
dlopen_constants.each { |c| cg.const c }
- end
+ end unless BUILD_CONFIG[:windows]
puts "Generating #{task.name}..." if $verbose
commit 168052cebcb40e7a5f4ad04c2a2661b549531f8a
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:42:41 2011 +0900
mingw32 doesn't have <sys/signal.h>.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 28e0f34..1d076fd 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -492,7 +492,7 @@ file 'runtime/platform.conf' => deps do |task|
signal_cg = FFI::ConstGenerator.new 'rbx.platform.signal' do |cg|
cg.include 'signal.h'
- cg.include 'sys/signal.h'
+ cg.include 'sys/signal.h' unless BUILD_CONFIG[:windows]
signal_constants = %w{
SIGHUP
commit b512906bc477435952aaa17665ec8feac81ff219
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:39:57 2011 +0900
Windows has winsock2.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index ee105c5..28e0f34 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -185,11 +185,16 @@ file 'runtime/platform.conf' => deps do |task|
end
socket_cg = FFI::ConstGenerator.new 'rbx.platform.socket' do |cg|
- cg.include 'sys/types.h'
- cg.include 'sys/socket.h'
- cg.include 'netdb.h'
- cg.include 'netinet/tcp.h'
- cg.include 'netinet/in.h'
+ if BUILD_CONFIG[:windows]
+ cg.include 'winsock2.h'
+ cg.include 'ws2tcpip.h'
+ else
+ cg.include 'sys/types.h'
+ cg.include 'sys/socket.h'
+ cg.include 'netdb.h'
+ cg.include 'netinet/tcp.h'
+ cg.include 'netinet/in.h'
+ end
socket_constants = %w[
AF_APPLETALK
@@ -431,7 +436,13 @@ file 'runtime/platform.conf' => deps do |task|
TCP_NODELAY
]
- socket_constants.each { |c| cg.const c }
+ socket_constants.each do |c|
+ format = nil
+ if BUILD_CONFIG[:windows] && c =~ /^INADDR_(ANY|BROADCAST)$|^EAI_/#%w[
+ format = '%ld'
+ end
+ cg.const c, format
+ end
end
process_cg = FFI::ConstGenerator.new 'rbx.platform.process' do |cg|
commit 71b0b94d001c03e7c34e999850654dc1c028a5d7
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:37:22 2011 +0900
retry when failed to unlink executable file.
diff --git a/lib/ffi/const_generator.rb b/lib/ffi/const_generator.rb
index dccdd36..5e7a384 100644
--- a/lib/ffi/const_generator.rb
+++ b/lib/ffi/const_generator.rb
@@ -94,8 +94,12 @@ module FFI
end
output = `#{binary}`
- sleep 0.1
- File.unlink binary
+ begin
+ File.unlink(binary)
+ rescue SystemCallError
+ sleep 0.01
+ retry
+ end
output.each_line do |line|
line =~ /^(\S+)\s(.*)$/
diff --git a/lib/ffi/struct_generator.rb b/lib/ffi/struct_generator.rb
index 52f71aa..1870933 100644
--- a/lib/ffi/struct_generator.rb
+++ b/lib/ffi/struct_generator.rb
@@ -88,8 +88,12 @@ module FFI
end
output = `./#{binary}`.split "\n"
- sleep 0.1
- File.unlink(binary)
+ begin
+ File.unlink(binary)
+ rescue SystemCallError
+ sleep 0.01
+ retry
+ end
sizeof = output.shift
unless @size
commit eb7acdac8cf9359838e84e2eea7fc2299e3f73d4
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:36:28 2011 +0900
mingw32 doesn't have <resource.h>.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index bea635e..ee105c5 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -103,7 +103,7 @@ file 'runtime/platform.conf' => deps do |task|
s.name 'struct rlimit'
s.field :rlim_cur, :rlim_t
s.field :rlim_max, :rlim_t
- end
+ end unless BUILD_CONFIG[:windows]
# FIXME these constants don't have standard names. LOCK_SH == Linux,
# O_SHLOCK on Bsd/Darwin, etc. Binary doesn't exist at all in many non-Unix
@@ -435,8 +435,10 @@ file 'runtime/platform.conf' => deps do |task|
end
process_cg = FFI::ConstGenerator.new 'rbx.platform.process' do |cg|
- cg.include 'sys/wait.h'
- cg.include 'sys/resource.h'
+ unless BUILD_CONFIG[:windows]
+ cg.include 'sys/wait.h'
+ cg.include 'sys/resource.h'
+ end
cg.include 'stdlib.h'
process_constants = %w{
commit 374d0823168021dd67c173dea845506d1e35d56b
Author: wanabe <[email protected]>
Date: Sat Feb 26 06:29:22 2011 +0900
the definition of struct stat on mingw32 is different from POSIX's.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index d6ae1be..bea635e 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -82,13 +82,15 @@ file 'runtime/platform.conf' => deps do |task|
s.field :st_dev, :dev_t
s.field :st_ino, :ino_t
s.field :st_mode, :mode_t
- s.field :st_nlink, :nlink_t
- s.field :st_uid, :uid_t
- s.field :st_gid, :gid_t
+ s.field :st_nlink, BUILD_CONFIG[:windows] ? :short : :nlink_t
+ s.field :st_uid, BUILD_CONFIG[:windows] ? :short : :uid_t
+ s.field :st_gid, BUILD_CONFIG[:windows] ? :short : :gid_t
s.field :st_rdev, :dev_t
s.field :st_size, :off_t
- s.field :st_blksize
- s.field :st_blocks
+ unless BUILD_CONFIG[:windows]
+ s.field :st_blksize
+ s.field :st_blocks
+ end
s.field :st_atime, :time_t
s.field :st_mtime, :time_t
s.field :st_ctime, :time_t
commit 61003661584903924f229ff8d0f95f573e6821c3
Author: wanabe <[email protected]>
Date: Sat Feb 26 00:34:49 2011 +0900
servent is defined in <winsock2.h>.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 385ace9..d6ae1be 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -65,7 +65,7 @@ file 'runtime/platform.conf' => deps do |task|
end unless BUILD_CONFIG[:windows]
servent = FFI::StructGenerator.new 'servent' do |s|
- s.include "netdb.h"
+ s.include BUILD_CONFIG[:windows] ? "winsock2.h" : "netdb.h"
s.name 'struct servent'
s.field :s_name, :pointer
s.field :s_aliases, :pointer
commit e0158852ca13b88c062b9b0e6e01a6df01df1278
Author: wanabe <[email protected]>
Date: Sat Feb 26 00:32:51 2011 +0900
wait longer.
diff --git a/lib/ffi/const_generator.rb b/lib/ffi/const_generator.rb
index be24396..dccdd36 100644
--- a/lib/ffi/const_generator.rb
+++ b/lib/ffi/const_generator.rb
@@ -94,7 +94,7 @@ module FFI
end
output = `#{binary}`
- sleep 0.01
+ sleep 0.1
File.unlink binary
output.each_line do |line|
diff --git a/lib/ffi/struct_generator.rb b/lib/ffi/struct_generator.rb
index f70b02f..52f71aa 100644
--- a/lib/ffi/struct_generator.rb
+++ b/lib/ffi/struct_generator.rb
@@ -88,7 +88,7 @@ module FFI
end
output = `./#{binary}`.split "\n"
- sleep 0.01
+ sleep 0.1
File.unlink(binary)
sizeof = output.shift
commit 2348c154f7a08c7f9a07b70dfc499a33bf1a5cb7
Author: wanabe <[email protected]>
Date: Sat Feb 26 00:31:39 2011 +0900
mingw32 has no definition of sockaddr_un.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index d46729b..385ace9 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -62,7 +62,7 @@ file 'runtime/platform.conf' => deps do |task|
s.name 'struct sockaddr_un'
s.field :sun_family, :sa_family_t
s.field :sun_path, :char_array
- end
+ end unless BUILD_CONFIG[:windows]
servent = FFI::StructGenerator.new 'servent' do |s|
s.include "netdb.h"
commit 718914a28347195b5705fc35a991f4da07c44364
Author: wanabe <[email protected]>
Date: Sat Feb 26 00:28:53 2011 +0900
sockaddr_in is defined by <winsock2.h>
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index 018358a..d46729b 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -42,10 +42,14 @@ file 'runtime/platform.conf' => deps do |task|
end
sockaddr_in = FFI::StructGenerator.new 'sockaddr_in' do |s|
- s.include "netinet/in.h"
- s.include "fcntl.h"
- s.include "sys/socket.h"
- s.include "sys/stat.h"
+ if BUILD_CONFIG[:windows]
+ s.include 'winsock2.h'
+ else
+ s.include "netinet/in.h"
+ s.include "fcntl.h"
+ s.include "sys/socket.h"
+ s.include "sys/stat.h"
+ end
s.name 'struct sockaddr_in'
s.field :sin_family, :sa_family_t
s.field :sin_port, :ushort
commit db7101bd9d84ba4ef72324ff5bdc0bf4f52f2eb0
Author: wanabe <[email protected]>
Date: Fri Feb 25 23:59:25 2011 +0900
process may not finish after ``.
diff --git a/lib/ffi/const_generator.rb b/lib/ffi/const_generator.rb
index ed2df9d..be24396 100644
--- a/lib/ffi/const_generator.rb
+++ b/lib/ffi/const_generator.rb
@@ -94,6 +94,7 @@ module FFI
end
output = `#{binary}`
+ sleep 0.01
File.unlink binary
output.each_line do |line|
diff --git a/lib/ffi/struct_generator.rb b/lib/ffi/struct_generator.rb
index e857e70..f70b02f 100644
--- a/lib/ffi/struct_generator.rb
+++ b/lib/ffi/struct_generator.rb
@@ -88,6 +88,7 @@ module FFI
end
output = `./#{binary}`.split "\n"
+ sleep 0.01
File.unlink(binary)
sizeof = output.shift
commit 07d4e4ad22807e1f39bfb863f3c9f7f11d1da0bc
Author: wanabe <[email protected]>
Date: Fri Feb 25 23:56:41 2011 +0900
mingw32's gcc add '.exe' postfix to executable files.
diff --git a/lib/ffi/const_generator.rb b/lib/ffi/const_generator.rb
index 495301c..ed2df9d 100644
--- a/lib/ffi/const_generator.rb
+++ b/lib/ffi/const_generator.rb
@@ -62,6 +62,7 @@ module FFI
def calculate
binary = File.join Dir.tmpdir, "rb_const_gen_bin_#{Process.pid}"
+ binary << ".exe" if Rubinius::BUILD_CONFIG[:windows]
Tempfile.open("#{@prefix}.const_generator") do |f|
f.puts "#include <stdio.h>"
diff --git a/lib/ffi/struct_generator.rb b/lib/ffi/struct_generator.rb
index ee99bc1..e857e70 100644
--- a/lib/ffi/struct_generator.rb
+++ b/lib/ffi/struct_generator.rb
@@ -52,6 +52,7 @@ module FFI
def calculate
binary = "rb_struct_gen_bin_#{Process.pid}"
+ binary << ".exe" if Rubinius::BUILD_CONFIG[:windows]
raise "struct name not set" if @struct_name.nil?
commit 52e0b322518675303e70f093c410dcadcc5bfa6b
Author: wanabe <[email protected]>
Date: Fri Feb 25 23:49:30 2011 +0900
addrinfo is defined by <ws2tcpip.h>.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index a5bb68e..018358a 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -8,8 +8,12 @@ file 'runtime/platform.conf' => deps do |task|
puts "GEN runtime/platform.conf"
addrinfo = FFI::StructGenerator.new 'addrinfo' do |s|
- s.include 'sys/socket.h'
- s.include 'netdb.h'
+ if BUILD_CONFIG[:windows]
+ s.include 'ws2tcpip.h'
+ else
+ s.include 'sys/socket.h'
+ s.include 'netdb.h'
+ end
s.name 'struct addrinfo'
s.field :ai_flags, :int
s.field :ai_family, :int
commit 17c2432b58e36cc9fd4c39b3d4207c465e6e51f8
Author: wanabe <[email protected]>
Date: Fri Feb 25 23:46:53 2011 +0900
expand macro of LDSHARED by ruby.
diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb
index ce21651..b8e0b1e 100644
--- a/rakelib/ext_helper.rb
+++ b/rakelib/ext_helper.rb
@@ -97,7 +97,11 @@ def add_mri_capi
$LIBS << " #{DEFAULT["LIBS"]}"
$LIBS << " #{DEFAULT["DLDLIBS"]}"
- add_ldflag DEFAULT["LDSHARED"].split[1..-1].join(' ')
+ ldshared = DEFAULT["LDSHARED"].split[1..-1].join(' ')
+ omit_symbol = %w[-g -g0].include?(DEFAULT["debugflags"]) ? "-s" : ""
+ pat = Regexp.escape("$(if $(filter-out -g -g0,PAT),,-s)").sub!("PAT", ".*?")
+ ldshared.gsub! /#{pat}/, omit_symbol
+ add_ldflag ldshared
add_ldflag DEFAULT["LDFLAGS"]
rubyhdrdir = DEFAULT["rubyhdrdir"]
if RUBY_VERSION =~ /\A1\.9\./
commit 2962f961113838cfdbb50e78cc7d74d15091fb3e
Author: wanabe <[email protected]>
Date: Fri Feb 25 22:59:33 2011 +0900
skip lib/etc.rb and lib/syslog.rb for windows.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index 7e72b8d..3169273 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -417,7 +417,13 @@ namespace :build do
namespace :ffi do
- FFI_PREPROCESSABLES = %w[ lib/etc.rb
+ FFI_PREPROCESSABLES = BUILD_CONFIG[:windows] ?
+ %w[
+ lib/fcntl.rb
+ lib/zlib.rb
+ ] :
+ %w[
+ lib/etc.rb
lib/fcntl.rb
lib/syslog.rb
lib/zlib.rb
commit ac5e708618687cad5142e222d2d1edd33ef28e98
Author: wanabe <[email protected]>
Date: Fri Feb 25 22:54:33 2011 +0900
mingw32's ld is sequence-sensitive.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index 0f09329..7e72b8d 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -272,10 +272,10 @@ def ld(t)
l = ex_libs.join(' ')
if $verbose
- sh "#{ld} #{link_opts} -o #{t.name} #{o} #{l}"
+ sh "#{ld} -o #{t.name} #{o} #{l} #{link_opts}"
else
puts "LD #{t.name}"
- sh "#{ld} #{link_opts} -o #{t.name} #{o} #{l}", :verbose => false
+ sh "#{ld} -o #{t.name} #{o} #{l} #{link_opts}", :verbose => false
end
end
commit 587628c02bacaf9987169e56bf11e736127eb4e7
Author: wanabe <[email protected]>
Date: Fri Feb 25 22:51:33 2011 +0900
create librbx.a for C extensions.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index c3ca6de..0f09329 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -241,6 +241,7 @@ def ld(t)
link_opts = llvm_link_flags()
link_opts += ' -Wl,--export-dynamic' if RUBY_PLATFORM =~ /linux|openbsd/i
+ link_opts += ' -Wl,--export-all-symbols -Wl,--output-def,vm/librbx.def -Wl,--out-implib,vm/librbx.a' if BUILD_CONFIG[:windows]
link_opts += ' -rdynamic' if RUBY_PLATFORM =~ /bsd/
link_opts += ' -lstdc++'
commit 5941d6cc90db956bd0baf36f6861395630c587ef
Author: wanabe <[email protected]>
Date: Fri Feb 25 22:49:24 2011 +0900
mingw32's gcc add '.exe' postfix to executable files.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index b6b65aa..c3ca6de 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -12,8 +12,9 @@ config.compile_with_llvm = false
CONFIG = config
DEV_NULL = RUBY_PLATFORM =~ /mingw|mswin/ ? 'NUL' : '/dev/null'
+VM_EXE = BUILD_CONFIG[:windows] ? 'vm/vm.exe' : 'vm/vm'
-task :vm => 'vm/vm'
+task :vm => VM_EXE
############################################################
# Files, Flags, & Constants
@@ -498,7 +499,7 @@ end
files TYPE_GEN, field_extract_headers + %w[vm/codegen/field_extract.rb] + [:run_field_extract] do
end
-file 'vm/vm' => EXTERNALS + objs + vm_objs do |t|
+file VM_EXE => EXTERNALS + objs + vm_objs do |t|
ld t
end
@@ -645,7 +646,7 @@ namespace :vm do
'vm/test/runner',
'vm/test/runner.cpp',
'vm/test/runner.o',
- 'vm/vm',
+ VM_EXE,
'vm/.deps'
].exclude("vm/gen/config.h")
commit 70cb80ec827f125fb6e9d0ca409039e02158db1b
Author: wanabe <[email protected]>
Date: Fri Feb 25 22:02:45 2011 +0900
need definition of struct timespec.
diff --git a/vm/util/time.c b/vm/util/time.c
index d217c66..bd930d7 100644
--- a/vm/util/time.c
+++ b/vm/util/time.c
@@ -415,7 +415,9 @@ out_of_range:
#include "vm/config.h"
-#ifndef RBX_WINDOWS
+#ifdef RBX_WINDOWS
+#include <pthread.h>
+#else
#define HAVE_TM_ZONE 1
#endif
commit d3feb673a694ad2e1e761d477d5d878379190235
Author: wanabe <[email protected]>
Date: Fri Feb 25 21:37:45 2011 +0900
alloca() is defined in <malloc.h> on mingw32.
diff --git a/vm/vm.hpp b/vm/vm.hpp
index c3d5739..66c7f68 100644
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -24,6 +24,10 @@
#include <vector>
#include <setjmp.h>
+#ifdef RBX_WINDOWS
+#include <malloc.h>
+#endif
+
namespace llvm {
class Module;
}
commit 6da8dfc8ddb8bbe3992bfcb8912c04b30bc28e16
Author: wanabe <[email protected]>
Date: Fri Feb 25 06:28:57 2011 +0900
getnameinfo() is since WinXP.
diff --git a/vm/builtin/io.cpp b/vm/builtin/io.cpp
index 6aa73d6..24e2dab 100644
--- a/vm/builtin/io.cpp
+++ b/vm/builtin/io.cpp
@@ -4,6 +4,9 @@
#include <fcntl.h>
#ifdef RBX_WINDOWS
+#ifndef WINVER
+#define WINVER 0x0501
+#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#else
commit de98c0b7ee180d42d92aa599a4ae2f8293115dc4
Author: wanabe <[email protected]>
Date: Fri Feb 25 06:28:33 2011 +0900
process may not finish after system().
diff --git a/configure b/configure
index 6959bc2..6e0be9a 100755
--- a/configure
+++ b/configure
@@ -675,6 +675,7 @@ class Configure
system expand("./#{basename}")
return $?.exitstatus
ensure
+ sleep 0.01
File.delete(*Dir["#{basename}*"])
end
end
commit 086a2f10ed4337338d22d60378a5c0ec1b57061a
Author: wanabe <[email protected]>
Date: Fri Feb 25 06:15:46 2011 +0900
gcc on MinGW32 expect declaration of struct timespec before
"int pthread_delay_np (const struct timespec *interval)".
diff --git a/vm/external_libs/winpthreads/include/pthread.h b/vm/external_libs/winpthreads/include/pthread.h
index f4583c7..07101cb 100644
--- a/vm/external_libs/winpthreads/include/pthread.h
+++ b/vm/external_libs/winpthreads/include/pthread.h
@@ -158,7 +158,6 @@ extern "C" {
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
void * pthread_timechange_handler_np(void * dummy);
-int pthread_delay_np (const struct timespec *interval);
int pthread_num_processors_np(void);
int pthread_set_num_processors_np(int n);
@@ -226,6 +225,8 @@ struct itimerspec {
};
#endif
+int pthread_delay_np (const struct timespec *interval);
+
/* Some POSIX realtime extensions, mostly stubbed */
#define SCHED_OTHER 0
#define SCHED_FIFO 1
commit 5fe3f4362c0b6c8cb45cdcc80ff75c1acf3f00b7
Author: wanabe <[email protected]>
Date: Fri Feb 25 06:08:18 2011 +0900
MinGW32 has no <winternl.h>
# TODO: How treat 32bit mingw-w64?
diff --git a/vm/external_libs/winpthreads/src/mutex.c b/vm/external_libs/winpthreads/src/mutex.c
index 30e0247..64837a3 100644
--- a/vm/external_libs/winpthreads/src/mutex.c
+++ b/vm/external_libs/winpthreads/src/mutex.c
@@ -1,5 +1,7 @@
#include <windows.h>
+#ifdef _WIN64
#include <winternl.h>
+#endif
#include <stdio.h>
#include "pthread.h"
#include "spinlock.h"
diff --git a/vm/external_libs/winpthreads/src/ref.c b/vm/external_libs/winpthreads/src/ref.c
index 34c3f4b..7337b21 100644
--- a/vm/external_libs/winpthreads/src/ref.c
+++ b/vm/external_libs/winpthreads/src/ref.c
@@ -1,5 +1,7 @@
#include <windows.h>
+#ifdef _WIN64
#include <winternl.h>
+#endif
#include <stdio.h>
#include "pthread.h"
#include "semaphore.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment