* ext/extmk.rb: prefer relative path. [ruby-talk:93037]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37e723a2fd
commit
cf8cd080e4
@ -1,3 +1,7 @@
|
|||||||
|
Sat Feb 21 14:33:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb: prefer relative path. [ruby-talk:93037]
|
||||||
|
|
||||||
Sat Feb 21 11:12:08 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Feb 21 11:12:08 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* missing/os2.c, missing/x68.c: typo fix. pointed out by greentea.
|
* missing/os2.c, missing/x68.c: typo fix. pointed out by greentea.
|
||||||
|
36
ext/extmk.rb
36
ext/extmk.rb
@ -27,7 +27,7 @@ $:.replace [srcdir, srcdir+"/lib", "."]
|
|||||||
require 'mkmf'
|
require 'mkmf'
|
||||||
require 'getopts'
|
require 'getopts'
|
||||||
|
|
||||||
$topdir = File.expand_path(".")
|
$topdir = "."
|
||||||
$top_srcdir = srcdir
|
$top_srcdir = srcdir
|
||||||
$hdrdir = $top_srcdir
|
$hdrdir = $top_srcdir
|
||||||
|
|
||||||
@ -52,7 +52,17 @@ def extmake(target)
|
|||||||
init_mkmf
|
init_mkmf
|
||||||
|
|
||||||
FileUtils.mkpath target unless File.directory?(target)
|
FileUtils.mkpath target unless File.directory?(target)
|
||||||
Dir.chdir(target) do
|
begin
|
||||||
|
dir = Dir.pwd
|
||||||
|
FileUtils.mkpath target unless File.directory?(target)
|
||||||
|
Dir.chdir 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
|
||||||
|
$topdir = prefix + $topdir
|
||||||
$target = target
|
$target = target
|
||||||
$mdir = target
|
$mdir = target
|
||||||
$srcdir = File.join($top_srcdir, "ext", $mdir)
|
$srcdir = File.join($top_srcdir, "ext", $mdir)
|
||||||
@ -112,6 +122,10 @@ def extmake(target)
|
|||||||
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
|
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
|
||||||
$extpath |= $LIBPATH
|
$extpath |= $LIBPATH
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
$hdrdir = $top_srcdir = top_srcdir
|
||||||
|
$topdir = topdir
|
||||||
|
Dir.chdir dir
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
Dir.rmdir target
|
Dir.rmdir target
|
||||||
@ -182,11 +196,7 @@ def parse_args()
|
|||||||
$mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
|
$mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
|
||||||
end
|
end
|
||||||
if $extout
|
if $extout
|
||||||
$absextout = File.expand_path(Config::expand($extout.dup), $topdir)
|
|
||||||
$extout = '$(topdir)/'+$extout
|
$extout = '$(topdir)/'+$extout
|
||||||
unless Config::expand($extout.dup) == $absextout
|
|
||||||
$extout = $absextout
|
|
||||||
end
|
|
||||||
$extout_prefix = $extout ? "$(extout)$(target_prefix)/" : ""
|
$extout_prefix = $extout ? "$(extout)$(target_prefix)/" : ""
|
||||||
$mflags << "extout=#$extout" << "extout_prefix=#$extout_prefix"
|
$mflags << "extout=#$extout" << "extout_prefix=#$extout_prefix"
|
||||||
end
|
end
|
||||||
@ -277,28 +287,36 @@ exts |= Dir.glob("#{ext_prefix}/*/**/MANIFEST").collect {|d|
|
|||||||
} unless $extension
|
} unless $extension
|
||||||
|
|
||||||
if $extout
|
if $extout
|
||||||
|
Config.expand(extout = $extout+"/.")
|
||||||
if $install
|
if $install
|
||||||
Config.expand(dest = "#{$destdir}#{$rubylibdir}")
|
Config.expand(dest = "#{$destdir}#{$rubylibdir}")
|
||||||
FileUtils.cp_r($absextout+"/.", dest, :verbose => true, :noop => $dryrun)
|
FileUtils.cp_r(extout, dest, :verbose => true, :noop => $dryrun)
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
unless $ignore
|
unless $ignore
|
||||||
FileUtils.mkpath($absextout)
|
FileUtils.mkpath(extout)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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 = "../" + srcdir
|
||||||
|
end
|
||||||
|
$topdir = ".."
|
||||||
exts.each do |d|
|
exts.each do |d|
|
||||||
extmake(d) or abort
|
extmake(d) or abort
|
||||||
end
|
end
|
||||||
|
$hdrdir = $top_srcdir = srcdir
|
||||||
|
$topdir = "."
|
||||||
|
|
||||||
if $ignore
|
if $ignore
|
||||||
Dir.chdir ".."
|
Dir.chdir ".."
|
||||||
if $clean
|
if $clean
|
||||||
Dir.rmdir('ext') rescue nil
|
Dir.rmdir('ext') rescue nil
|
||||||
FileUtils.rm_rf($absextout) if $extout
|
FileUtils.rm_rf(extout) if $extout
|
||||||
end
|
end
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user