diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-18 09:50:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-18 09:50:14 +0000 |
commit | 311fdfdfeaceb581c51602f5aeeff40c12567a78 (patch) | |
tree | 532e04965de3bfc286188da5da53dae2aeb3bbe2 /ext | |
parent | 29696a17382798c8f03d28000476bc7fcb77018d (diff) | |
download | ruby-311fdfdfeaceb581c51602f5aeeff40c12567a78.tar.gz |
* mkconfig.rb: no longer embed srcdir and compile_dir into
rbconfig.rb.
* ext/extmk.rb, lib/mkmf.rb: obtain top_srcdir and topdir from library
paths.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/extmk.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb index 3e530e7316..427313bd58 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -20,22 +20,29 @@ $extlist = [] $:.replace ["."] require 'rbconfig' -srcdir = Config::CONFIG["srcdir"] +srcdir = File.dirname(File.dirname(__FILE__)) $:.replace [srcdir, srcdir+"/lib", "."] -require 'mkmf' -require 'optparse/shellwords' - $topdir = "." $top_srcdir = srcdir -$hdrdir = $top_srcdir + +require 'mkmf' +require 'optparse/shellwords' def sysquote(x) @quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM) @quote ? x.quote : x end +def relative_from(path, base) + if File.expand_path(path) == File.expand_path(path, base) + path + else + File.join(base, path) + end +end + def extmake(target) print "#{$message} #{target}\n" $stdout.flush @@ -59,9 +66,7 @@ def extmake(target) top_srcdir = $top_srcdir topdir = $topdir prefix = "../" * (target.count("/")+1) - if File.expand_path(top_srcdir) != File.expand_path(top_srcdir, dir) - $hdrdir = $top_srcdir = prefix + top_srcdir - end + $hdrdir = $top_srcdir = relative_from(top_srcdir, prefix) $topdir = prefix + $topdir $target = target $mdir = target @@ -239,7 +244,7 @@ elsif $nmake else $ruby = '$(topdir)/miniruby' + EXEEXT end -$ruby << " -I$(topdir) -I$(hdrdir)/lib" +$ruby << " -I'$(topdir)' -I'$(hdrdir)/lib'" $config_h = '$(topdir)/config.h' MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)} @@ -289,7 +294,7 @@ exts |= Dir.glob("#{ext_prefix}/*/**/MANIFEST").collect {|d| } unless $extension if $extout - Config.expand(extout = $extout+"/.") + Config.expand(extout = $extout+"/.", Config::CONFIG.merge("topdir"=>$topdir)) if $install Config.expand(dest = "#{$destdir}#{$rubylibdir}") FileUtils.cp_r(extout, dest, :verbose => true, :noop => $dryrun) @@ -304,10 +309,7 @@ dir = Dir.pwd FileUtils::makedirs('ext') Dir::chdir('ext') -if File.expand_path(srcdir) != File.expand_path(srcdir, dir) - $hdrdir = $top_srcdir = "../" + srcdir -end -$topdir = ".." +$hdrdir = $top_srcdir = relative_from(srcdir, $topdir = "..") exts.each do |d| extmake(d) or abort end |