From 6ff3215ce9be263b14f292d55362af96e8f4482a Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Sun, 12 Sep 2010 17:40:49 -0300 Subject: [PATCH 2/2] Fix #2531 by backporting changes to fake.rb required for successful cross-compilation --- Makefile.in | 19 +++---------------- template/fake.rb.in | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 template/fake.rb.in diff --git a/Makefile.in b/Makefile.in index 656ae90..6e3af4b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -122,22 +122,9 @@ $(LIBRUBY_SO): File.symlink "$(LIBRUBY_SO)", link}' \ $(LIBRUBY_ALIASES) || true -fake.rb: Makefile - @echo ' \ - class Object; \ - CROSS_COMPILING = RUBY_PLATFORM; \ - remove_const :RUBY_PLATFORM; \ - remove_const :RUBY_VERSION; \ - RUBY_PLATFORM = "@arch@"; \ - RUBY_VERSION = "@MAJOR@.@MINOR@.@TEENY@"; \ - end; \ - if RUBY_PLATFORM =~ /mswin|bccwin|mingw/; \ - class File; \ - remove_const :ALT_SEPARATOR; \ - ALT_SEPARATOR = "\\\\"; \ - end; \ - end; \ - ' > $@ +fake.rb: config.status $(srcdir)/template/fake.rb.in + @./config.status --file=$@:$(srcdir)/template/fake.rb.in + @chmod +x $@ Makefile: $(srcdir)/Makefile.in diff --git a/template/fake.rb.in b/template/fake.rb.in new file mode 100644 index 0000000..cdc999a --- /dev/null +++ b/template/fake.rb.in @@ -0,0 +1,43 @@ +baseruby="@BASERUBY@" +ruby="${RUBY-$baseruby}" +"eval" "{ `expr \"$ruby\" : echo > /dev/null || echo exec` $ruby "'-r"`expr \"$0\" : / > /dev/null || pwd`/${0#/}" "$@";' "}" || "exit" "$?" +class Object + CROSS_COMPILING = RUBY_PLATFORM + remove_const :RUBY_PLATFORM + remove_const :RUBY_VERSION + remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION) + RUBY_PLATFORM = "@arch@" + RUBY_VERSION = "@RUBY_PROGRAM_VERSION@" + RUBY_DESCRIPTION = "ruby #{RUBY_VERSION} (@RUBY_RELEASE_DATE@) [#{RUBY_PLATFORM}]" +end +if RUBY_PLATFORM =~ /mswin|bccwin|mingw/ + class File + remove_const :ALT_SEPARATOR + ALT_SEPARATOR = "\\" + end +end + +$:.unshift(File.expand_path("..", __FILE__)) +posthook = proc do + config = RbConfig::CONFIG + mkconfig = RbConfig::MAKEFILE_CONFIG + extout = File.expand_path(mkconfig["EXTOUT"], mkconfig["builddir"]) + $arch_hdrdir = "#{extout}/include/$(arch)" + $ruby = baseruby + untrace_var(:$ruby, posthook) +end +prehook = proc do |extmk| + unless extmk + config = RbConfig::CONFIG + mkconfig = RbConfig::MAKEFILE_CONFIG + builddir = File.expand_path(File.dirname(__FILE__)) + mkconfig["top_srcdir"] = $top_srcdir = File.expand_path("@top_srcdir@", builddir) + mkconfig["rubyhdrdir"] = "$(top_srcdir)/include" + mkconfig["builddir"] = config["builddir"] = builddir + config["rubyhdrdir"] = File.join(mkconfig["top_srcdir"], "include") + mkconfig["libdir"] = config["libdir"] = mkconfig["topdir"] + trace_var(:$ruby, posthook) + end + untrace_var(:$extmk, prehook) +end +trace_var(:$extmk, prehook) -- 1.7.2.3