* 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
@ -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>
|
Thu Mar 18 17:46:35 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
* lib/drb/drb.rb: do not undef :to_a.
|
* lib/drb/drb.rb: do not undef :to_a.
|
||||||
|
30
ext/extmk.rb
30
ext/extmk.rb
@ -20,22 +20,29 @@ $extlist = []
|
|||||||
$:.replace ["."]
|
$:.replace ["."]
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
|
||||||
srcdir = Config::CONFIG["srcdir"]
|
srcdir = File.dirname(File.dirname(__FILE__))
|
||||||
|
|
||||||
$:.replace [srcdir, srcdir+"/lib", "."]
|
$:.replace [srcdir, srcdir+"/lib", "."]
|
||||||
|
|
||||||
|
$topdir = "."
|
||||||
|
$top_srcdir = srcdir
|
||||||
|
|
||||||
require 'mkmf'
|
require 'mkmf'
|
||||||
require 'optparse/shellwords'
|
require 'optparse/shellwords'
|
||||||
|
|
||||||
$topdir = "."
|
|
||||||
$top_srcdir = srcdir
|
|
||||||
$hdrdir = $top_srcdir
|
|
||||||
|
|
||||||
def sysquote(x)
|
def sysquote(x)
|
||||||
@quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
@quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
||||||
@quote ? x.quote : x
|
@quote ? x.quote : x
|
||||||
end
|
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)
|
def extmake(target)
|
||||||
print "#{$message} #{target}\n"
|
print "#{$message} #{target}\n"
|
||||||
$stdout.flush
|
$stdout.flush
|
||||||
@ -59,9 +66,7 @@ def extmake(target)
|
|||||||
top_srcdir = $top_srcdir
|
top_srcdir = $top_srcdir
|
||||||
topdir = $topdir
|
topdir = $topdir
|
||||||
prefix = "../" * (target.count("/")+1)
|
prefix = "../" * (target.count("/")+1)
|
||||||
if File.expand_path(top_srcdir) != File.expand_path(top_srcdir, dir)
|
$hdrdir = $top_srcdir = relative_from(top_srcdir, prefix)
|
||||||
$hdrdir = $top_srcdir = prefix + top_srcdir
|
|
||||||
end
|
|
||||||
$topdir = prefix + $topdir
|
$topdir = prefix + $topdir
|
||||||
$target = target
|
$target = target
|
||||||
$mdir = target
|
$mdir = target
|
||||||
@ -239,7 +244,7 @@ elsif $nmake
|
|||||||
else
|
else
|
||||||
$ruby = '$(topdir)/miniruby' + EXEEXT
|
$ruby = '$(topdir)/miniruby' + EXEEXT
|
||||||
end
|
end
|
||||||
$ruby << " -I$(topdir) -I$(hdrdir)/lib"
|
$ruby << " -I'$(topdir)' -I'$(hdrdir)/lib'"
|
||||||
$config_h = '$(topdir)/config.h'
|
$config_h = '$(topdir)/config.h'
|
||||||
|
|
||||||
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
|
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
|
} unless $extension
|
||||||
|
|
||||||
if $extout
|
if $extout
|
||||||
Config.expand(extout = $extout+"/.")
|
Config.expand(extout = $extout+"/.", Config::CONFIG.merge("topdir"=>$topdir))
|
||||||
if $install
|
if $install
|
||||||
Config.expand(dest = "#{$destdir}#{$rubylibdir}")
|
Config.expand(dest = "#{$destdir}#{$rubylibdir}")
|
||||||
FileUtils.cp_r(extout, dest, :verbose => true, :noop => $dryrun)
|
FileUtils.cp_r(extout, dest, :verbose => true, :noop => $dryrun)
|
||||||
@ -304,10 +309,7 @@ dir = Dir.pwd
|
|||||||
FileUtils::makedirs('ext')
|
FileUtils::makedirs('ext')
|
||||||
Dir::chdir('ext')
|
Dir::chdir('ext')
|
||||||
|
|
||||||
if File.expand_path(srcdir) != File.expand_path(srcdir, dir)
|
$hdrdir = $top_srcdir = relative_from(srcdir, $topdir = "..")
|
||||||
$hdrdir = $top_srcdir = "../" + srcdir
|
|
||||||
end
|
|
||||||
$topdir = ".."
|
|
||||||
exts.each do |d|
|
exts.each do |d|
|
||||||
extmake(d) or abort
|
extmake(d) or abort
|
||||||
end
|
end
|
||||||
|
16
lib/mkmf.rb
16
lib/mkmf.rb
@ -38,7 +38,6 @@ unless defined? $configure_args
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
$srcdir = CONFIG["srcdir"]
|
|
||||||
$libdir = CONFIG["libdir"]
|
$libdir = CONFIG["libdir"]
|
||||||
$rubylibdir = CONFIG["rubylibdir"]
|
$rubylibdir = CONFIG["rubylibdir"]
|
||||||
$archdir = CONFIG["archdir"]
|
$archdir = CONFIG["archdir"]
|
||||||
@ -77,12 +76,13 @@ def map_dir(dir, map = nil)
|
|||||||
map.inject(dir) {|dir, (orig, new)| dir.gsub(orig, new)}
|
map.inject(dir) {|dir, (orig, new)| dir.gsub(orig, new)}
|
||||||
end
|
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
|
$topdir = $hdrdir = $archdir
|
||||||
elsif File.exist?($srcdir + "/ruby.h") and
|
elsif File.exist?(($top_srcdir ||= File.dirname(libdir)) + "/ruby.h") and
|
||||||
File.exist?((compile_dir = Config::CONFIG['compile_dir']) + "/config.h")
|
File.exist?(($topdir ||= Config::CONFIG["topdir"]) + "/config.h")
|
||||||
$hdrdir = $srcdir
|
$hdrdir = $top_srcdir
|
||||||
$topdir = compile_dir
|
|
||||||
else
|
else
|
||||||
abort "can't find header files for ruby."
|
abort "can't find header files for ruby."
|
||||||
end
|
end
|
||||||
@ -728,7 +728,7 @@ end
|
|||||||
def configuration(srcdir)
|
def configuration(srcdir)
|
||||||
mk = []
|
mk = []
|
||||||
vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
|
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 \&)')}
|
vpath.each {|p| p.sub!(/.*/, '$(shell cygpath -u \&)')}
|
||||||
end
|
end
|
||||||
mk << %{
|
mk << %{
|
||||||
@ -739,7 +739,7 @@ SHELL = /bin/sh
|
|||||||
srcdir = #{srcdir}
|
srcdir = #{srcdir}
|
||||||
topdir = #{$topdir}
|
topdir = #{$topdir}
|
||||||
hdrdir = #{$hdrdir}
|
hdrdir = #{$hdrdir}
|
||||||
VPATH = #{vpath.join(File::PATH_SEPARATOR)}
|
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
|
||||||
}
|
}
|
||||||
drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
|
drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
|
||||||
if destdir = CONFIG["prefix"].scan(drive)[0] and !destdir.empty?
|
if destdir = CONFIG["prefix"].scan(drive)[0] and !destdir.empty?
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!./miniruby -s
|
#!./miniruby -s
|
||||||
|
|
||||||
# avoid warnings with -d.
|
# avoid warnings with -d.
|
||||||
$srcdir ||= nil
|
|
||||||
$install_name ||= nil
|
$install_name ||= nil
|
||||||
$so_name ||= nil
|
$so_name ||= nil
|
||||||
|
|
||||||
@ -9,7 +8,6 @@ require File.dirname($0)+"/lib/fileutils"
|
|||||||
mkconfig = File.basename($0)
|
mkconfig = File.basename($0)
|
||||||
|
|
||||||
rbconfig_rb = ARGV[0] || 'rbconfig.rb'
|
rbconfig_rb = ARGV[0] || 'rbconfig.rb'
|
||||||
srcdir = $srcdir || '.'
|
|
||||||
unless File.directory?(dir = File.dirname(rbconfig_rb))
|
unless File.directory?(dir = File.dirname(rbconfig_rb))
|
||||||
FileUtils.makedirs(dir, :verbose => true)
|
FileUtils.makedirs(dir, :verbose => true)
|
||||||
end
|
end
|
||||||
@ -54,17 +52,12 @@ File.foreach "config.status" do |line|
|
|||||||
v_others << v
|
v_others << v
|
||||||
end
|
end
|
||||||
has_version = true if name == "MAJOR"
|
has_version = true if name == "MAJOR"
|
||||||
elsif /^(?:ac_given_)?srcdir=(.*)/ =~ line
|
|
||||||
srcdir = $1.strip
|
|
||||||
elsif /^ac_given_INSTALL=(.*)/ =~ line
|
elsif /^ac_given_INSTALL=(.*)/ =~ line
|
||||||
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
|
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
|
||||||
end
|
end
|
||||||
# break if /^CEOF/
|
# break if /^CEOF/
|
||||||
end
|
end
|
||||||
|
|
||||||
srcdir = File.expand_path(srcdir)
|
|
||||||
v_fast.unshift(" CONFIG[\"srcdir\"] = \"" + srcdir + "\"\n")
|
|
||||||
|
|
||||||
v_fast.collect! do |x|
|
v_fast.collect! do |x|
|
||||||
if /"prefix"/ === x
|
if /"prefix"/ === x
|
||||||
x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
|
x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
|
||||||
@ -113,7 +106,7 @@ print <<EOS
|
|||||||
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
|
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
|
||||||
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
|
CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
|
||||||
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
|
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
|
||||||
CONFIG["compile_dir"] = "#{Dir.pwd}"
|
CONFIG["topdir"] = File.dirname(__FILE__)
|
||||||
MAKEFILE_CONFIG = {}
|
MAKEFILE_CONFIG = {}
|
||||||
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
||||||
def Config::expand(val, config = CONFIG)
|
def Config::expand(val, config = CONFIG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user