1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/extmk.rb (extmake): save all CONFIG values.

* ext/extmk.rb (extmake): remove mkmf.log at clean, and extconf.h at
  distclean, respectively.

* ext/extmk.rb: remove rdoc at clean, and installed list file at
  distclean, respectively.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-03 02:05:57 +00:00
parent f3a1a4a4ba
commit 341ae6ac3e
2 changed files with 53 additions and 16 deletions

View file

@ -1,3 +1,13 @@
Fri Aug 3 11:05:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extmake): save all CONFIG values.
* ext/extmk.rb (extmake): remove mkmf.log at clean, and extconf.h at
distclean, respectively.
* ext/extmk.rb: remove rdoc at clean, and installed list file at
distclean, respectively.
Fri Aug 3 07:09:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Aug 3 07:09:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb: more verbose message. [ruby-Bugs-12766] * lib/mkmf.rb: more verbose message. [ruby-Bugs-12766]

View file

@ -113,8 +113,6 @@ def extmake(target)
top_srcdir = $top_srcdir top_srcdir = $top_srcdir
topdir = $topdir topdir = $topdir
hdrdir = $hdrdir hdrdir = $hdrdir
mk_srcdir = CONFIG["srcdir"]
mk_topdir = CONFIG["topdir"]
prefix = "../" * (target.count("/")+1) prefix = "../" * (target.count("/")+1)
$top_srcdir = relative_from(top_srcdir, prefix) $top_srcdir = relative_from(top_srcdir, prefix)
$hdrdir = relative_from(hdrdir, prefix) $hdrdir = relative_from(hdrdir, prefix)
@ -129,12 +127,30 @@ def extmake(target)
makefile = "./Makefile" makefile = "./Makefile"
ok = File.exist?(makefile) ok = File.exist?(makefile)
unless $ignore unless $ignore
RbConfig::CONFIG["hdrdir"] = $hdrdir rbconfig0 = RbConfig::CONFIG
RbConfig::CONFIG["srcdir"] = $srcdir mkconfig0 = CONFIG
RbConfig::CONFIG["topdir"] = $topdir rbconfig = {
CONFIG["hdrdir"] = ($hdrdir == top_srcdir) ? top_srcdir : "$(top_srcdir)/include" "hdrdir" => $hdrdir,
CONFIG["srcdir"] = "$(top_srcdir)/ext/#{$mdir}" "srcdir" => $srcdir,
CONFIG["topdir"] = $topdir "topdir" => $topdir,
}
mkconfig = {
"hdrdir" => ($hdrdir == top_srcdir) ? top_srcdir : "$(top_srcdir)/include",
"srcdir" => "$(top_srcdir)/ext/#{$mdir}",
"topdir" => $topdir,
}
rbconfig0.each_pair {|key, val| rbconfig[key] ||= val.dup}
mkconfig0.each_pair {|key, val| mkconfig[key] ||= val.dup}
RbConfig.module_eval {
remove_const(:CONFIG)
const_set(:CONFIG, rbconfig)
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig)
}
Object.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig)
}
begin begin
$extconf_h = nil $extconf_h = nil
ok &&= extract_makefile(makefile) ok &&= extract_makefile(makefile)
@ -183,8 +199,11 @@ def extmake(target)
$ignore or $continue or return false $ignore or $continue or return false
end end
$compiled[target] = true $compiled[target] = true
if $clean and $clean != true if $clean
File.unlink(makefile) rescue nil FileUtils.rm_f("mkmf.log")
if $clean != true
FileUtils.rm_f([makefile, $extconf_h || "extconf.h"])
end
end end
if $static if $static
$extflags ||= "" $extflags ||= ""
@ -197,11 +216,18 @@ def extmake(target)
$extpath |= $LIBPATH $extpath |= $LIBPATH
end end
ensure ensure
RbConfig::CONFIG["srcdir"] = $top_srcdir unless $ignore
RbConfig::CONFIG["topdir"] = topdir RbConfig.module_eval {
CONFIG["srcdir"] = mk_srcdir remove_const(:CONFIG)
CONFIG["topdir"] = mk_topdir const_set(:CONFIG, rbconfig0)
CONFIG.delete("hdrdir") remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig0)
}
Object.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig0)
}
end
$top_srcdir = top_srcdir $top_srcdir = top_srcdir
$topdir = topdir $topdir = topdir
$hdrdir = hdrdir $hdrdir = hdrdir
@ -428,10 +454,11 @@ if $ignore
if $clean if $clean
Dir.rmdir('ext') rescue nil Dir.rmdir('ext') rescue nil
if $extout if $extout
FileUtils.rm_rf([extout+"/common", extout+"/include/ruby"]) FileUtils.rm_rf([extout+"/common", extout+"/include/ruby", extout+"/rdoc"])
FileUtils.rm_rf(extout+"/"+CONFIG["arch"]) FileUtils.rm_rf(extout+"/"+CONFIG["arch"])
if $clean != true if $clean != true
FileUtils.rm_rf(extout+"/include/"+CONFIG["arch"]) FileUtils.rm_rf(extout+"/include/"+CONFIG["arch"])
FileUtils.rm_f($mflags.defined?("INSTALLED_LIST")||ENV["INSTALLED_LIST"]||".installed.list")
Dir.rmdir(extout+"/include") rescue nil Dir.rmdir(extout+"/include") rescue nil
Dir.rmdir(extout) rescue nil Dir.rmdir(extout) rescue nil
end end