Skip to content

Instantly share code, notes, and snippets.

@wanabe
Created March 17, 2011 14:02
Show Gist options
  • Save wanabe/874357 to your computer and use it in GitHub Desktop.
Save wanabe/874357 to your computer and use it in GitHub Desktop.
for mingw-w64. do "git clone git://github.com/atgreen/libffi" before applying the patch.
commit c3c8da7c49fc660a767f6702a01aba68a211b66c
Author: wanabe <[email protected]>
Date: Thu Mar 17 00:57:09 2011 +0900
treat drive-letter as directory
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 941865b..ff09a58 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -277,6 +277,7 @@ class File < IO
#
# File.directory?(".")
def self.directory?(path)
+ return true if Rubinius.windows? and path =~ /^[a-zA-Z]:$/
st = Stat.stat path
st ? st.directory? : false
end
commit 83edb8cf8d869e95136b4d69b6f626bfd6520c1a
Author: wanabe <[email protected]>
Date: Thu Mar 17 00:56:41 2011 +0900
some function is defined with prefix '_' on mingw.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index 1f50a4a..b7ca87f 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -23,7 +23,7 @@ module FFI::Platform::POSIX
end
# errors
- attach_function :errno, 'ffi_errno', [], :int
+ attach_function2 :errno, 'ffi_errno', [], :int
attach_function :errno=, 'ffi_set_errno', [:int], :void
attach_function :strerror, [:int], :string
attach_function :perror, [:string], :void
@@ -63,7 +63,7 @@ module FFI::Platform::POSIX
attach_function :readdir, [:pointer], :pointer
attach_function :rewinddir, [:pointer], :void
attach_function :closedir, [:pointer], :int
- attach_function :mkdir, [:string, :short], :int
+ attach_function2 :mkdir, [:string, :short], :int
attach_function :rmdir, [:string], :int
attach_function :chroot, [:string], :int
commit f19cffc721dda1afc223f189457985f075b21ca0
Author: wanabe <[email protected]>
Date: Thu Mar 17 00:06:34 2011 +0900
hogehoge
diff --git a/projects/daedalus/daedalus.rb b/projects/daedalus/daedalus.rb
index a6d83be..42f6ce2 100644
--- a/projects/daedalus/daedalus.rb
+++ b/projects/daedalus/daedalus.rb
@@ -203,7 +203,9 @@ module Daedalus
def compile(source, object)
@log.show "CC" , source
- @log.command "#{@path} #{@cflags.join(' ')} -c -o #{object} #{source}"
+ unless File.exist?(object) && File.mtime(object) > File.mtime(source)
+ @log.command "#{@path} #{@cflags.join(' ')} -c -o #{object} #{source}"
+ end
end
def link(path, files)
diff --git a/rakelib/extensions.rake b/rakelib/extensions.rake
index bd3f560..b30d25f 100644
--- a/rakelib/extensions.rake
+++ b/rakelib/extensions.rake
@@ -83,20 +83,21 @@ def compile_ext(name, opts={})
Rake::Task[:extensions].prerequisites << "extensions:#{task_name}"
end
+compile_ext "melbourne", :task => "rbx", :doc => "for Rubinius"
+if BUILD_CONFIG[:which_ruby] == :ruby
+ compile_ext "melbourne", :task => "mri", :doc => "for MRI"
+end
compile_ext "bigdecimal"
compile_ext "readline" if BUILD_CONFIG[:defines].include? "HAS_READLINE"
+compile_ext "syck"
+compile_ext "nkf"
+
compile_ext "digest"
compile_ext "digest:md5"
compile_ext "digest:rmd160"
compile_ext "digest:sha1"
compile_ext "digest:sha2"
compile_ext "digest:bubblebabble"
-compile_ext "syck"
-compile_ext "melbourne", :task => "rbx", :doc => "for Rubinius"
-if BUILD_CONFIG[:which_ruby] == :ruby
- compile_ext "melbourne", :task => "mri", :doc => "for MRI"
-end
-compile_ext "nkf"
# rbx must be able to run to build these because they use
# extconf.rb, so they must be after melbourne for Rubinius.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index 3ddb43e..e240786 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -114,7 +114,7 @@ namespace :build do
unless File.exist?("Makefile.config") && File.mtime("Makefile.config") > File.mtime("configure")
sh %[sh -c "#{expand("./configure")} #{llvm_config_flags}"]
end
- sh make
+ sh make unless ENV["SKIP_LLVM"]
end
end
end
commit 3fe699592142c2fad12c98fd71565ef5c427d226
Author: wanabe <[email protected]>
Date: Wed Mar 16 23:49:59 2011 +0900
ext_helper can build MRI extension.
diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb
index 6c31220..51ad25d 100644
--- a/rakelib/ext_helper.rb
+++ b/rakelib/ext_helper.rb
@@ -114,6 +114,11 @@ def add_rbx_capi
add_cflag "-ggdb3 -O2"
add_cxxflag "-ggdb3 -O2"
add_include_dir File.expand_path("../../vm/capi/include", __FILE__)
+ if RUBY_PLATFORM =~ /mingw/
+ $LDSHARED = "#{$CXX} -shared -lstdc++"
+ add_link_dir File.expand_path("../../vm", __FILE__)
+ add_shared_lib "rubinius-#{Rubinius::BUILD_CONFIG[:version]}"
+ end
end
# Setup some initial computed values
@@ -133,8 +138,6 @@ when /mswin32/, /mingw32/, /bccwin32/
if RUBY_PLATFORM =~ /mingw/
$LDSHARED = "#{$CXX} -shared -lstdc++"
- add_link_dir File.expand_path("../../vm", __FILE__)
- add_shared_lib "rubinius-#{Rubinius::BUILD_CONFIG[:version]}"
else
add_define "-EHs", "-GR"
end
commit 53dd740623cd0f15d39086edf260b89fa658a4c9
Author: wanabe <[email protected]>
Date: Wed Mar 16 23:11:44 2011 +0900
libffi make "#{host_triple}" directory.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index 3f4622a..de1ffc2 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -148,8 +148,9 @@ Daedalus.blueprint do |i|
end
ffi = i.external_lib "vm/external_libs/libffi" do |l|
- l.cflags = ["-Ivm/external_libs/libffi/include"]
- l.objects = [l.file(".libs/libffi.a")]
+ l.cflags = ["-Ivm/external_libs/libffi/include",
+ "-Ivm/external_libs/libffi/#{Rubinius::BUILD_CONFIG[:host]}/include"]
+ l.objects = [l.file("#{Rubinius::BUILD_CONFIG[:host]}/.libs/libffi.a")]
l.to_build do |x|
x.command "./configure #{config_flags}" unless File.exists?("Makefile")
x.command "make"
commit 314023a47797a5c0128f8b01eb9d6cc54751d87e
Author: wanabe <[email protected]>
Date: Wed Mar 16 22:23:56 2011 +0900
__X_rubinius_version is not exported on Windows.
diff --git a/kernel/common/native_method.rb b/kernel/common/native_method.rb
index 9e3ab1c..3b9c4b9 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.windows?
raise LoadError::InvalidExtensionError, "Out-of-date or not compatible. Recompile or reinstall gem (#{library})"
end
commit 67cc1d7239a784ee3e5fb706529d8a9e400e2e73
Author: wanabe <[email protected]>
Date: Wed Mar 16 22:23:30 2011 +0900
extension library name is "*.so" on windows.
diff --git a/vm/builtin/ffi_pointer.cpp b/vm/builtin/ffi_pointer.cpp
index a2a115c..4a3ec85 100644
--- a/vm/builtin/ffi_pointer.cpp
+++ b/vm/builtin/ffi_pointer.cpp
@@ -55,7 +55,7 @@ namespace rubinius {
// FFI file atm.
Array* suffix = Array::create(state, 2);
#ifdef _WIN32
- suffix->set(state, 0, String::create(state, "dll"));
+ suffix->set(state, 0, String::create(state, "so"));
#else
#ifdef __APPLE_CC__
suffix->set(state, 0, String::create(state, "bundle"));
@@ -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 1603dca7d5b422314742ec9a6cd4c43941e4c9ac
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:24:58 2011 +0900
qualified_path? accepts drive-letter of Windows.
diff --git a/kernel/common/codeloader.rb b/kernel/common/codeloader.rb
index f7df33b..7b8ec27 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.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
commit 1ebd589c93a70e5ecf6ffbc42e1a176046087fea
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:22:43 2011 +0900
TODO: quick hack to avoid POSIX.geteuid on Windows.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 28506a9..941865b 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -1263,6 +1263,7 @@ class File::Stat
end
def owned?
+ return true if Rubinius.windows? # TODO
@stat[:st_uid] == POSIX.geteuid
end
@@ -1368,11 +1369,13 @@ class File::Stat
private :rowned?
def rsuperuser?
+ return false if Rubinius.windows? # TODO
POSIX.getuid == 0
end
private :rsuperuser?
def superuser?
+ return false if Rubinius.windows? # TODO
POSIX.geteuid == 0
end
private :superuser?
commit 6cc1f5de0bfa473ee985eb2a52ee495123da0178
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:20:11 2011 +0900
File.expand_path for windows.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 570d59b..28506a9 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -371,6 +371,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.windows? ? /[\/\\]/ : /\//
path = StringValue(path)
first = path[0]
@@ -389,7 +390,7 @@ class File < IO
return home
else
- unless length = path.index("/", 1)
+ unless length = path.index(separator, 1)
length = path.size
end
@@ -400,7 +401,7 @@ class File < IO
path = dir + path.substring(length, path.size - length)
end
- elsif first != ?/
+ elsif Rubinius.windows? ? path !~ /^[a-z]:/i : first != ?/
if dir
dir = File.expand_path dir
else
@@ -414,7 +415,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
@@ -432,7 +433,7 @@ class File < IO
return "/" if items.empty?
- str = ""
+ str = Rubinius.windows? ? items.shift.to_s : ""
items.each { |x| str.append "/#{x}" }
return str
commit 74fa3d7807e741dc031a56e10e539cfc3fc9cb3c
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:10:42 2011 +0900
can't add_feature when @feature is empty.
diff --git a/kernel/delta/codeloader.rb b/kernel/delta/codeloader.rb
index c072589..3578ce7 100644
--- a/kernel/delta/codeloader.rb
+++ b/kernel/delta/codeloader.rb
@@ -42,7 +42,7 @@ module Rubinius
return true
ensure
- add_feature
+ add_feature if @feature
finished
CodeLoader.check_version = saved_check
commit 10ccc88d36c0a809dbd5478fe088b72712fd2661
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:08:29 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 6735da9..570d59b 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.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 ae5f553..9b76873 100644
--- a/kernel/common/io.rb
+++ b/kernel/common/io.rb
@@ -639,9 +639,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.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)
@@ -651,7 +655,7 @@ class IO
mode &= ACCMODE
- if (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
+ if !Rubinius.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 170215734c55904a579effe41785cd5c331e0a7f
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:05:04 2011 +0900
destination may be empty. (is this bug?)
diff --git a/kernel/loader.rb b/kernel/loader.rb
index 5ba1cdf..999325a 100644
--- a/kernel/loader.rb
+++ b/kernel/loader.rb
@@ -656,11 +656,13 @@ VM Options
STDERR.puts "intended operation: #{reason.inspect}"
STDERR.puts "associated value: #{thread_state[1].inspect}"
destination = thread_state[2]
- method = destination.method
- STDERR.puts "destination scope:"
- STDERR.puts " method: #{method.name} at #{method.file}:#{method.first_line}"
- STDERR.puts " module: #{destination.module.name}"
- STDERR.puts " block: #{destination.block}" if destination.block
+ if destination
+ method = destination.method
+ STDERR.puts "destination scope:"
+ STDERR.puts " method: #{method.name} at #{method.file}:#{method.first_line}"
+ STDERR.puts " module: #{destination.module.name}"
+ STDERR.puts " block: #{destination.block}" if destination.block
+ end
if reason == :catch_throw
STDERR.puts "throw destination: #{thread_state[4].inspect}"
end
commit d20a383d052fb5cb8498cd2ba3e8c2d119d819c9
Author: wanabe <[email protected]>
Date: Wed Mar 16 06:03:26 2011 +0900
Rubinius::Loader.main should print backtrace.
diff --git a/kernel/loader.rb b/kernel/loader.rb
index 1b9eab9..5ba1cdf 100644
--- a/kernel/loader.rb
+++ b/kernel/loader.rb
@@ -753,6 +753,8 @@ VM Options
STDERR.puts "Exception occurred during top-level exception output! (THIS IS BAD)"
STDERR.puts
STDERR.puts "Exception: #{exc.inspect} (#{exc.class})"
+ STDERR.puts "\nBacktrace:"
+ STDERR.puts exc.backtrace
end
end
end
commit ee06edc8ce12fa3c991c60c7afec545d8acc71fc
Author: wanabe <[email protected]>
Date: Wed Mar 16 05:47:29 2011 +0900
some function is defined with prefix '_' on mingw.
diff --git a/kernel/platform/posix.rb b/kernel/platform/posix.rb
index f1a7b16..1f50a4a 100644
--- a/kernel/platform/posix.rb
+++ b/kernel/platform/posix.rb
@@ -4,6 +4,24 @@
module FFI::Platform::POSIX
extend FFI::Library
+ class << self
+ if Rubinius.windows?
+ 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
+ else
+ alias_method :attach_function2, :attach_function
+ end
+ end
+
# errors
attach_function :errno, 'ffi_errno', [], :int
attach_function :errno=, 'ffi_set_errno', [:int], :void
@@ -31,7 +49,7 @@ module FFI::Platform::POSIX
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_function2 :getcwd, [:string, :size_t], :string
attach_function :umask, [:mode_t], :int
attach_function :link, [:string, :string], :int
attach_function :symlink, [:string, :string], :int
@@ -74,7 +92,7 @@ module FFI::Platform::POSIX
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 :isatty, [:int], :int
# reading
attach_function :fread, [:string, :size_t, :size_t, :pointer], :size_t
@@ -157,7 +175,7 @@ module FFI::Platform::POSIX
# 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_function2 :stat, 'ffi_stat', [:string, :pointer], :int
attach_function :fstat, 'ffi_fstat', [:int, :pointer], :int
attach_function :lstat, 'ffi_lstat', [:string, :pointer], :int
end
commit 2c432150b12f713f2f676cb465773cfacab778e8
Author: wanabe <[email protected]>
Date: Wed Mar 16 05:44:24 2011 +0900
mingw doesn't have rlimit.
diff --git a/kernel/common/process.rb b/kernel/common/process.rb
index 31878a4..c920cbc 100644
--- a/kernel/common/process.rb
+++ b/kernel/common/process.rb
@@ -30,7 +30,7 @@ module Process
class Rlimit < FFI::Struct
config "rbx.platform.rlimit", :rlim_cur, :rlim_max
- end
+ end unless Rubinius.windows?
def self.setrlimit(resource, cur_limit, max_limit=undefined)
rlimit = Rlimit.new
commit eefca75b333e40c4f336070d2d74cd7e8fba718c
Author: wanabe <[email protected]>
Date: Wed Mar 16 05:42:11 2011 +0900
Windows can't dlopen(CURRENT_PROCESS).
Load LIBC alternatively.
diff --git a/kernel/platform/library.rb b/kernel/platform/library.rb
index 3b0ad97..0114497 100644
--- a/kernel/platform/library.rb
+++ b/kernel/platform/library.rb
@@ -277,6 +277,6 @@ module FFI
DynamicLibrary.last_error
end
- CURRENT_PROCESS = DynamicLibrary.new(nil)
+ CURRENT_PROCESS = DynamicLibrary.new(Rubinius.windows? ? Library::LIBC : nil)
end
end
commit 53e2366fe9312a4dcbc0d6a6422074c465f59b8f
Author: wanabe <[email protected]>
Date: Wed Mar 16 05:38:15 2011 +0900
mingw's stat doesn't have st_blksize and st_blocks.
diff --git a/kernel/common/file.rb b/kernel/common/file.rb
index 2db8b7c..6735da9 100644
--- a/kernel/common/file.rb
+++ b/kernel/common/file.rb
@@ -1029,9 +1029,15 @@ end
class File::Stat
class Struct < FFI::Struct
- 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
+ if Rubinius.windows?
+ config "rbx.platform.stat", :st_dev, :st_ino, :st_mode, :st_nlink,
+ :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
commit 33a2f3e0248fc04e5ad1d4c8299143b7204a8aeb
Author: wanabe <[email protected]>
Date: Wed Mar 16 05:31:20 2011 +0900
mingw doesn't have time_t and suseconds_t.
diff --git a/rakelib/platform.rake b/rakelib/platform.rake
index d580a25..c053671 100644
--- a/rakelib/platform.rake
+++ b/rakelib/platform.rake
@@ -36,8 +36,8 @@ file 'runtime/platform.conf' => deps do |task|
FFI::Generators::Structures.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.write_config(f)
FFI::Generators::Structures.new 'sockaddr_in' do |s|
commit 766984f342aec06bb1697237a0066930122e0bb1
Author: wanabe <[email protected]>
Date: Tue Mar 15 06:25:14 2011 +0900
windows doesn't have libcrypto.
diff --git a/lib/ext/digest/Rakefile b/lib/ext/digest/Rakefile
index 39e85ca..0f5676d 100644
--- a/lib/ext/digest/Rakefile
+++ b/lib/ext/digest/Rakefile
@@ -5,7 +5,7 @@ project_files = common_headers + headers + sources + objects
add_rbx_capi
-add_shared_lib "crypto"
+add_shared_lib "crypto" unless Rubinius::BUILD_CONFIG[:windows]
digest = "digest.#{$DLEXT}"
commit 06ee5861736bbd0a231b166662d8ab46ef28ed92
Author: wanabe <[email protected]>
Date: Tue Mar 15 06:01:57 2011 +0900
exts need import library.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index 204c2af..3f4622a 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -59,6 +59,8 @@ Daedalus.blueprint do |i|
when /bsd/i
gcc.ldflags << "-ldl" << "-lcrypt" << "-rdynamic"
when /mingw|win32/i
+ gcc.ldflags << "-Wl,--export-all-symbols"
+ gcc.ldflags << "-Wl,--out-implib,vm/librubinius-#{Rubinius::BUILD_CONFIG[:version]}.a"
gcc.ldflags << "-lws2_32"
else
gcc.ldflags << "-ldl"
diff --git a/rakelib/ext_helper.rb b/rakelib/ext_helper.rb
index f857b56..6c31220 100644
--- a/rakelib/ext_helper.rb
+++ b/rakelib/ext_helper.rb
@@ -133,6 +133,8 @@ when /mswin32/, /mingw32/, /bccwin32/
if RUBY_PLATFORM =~ /mingw/
$LDSHARED = "#{$CXX} -shared -lstdc++"
+ add_link_dir File.expand_path("../../vm", __FILE__)
+ add_shared_lib "rubinius-#{Rubinius::BUILD_CONFIG[:version]}"
else
add_define "-EHs", "-GR"
end
commit 465fb9cb50d7da68c5c220891d916b85c5d6abea
Author: wanabe <[email protected]>
Date: Tue Mar 15 05:49:11 2011 +0900
sizeof(VALUE) > sizeof(long) in LLP64.
diff --git a/lib/ext/melbourne/node.hpp b/lib/ext/melbourne/node.hpp
index f5b8355..28919cf 100644
--- a/lib/ext/melbourne/node.hpp
+++ b/lib/ext/melbourne/node.hpp
@@ -59,7 +59,7 @@ namespace melbourne {
RNODE(n)->flags=((RNODE(n)->flags&~FL_UMASK)|(((t)<<FL_USHIFT)&FL_UMASK))
#define NODE_LSHIFT (FL_USHIFT+8)
-#define NODE_LMASK (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
+#define NODE_LMASK (((VALUE)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
#define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
#define nd_set_line(n,l) \
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
commit 4ebdb1808476ce95522329095f0d56553133b7cc
Author: wanabe <[email protected]>
Date: Tue Mar 15 05:48:06 2011 +0900
retry File.delete(exefile) when fail.
diff --git a/lib/ffi/generators.rb b/lib/ffi/generators.rb
index 07a34b2..7cee721 100644
--- a/lib/ffi/generators.rb
+++ b/lib/ffi/generators.rb
@@ -90,7 +90,18 @@ module FFI
def remove(*names)
names.each do |name|
- File.delete name if File.exists? name
+ if File.exists? name
+ max_count = 10
+ max_count.times do |i|
+ begin
+ File.delete name
+ rescue SystemCallError
+ raise if max_count - 1 == i
+ retry
+ end
+ break
+ end
+ end
end
end
end
commit e94bd1a09b32be952143fdcb7589f14bd9c55c75
Author: wanabe <[email protected]>
Date: Tue Mar 15 05:46:43 2011 +0900
trunk of llvm doesn't have Release/bin, but Release+Asserts/bin.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index 4f9def4..204c2af 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -82,7 +82,7 @@ Daedalus.blueprint do |i|
case Rubinius::BUILD_CONFIG[:llvm]
when :prebuilt, :svn
llvm = i.external_lib "vm/external_libs/llvm" do |l|
- conf = "vm/external_libs/llvm/Release/bin/llvm-config"
+ conf = llvm_configure
flags = `#{perl} #{conf} --cflags`.strip.split(/\s+/)
flags.delete_if { |x| x.index("-O") == 0 || x.index("-I") == 0 }
flags << "-Ivm/external_libs/llvm/include" << "-DENABLE_LLVM"
commit ba3e3399fff67560991580ceec4d280b78f1f7d0
Author: wanabe <[email protected]>
Date: Mon Mar 14 22:42:31 2011 +0900
trunk of llvm can't INITIALIZE_AG_PASS
diff --git a/vm/llvm/passes.cpp b/vm/llvm/passes.cpp
index 0e8b6c9..c8dd2f1 100644
--- a/vm/llvm/passes.cpp
+++ b/vm/llvm/passes.cpp
@@ -410,8 +410,10 @@ namespace {
};
char RubiniusAliasAnalysis::ID = 0;
+#if !defined(LLVM_VERSION) || LLVM_VERSION <= 28
INITIALIZE_AG_PASS(RubiniusAliasAnalysis, AliasAnalysis, "rbx-aa",
"Rubinius-specific Alias Analysis", false, true, false);
+#endif
/*
class TypeGuardRemoval : public FunctionPass {
commit 8d0cc96aa73f6c42461899e7d3ed7660e55fbc0f
Author: wanabe <[email protected]>
Date: Mon Mar 14 22:39:24 2011 +0900
trunk of llvm doesn't have llvm/System/Threading.h but
llvm/Support/Threading.h.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index 41b495c..4f9def4 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -15,6 +15,7 @@ Daedalus.blueprint do |i|
gcc.cflags << "-pipe -Wall -fno-omit-frame-pointer"
gcc.cflags << "-ggdb3 -Werror"
gcc.cflags << "-DRBX_PROFILER -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
+ gcc.cflags << "-DLLVM_VERSION=#{(llvm_version.to_f*10).round}"
if ENV['DEV']
gcc.cflags << "-O0"
diff --git a/vm/environment.cpp b/vm/environment.cpp
index 730bb5c..18d74bc 100644
--- a/vm/environment.cpp
+++ b/vm/environment.cpp
@@ -18,7 +18,11 @@
#ifdef ENABLE_LLVM
#include "llvm/jit.hpp"
+#if defined(LLVM_VERSION) && LLVM_VERSION > 28
+#include <llvm/Support/Threading.h>
+#else
#include <llvm/System/Threading.h>
+#endif
#include <llvm/Target/TargetOptions.h>
#endif
commit 1e978a2b7322a669ea4190222e37f5e07eb57283
Author: wanabe <[email protected]>
Date: Mon Mar 14 22:38:28 2011 +0900
trunk of llvm doesn't have Release/bin, but Release+Asserts/bin.
diff --git a/rakelib/build.rb b/rakelib/build.rb
index 56aa069..e8ba8d6 100644
--- a/rakelib/build.rb
+++ b/rakelib/build.rb
@@ -1,7 +1,7 @@
def llvm_configure
case Rubinius::BUILD_CONFIG[:llvm]
when :svn, :prebuilt
- "vm/external_libs/llvm/Release/bin/llvm-config"
+ Dir.glob("vm/external_libs/llvm/Release*/bin/llvm-config")[0]
when :config
Rubinius::BUILD_CONFIG[:llvm_configure]
else
commit bccaaebc190433281bc5afd0cb45596bbdcc9049
Author: wanabe <[email protected]>
Date: Mon Mar 14 21:44:11 2011 +0900
type of hash-value is hashval.
diff --git a/vm/builtin/string.cpp b/vm/builtin/string.cpp
index dac0092..4933025 100644
--- a/vm/builtin/string.cpp
+++ b/vm/builtin/string.cpp
@@ -163,7 +163,7 @@ namespace rubinius {
return (hv ^ byte) * FNVHashPrime;
}
- static inline unsigned long finish_hash(unsigned long hv) {
+ static inline hashval finish_hash(hashval hv) {
return (hv>>FIXNUM_WIDTH) ^ (hv & FIXNUM_MAX);
}
commit af0d28b0c896f104aeaa9ae0d0c0c3eab404cb36
Author: wanabe <[email protected]>
Date: Mon Mar 14 21:41:16 2011 +0900
LLP64 is not LP64.
diff --git a/vm/builtin/object.cpp b/vm/builtin/object.cpp
index 0fbe5d3..f9e889d 100644
--- a/vm/builtin/object.cpp
+++ b/vm/builtin/object.cpp
@@ -332,7 +332,7 @@ namespace rubinius {
if(!reference_p()) {
return reinterpret_cast<uintptr_t>(this) & FIXNUM_MAX;
-#ifdef _LP64
+#ifdef IS_X8664
uintptr_t key = reinterpret_cast<uintptr_t>(this);
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
commit 9c784f483b357d57f4bba90900099a2879746fdd
Author: wanabe <[email protected]>
Date: Mon Mar 14 21:40:40 2011 +0900
sizeof(void*) == sizeof(long long int) > sizeof(long int) on LLP64.
diff --git a/vm/util/optimize.hpp b/vm/util/optimize.hpp
index de9c743..aaf9f3b 100644
--- a/vm/util/optimize.hpp
+++ b/vm/util/optimize.hpp
@@ -4,8 +4,13 @@
// keeps the normal case fast.
#ifdef __GNUC__
+#ifdef _WIN64
+#define likely(x) __builtin_expect((long long int)(x),1)
+#define unlikely(x) __builtin_expect((long long int)(x),0)
+#else
#define likely(x) __builtin_expect((long int)(x),1)
#define unlikely(x) __builtin_expect((long int)(x),0)
+#endif
#else
commit 8b51e2d3695fe273659db133cfd0909be60b53c4
Author: wanabe <[email protected]>
Date: Mon Mar 14 06:18:13 2011 +0900
define __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS for llvm.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index f27ac86..41b495c 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -14,7 +14,7 @@ Daedalus.blueprint do |i|
gcc.cflags << "-Ivm -Ivm/test/cxxtest -I. -I/usr/local/include -I/opt/local/include "
gcc.cflags << "-pipe -Wall -fno-omit-frame-pointer"
gcc.cflags << "-ggdb3 -Werror"
- gcc.cflags << "-DRBX_PROFILER"
+ gcc.cflags << "-DRBX_PROFILER -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
if ENV['DEV']
gcc.cflags << "-O0"
commit 455b06273d32ba3d905b4e631b55c2189c2b1283
Author: wanabe <[email protected]>
Date: Mon Mar 14 06:10:47 2011 +0900
_WIN64 is __x86_64__ but not _LP64.
diff --git a/vm/external_libs/libtommath/tommath.h b/vm/external_libs/libtommath/tommath.h
index 70ba506..dc7624d 100644
--- a/vm/external_libs/libtommath/tommath.h
+++ b/vm/external_libs/libtommath/tommath.h
@@ -49,7 +49,7 @@ extern "C" {
/* detect 64-bit mode if possible */
-#if defined(__x86_64__)
+#if defined(__x86_64__) && !defined(_WIN64)
#if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
#define MP_64BIT
#endif
commit 52c427f00c3e5cc3ed507dc38104b6b1692ad591
Author: wanabe <[email protected]>
Date: Mon Mar 14 05:41:37 2011 +0900
host-triple passes to configure of external_libs.
diff --git a/rakelib/blueprint.rb b/rakelib/blueprint.rb
index dd0b177..f27ac86 100644
--- a/rakelib/blueprint.rb
+++ b/rakelib/blueprint.rb
@@ -1,3 +1,13 @@
+class << Daedalus
+ def host_triple
+ Rubinius::BUILD_CONFIG[:host]
+ end
+
+ def config_flags
+ "--build=#{host_triple} --host=#{host_triple} "
+ end
+end
+
Daedalus.blueprint do |i|
gcc = i.gcc!
@@ -121,7 +131,7 @@ Daedalus.blueprint do |i|
l.cflags = ["-Ivm/external_libs/onig"]
l.objects = [l.file(".libs/libonig.a")]
l.to_build do |x|
- x.command "./configure" unless File.exists?("Makefile")
+ x.command "./configure #{config_flags}" unless File.exists?("Makefile")
x.command "make"
end
end
@@ -138,7 +148,7 @@ Daedalus.blueprint do |i|
l.cflags = ["-Ivm/external_libs/libffi/include"]
l.objects = [l.file(".libs/libffi.a")]
l.to_build do |x|
- x.command "./configure" unless File.exists?("Makefile")
+ x.command "./configure #{config_flags}" unless File.exists?("Makefile")
x.command "make"
end
end
@@ -147,7 +157,7 @@ Daedalus.blueprint do |i|
l.cflags = ["-Ivm/external_libs/udis86"]
l.objects = [l.file("libudis86/.libs/libudis86.a")]
l.to_build do |x|
- x.command "./configure" unless File.exists?("Makefile")
+ x.command "./configure #{config_flags}" unless File.exists?("Makefile")
x.command "make"
end
end
@@ -164,7 +174,7 @@ Daedalus.blueprint do |i|
l.cflags = ["-Ivm/external_libs/winpthreads/include"]
l.objects = [l.file("libpthread.a")]
l.to_build do |x|
- x.command "./configure" unless File.exists?("Makefile")
+ x.command "./configure #{config_flags}" unless File.exists?("Makefile")
x.command "make"
end
end
commit 0003f003b8cd4d8e9dd1a782277aea9a3ab87ebf
Author: wanabe <[email protected]>
Date: Mon Mar 14 05:39:42 2011 +0900
logger.command("./configure") doesn't work without shell.
diff --git a/projects/daedalus/daedalus.rb b/projects/daedalus/daedalus.rb
index 12e1a19..a6d83be 100644
--- a/projects/daedalus/daedalus.rb
+++ b/projects/daedalus/daedalus.rb
@@ -63,7 +63,7 @@ module Daedalus
end
def command(cmd)
- system cmd
+ system "sh -c '#{cmd}'"
if $?.exitstatus != 0
STDOUT.puts "Error: #{cmd}"
raise "Error compiling"
commit f7e36452a2dddc44a1d80053e58fbdbdcf96b159
Author: wanabe <[email protected]>
Date: Mon Mar 14 05:36:36 2011 +0900
Daedalus.load set filename for backtrace.
diff --git a/projects/daedalus/daedalus.rb b/projects/daedalus/daedalus.rb
index 2154b7f..12e1a19 100644
--- a/projects/daedalus/daedalus.rb
+++ b/projects/daedalus/daedalus.rb
@@ -752,6 +752,6 @@ module Daedalus
end
def self.load(file)
- eval File.read(file)
+ eval File.read(file), binding, file
end
end
commit 52354a09617d29aaccc37bb3c4bfd3f8d47446f6
Author: wanabe <[email protected]>
Date: Sun Mar 13 22:13:58 2011 +0900
don't configure if Makefile.config is hot enough.
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index c5474cb..3ddb43e 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -111,7 +111,9 @@ namespace :build do
unless File.file?("vm/external_libs/llvm/Release/bin/llvm-config")
ENV["REQUIRES_RTTI"] = "1"
Dir.chdir "vm/external_libs/llvm" do
- sh %[sh -c "#{expand("./configure")} #{llvm_config_flags}"]
+ unless File.exist?("Makefile.config") && File.mtime("Makefile.config") > File.mtime("configure")
+ sh %[sh -c "#{expand("./configure")} #{llvm_config_flags}"]
+ end
sh make
end
end
commit d32f947ccfa4faf6f32b2974ac19cbf51e06e61d
Author: wanabe <[email protected]>
Date: Sun Mar 13 21:56:30 2011 +0900
retry File.delete(exefile) when fail.
diff --git a/configure b/configure
index 7e806d8..4d040a2 100755
--- a/configure
+++ b/configure
@@ -678,7 +678,17 @@ class Configure
system expand("./#{basename}")
return $?.exitstatus
ensure
- File.delete(*Dir["#{basename}*"])
+ max_count = 10
+ max_count.times do |i|
+ begin
+ File.delete(*Dir["#{basename}*"])
+ rescue SystemCallError
+ raise if max_count - 1 == i
+ sleep 0.1
+ retry
+ end
+ break
+ end
end
end
commit 07e9da01aff4f463c60069760db24bf76332ffe8
Author: wanabe <[email protected]>
Date: Sun Mar 13 21:51:45 2011 +0900
configure allows '--host=HOST' option.
diff --git a/configure b/configure
index 1cc8fb2..7e806d8 100755
--- a/configure
+++ b/configure
@@ -21,7 +21,8 @@ class Configure
@defines = []
@config = File.join(root, "config.rb")
- @host = `sh -c ./rakelib/config.guess`.chomp
+ ARGV.reject! { |x| x =~ /^--host=(.*)/ && @host = $1 }
+ @host ||= `sh -c ./rakelib/config.guess`.chomp
/([^-]+)-([^-]+)-(.*)/ =~ @host
@cpu, @vendor, @os = $1, $2, $3
@little_endian = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment