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

* lib/mkmf.rb (rm_f): use FileUtils.

* lib/mkmf.rb (modified?): return mtime of the target if
  it exists and newer than times.

* lib/mkmf.rb (install_files): add a current directory
  file even if it does not exist yet.

* lib/mkmf.rb (configuration): do not add $LDFLAGS to
  DLDFLAGS.

* ext/extmk.rb (extmake): check whether Makefile is newer
  than depend and MANIFEST.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-07-18 08:34:45 +00:00
parent e06379839c
commit c1c86a37df
3 changed files with 39 additions and 21 deletions

View file

@ -1,3 +1,19 @@
Fri Jul 18 17:34:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/mkmf.rb (rm_f): use FileUtils.
* lib/mkmf.rb (modified?): return mtime of the target if
it exists and newer than times.
* lib/mkmf.rb (install_files): add a current directory
file even if it does not exist yet.
* lib/mkmf.rb (configuration): do not add $LDFLAGS to
DLDFLAGS.
* ext/extmk.rb (extmake): check whether Makefile is newer
than depend and MANIFEST.
Fri Jul 18 14:57:19 2003 NAKAMURA Usaku <usa@ruby-lang.org> Fri Jul 18 14:57:19 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (make_cmdvector): recognize quote within string. * win32/win32.c (make_cmdvector): recognize quote within string.

View file

@ -73,7 +73,9 @@ def extmake(target)
$srcdir = File.join($top_srcdir, "ext", $mdir) $srcdir = File.join($top_srcdir, "ext", $mdir)
unless $ignore unless $ignore
if $static || if $static ||
older("./Makefile", *MTIMES + %W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb") !(t = modified?("./Makefile", MTIMES)) ||
%W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
#{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])}
then then
$defs = [] $defs = []
Logging::logfile 'mkmf.log' Logging::logfile 'mkmf.log'
@ -244,7 +246,7 @@ if $extlist.size > 0
end end
src = "void Init_ext() {\n#$extinit}\n" src = "void Init_ext() {\n#$extinit}\n"
if older("extinit.c", *MTIMES) || IO.read("extinit.c") != src if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
open("extinit.c", "w") {|f| f.print src} open("extinit.c", "w") {|f| f.print src}
end end
@ -268,6 +270,9 @@ rubies = []
} }
Dir.chdir ".." Dir.chdir ".."
if $extlist.size > 0
rm_f(Config::CONFIG["LIBRUBY_SO"])
end
puts "making #{rubies.join(', ')}" puts "making #{rubies.join(', ')}"
$stdout.flush $stdout.flush
$mflags.concat(rubies) $mflags.concat(rubies)

View file

@ -2,6 +2,7 @@
# invoke like: ruby -r mkmf extconf.rb # invoke like: ruby -r mkmf extconf.rb
require 'rbconfig' require 'rbconfig'
require 'fileutils'
require 'shellwords' require 'shellwords'
CONFIG = Config::MAKEFILE_CONFIG CONFIG = Config::MAKEFILE_CONFIG
@ -105,25 +106,13 @@ class Array
end end
def rm_f(*files) def rm_f(*files)
targets = [] FileUtils.rm_f(Dir[files.join("\0")])
for file in files
targets.concat Dir[file]
end
if not targets.empty?
File::chmod(0777, *targets)
File::unlink(*targets)
end
end end
def older(target, *files) def modified?(target, times)
mtime = proc do |f| (t = File.mtime(target)) rescue return nil
Time === f ? f : f.respond_to?(:mtime) ? f.mtime : File.mtime(f) rescue nil Array === times or times = [times]
end t if times.all? {|n| n <= t}
t = mtime[target] or return true
for f in files
return true if t < (mtime[f] or next)
end
false
end end
module Logging module Logging
@ -339,6 +328,7 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
files = File.join(srcdir, files) files = File.join(srcdir, files)
len = srcdir.size len = srcdir.size
end end
f = nil
Dir.glob(files) do |f| Dir.glob(files) do |f|
f[0..len] = "" if len f[0..len] = "" if len
d = File.dirname(f) d = File.dirname(f)
@ -347,6 +337,12 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
f = File.join(srcprefix, f) if len f = File.join(srcprefix, f) if len
path[d] << f path[d] << f
end end
unless len or f
d = File.dirname(files)
d.sub!(prefix, "") if prefix
d = (d.empty? || d == ".") ? dir : File.join(dir, d)
path[d] << files
end
end end
dirs dirs
end end
@ -370,9 +366,10 @@ def checking_for(m)
f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim
m = "checking for #{m}... " m = "checking for #{m}... "
message m message m
Logging::message "#{f}#{m}\n" Logging::message "#{f}#{m}--------------------\n"
r = yield r = yield
message(r ? "yes\n" : "no\n") message(a = r ? "yes\n" : "no\n")
Logging::message "-------------------- #{a}\n"
r r
end end