Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Various mkmf.rb and build fixes for C exts under 1.9 mode.

  • Loading branch information...
commit 1e06f40a7e97a53e0298a572990d089867101db3 1 parent 154c633
@brixen brixen authored
Showing with 22 additions and 7 deletions.
  1. +1 −1  bin/rbx-build
  2. +17 −5 lib/19/mkmf.rb
  3. +4 −1 lib/rbconfig.rb
View
2  bin/rbx-build
@@ -5,6 +5,6 @@ BASE_DIR=$(dirname $BIN_DIR)
export RBX_RUNTIME="$BASE_DIR/runtime"
export RBX_LIB="$BASE_DIR/lib"
-export RBX_CAPI_DIR="$BASE_DIR/vm/capi/18/include"
+export RBX_CAPI_DIR=$BASE_DIR
exec $BIN_DIR/../vm/vm "$*"
View
22 lib/19/mkmf.rb
@@ -15,7 +15,7 @@
end
SRC_EXT = %w[c m].concat(CXX_EXT)
$static = nil
-$config_h = '$(arch_hdrdir)/ruby/config.h'
+$config_h = '$(hdrdir)/config.h'
$default_static = $static
unless defined? $configure_args
@@ -154,7 +154,16 @@ def map_dir(dir, map = nil)
end
# ---------------------- Changed for Rubinius --------------------------------
-$topdir = ENV['RBX_CAPI_DIR'] || RbConfig::CONFIG["rubyhdrdir"]
+if dir = ENV['RBX_CAPI_DIR']
+ if Rubinius.ruby18?
+ $topdir = "#{dir}/vm/capi/18/include"
+ else
+ $topdir = "#{dir}/vm/capi/19/include"
+ end
+else
+ $topdir = RbConfig::CONFIG["rubyhdrdir"]
+end
+
$top_srcdir = $topdir
$hdrdir = $topdir
@@ -1581,7 +1590,10 @@ def depend_rules(depend)
depend.each_line do |line|
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h)
- line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))(?=[-\w]+\.h)", '\&ruby/')
+ # MRI 1.9 puts all the header files in <include>/ruby/
+ # Since we build both 1.9 and 1.8 extensions in 1.9 mode, leaving the
+ # header files in 1.9 mode the same for now.
+ # line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))(?=[-\w]+\.h)", '\&ruby/')
if $nmake && /\A\s*\$\(RM|COPY\)/ =~ line
line.gsub!(%r"[-\w\./]{2,}"){$&.tr("/", "\\")}
line.gsub!(/(\$\((?!RM|COPY)[^:)]+)(?=\))/, '\1:/=\\')
@@ -1898,7 +1910,7 @@ def create_makefile(target, srcprefix = nil)
if File.exist?(depend)
mfile.print("###\n", *depend_rules(File.read(depend)))
else
- headers = %w[$(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h]
+ headers = %w[$(hdrdir)/ruby.h $(hdrdir)/defines.h]
if RULE_SUBST
headers.each {|h| h.sub!(/.*/, &RULE_SUBST.method(:%))}
end
@@ -1939,7 +1951,7 @@ def init_mkmf(config = CONFIG)
$LIBPATH = []
$INSTALLFILES = []
$NONINSTALLFILES = [/~\z/, /\A#.*#\z/, /\A\.#/, /\.bak\z/i, /\.orig\z/, /\.rej\z/, /\.l[ao]\z/, /\.o\z/]
- $VPATH = %w[$(srcdir) $(arch_hdrdir)/ruby $(hdrdir)/ruby]
+ $VPATH = %w[$(srcdir) $(hdrdir) $(arch_hdrdir)/ruby $(hdrdir)/ruby]
$objs = nil
$srcs = nil
View
5 lib/rbconfig.rb
@@ -99,6 +99,7 @@ module RbConfig
CONFIG["MAKEDIRS"] = "mkdir -p"
# compile tools
CONFIG["CC"] = Rubinius::BUILD_CONFIG[:cc]
+ CONFIG["CXX"] = Rubinius::BUILD_CONFIG[:cxx]
CONFIG["CPP"] = "#{Rubinius::BUILD_CONFIG[:cc]} -E"
CONFIG["YACC"] = "bison -y"
CONFIG["RANLIB"] = "ranlib"
@@ -142,7 +143,9 @@ module RbConfig
CONFIG["OBJEXT"] = "o"
CONFIG["GNU_LD"] = ""
- CONFIG["CPPOUTFILE"] = ""
+ CONFIG["CPPOUTFILE"] = "-o conftest.i"
+ CONFIG["OUTFLAG"] = "-o "
+ CONFIG["COUTFLAG"] = "-o "
CONFIG["OUTFLAG"] = "-o "
CONFIG["YFLAGS"] = ""
CONFIG["ASFLAGS"] = ""
Please sign in to comment.
Something went wrong with that request. Please try again.