mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
29696a1738
commit
311fdfdfea
4 changed files with 33 additions and 30 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Mar 18 18:50:06 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Thu Mar 18 17:46:35 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* lib/drb/drb.rb: do not undef :to_a.
|
||||
|
|
30
ext/extmk.rb
30
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", "."]
|
||||
|
||||
$topdir = "."
|
||||
$top_srcdir = srcdir
|
||||
|
||||
require 'mkmf'
|
||||
require 'optparse/shellwords'
|
||||
|
||||
$topdir = "."
|
||||
$top_srcdir = srcdir
|
||||
$hdrdir = $top_srcdir
|
||||
|
||||
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
|
||||
|
|
16
lib/mkmf.rb
16
lib/mkmf.rb
|
@ -38,7 +38,6 @@ unless defined? $configure_args
|
|||
end
|
||||
end
|
||||
|
||||
$srcdir = CONFIG["srcdir"]
|
||||
$libdir = CONFIG["libdir"]
|
||||
$rubylibdir = CONFIG["rubylibdir"]
|
||||
$archdir = CONFIG["archdir"]
|
||||
|
@ -77,12 +76,13 @@ def map_dir(dir, map = nil)
|
|||
map.inject(dir) {|dir, (orig, new)| dir.gsub(orig, new)}
|
||||
end
|
||||
|
||||
if not $extmk and File.exist?(Config::CONFIG["archdir"] + "/ruby.h")
|
||||
libdir = File.dirname(__FILE__)
|
||||
if libdir == Config::CONFIG["rubylibdir"] and
|
||||
File.exist?(Config::CONFIG["archdir"] + "/ruby.h")
|
||||
$topdir = $hdrdir = $archdir
|
||||
elsif File.exist?($srcdir + "/ruby.h") and
|
||||
File.exist?((compile_dir = Config::CONFIG['compile_dir']) + "/config.h")
|
||||
$hdrdir = $srcdir
|
||||
$topdir = compile_dir
|
||||
elsif File.exist?(($top_srcdir ||= File.dirname(libdir)) + "/ruby.h") and
|
||||
File.exist?(($topdir ||= Config::CONFIG["topdir"]) + "/config.h")
|
||||
$hdrdir = $top_srcdir
|
||||
else
|
||||
abort "can't find header files for ruby."
|
||||
end
|
||||
|
@ -728,7 +728,7 @@ end
|
|||
def configuration(srcdir)
|
||||
mk = []
|
||||
vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
|
||||
if $mingw && CONFIG['build_os'] == 'cygwin'
|
||||
if !CROSS_COMPILING && CONFIG['build_os'] == 'cygwin' && CONFIG['target_os'] != 'cygwin'
|
||||
vpath.each {|p| p.sub!(/.*/, '$(shell cygpath -u \&)')}
|
||||
end
|
||||
mk << %{
|
||||
|
@ -739,7 +739,7 @@ SHELL = /bin/sh
|
|||
srcdir = #{srcdir}
|
||||
topdir = #{$topdir}
|
||||
hdrdir = #{$hdrdir}
|
||||
VPATH = #{vpath.join(File::PATH_SEPARATOR)}
|
||||
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
|
||||
}
|
||||
drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
|
||||
if destdir = CONFIG["prefix"].scan(drive)[0] and !destdir.empty?
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!./miniruby -s
|
||||
|
||||
# avoid warnings with -d.
|
||||
$srcdir ||= nil
|
||||
$install_name ||= nil
|
||||
$so_name ||= nil
|
||||
|
||||
|
@ -9,7 +8,6 @@ require File.dirname($0)+"/lib/fileutils"
|
|||
mkconfig = File.basename($0)
|
||||
|
||||
rbconfig_rb = ARGV[0] || 'rbconfig.rb'
|
||||
srcdir = $srcdir || '.'
|
||||
unless File.directory?(dir = File.dirname(rbconfig_rb))
|
||||
FileUtils.makedirs(dir, :verbose => true)
|
||||
end
|
||||
|
@ -54,17 +52,12 @@ File.foreach "config.status" do |line|
|
|||
v_others << v
|
||||
end
|
||||
has_version = true if name == "MAJOR"
|
||||
elsif /^(?:ac_given_)?srcdir=(.*)/ =~ line
|
||||
srcdir = $1.strip
|
||||
elsif /^ac_given_INSTALL=(.*)/ =~ line
|
||||
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
|
||||
end
|
||||
# break if /^CEOF/
|
||||
end
|
||||
|
||||
srcdir = File.expand_path(srcdir)
|
||||
v_fast.unshift(" CONFIG[\"srcdir\"] = \"" + srcdir + "\"\n")
|
||||
|
||||
v_fast.collect! do |x|
|
||||
if /"prefix"/ === x
|
||||
x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
|
||||
|
@ -113,7 +106,7 @@ print <<EOS
|
|||
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
|
||||
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
|
||||
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
|
||||
CONFIG["compile_dir"] = "#{Dir.pwd}"
|
||||
CONFIG["topdir"] = File.dirname(__FILE__)
|
||||
MAKEFILE_CONFIG = {}
|
||||
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
||||
def Config::expand(val, config = CONFIG)
|
||||
|
|
Loading…
Reference in a new issue