mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/extmk.rb (extmake): extract necessary variables for static link
from Makefile. * lib/mkmf.rb (create_makefile): save preload and libpath for next compile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c0ab40c785
commit
5c51ccc35c
3 changed files with 43 additions and 13 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Fri Apr 2 18:00:05 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb (extmake): extract necessary variables for static link
|
||||||
|
from Makefile.
|
||||||
|
|
||||||
|
* lib/mkmf.rb (create_makefile): save preload and libpath for next
|
||||||
|
compile.
|
||||||
|
|
||||||
Fri Apr 2 17:27:17 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri Apr 2 17:27:17 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (top_include): include in the wrapped load is done for
|
* eval.c (top_include): include in the wrapped load is done for
|
||||||
|
|
36
ext/extmk.rb
36
ext/extmk.rb
|
@ -16,6 +16,7 @@ alias $PROGRAM_NAME $0
|
||||||
alias $0 $progname
|
alias $0 $progname
|
||||||
|
|
||||||
$extlist = []
|
$extlist = []
|
||||||
|
$extupdate = false
|
||||||
|
|
||||||
$:.replace ["."]
|
$:.replace ["."]
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
@ -74,8 +75,7 @@ def extmake(target)
|
||||||
$preload = nil
|
$preload = nil
|
||||||
makefile = "./Makefile"
|
makefile = "./Makefile"
|
||||||
unless $ignore
|
unless $ignore
|
||||||
if $static ||
|
if !(t = modified?(makefile, MTIMES)) ||
|
||||||
!(t = modified?(makefile, MTIMES)) ||
|
|
||||||
%W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
|
%W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
|
||||||
#{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])}
|
#{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])}
|
||||||
then
|
then
|
||||||
|
@ -91,6 +91,7 @@ def extmake(target)
|
||||||
else
|
else
|
||||||
create_makefile(target)
|
create_makefile(target)
|
||||||
end
|
end
|
||||||
|
$extupdate = true
|
||||||
File.exist?(makefile)
|
File.exist?(makefile)
|
||||||
rescue SystemExit
|
rescue SystemExit
|
||||||
# ignore
|
# ignore
|
||||||
|
@ -100,6 +101,19 @@ def extmake(target)
|
||||||
Config::CONFIG["srcdir"] = $top_srcdir
|
Config::CONFIG["srcdir"] = $top_srcdir
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if $static
|
||||||
|
m = File.read(makefile)
|
||||||
|
$preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
|
||||||
|
$DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "")
|
||||||
|
if s = m[/^LIBS[ \t]*=[ \t]*(.*)/, 1]
|
||||||
|
s.sub!(/^#{Regexp.quote($LIBRUBYARG)} */, "")
|
||||||
|
s.sub!(/ *#{Regexp.quote($LIBS)}$/, "")
|
||||||
|
$libs = s
|
||||||
|
end
|
||||||
|
$LOCAL_LIBS = m[/^LOCAL_LIBS[ \t]*=[ \t]*(.*)/, 1] || ""
|
||||||
|
$LIBPATH = Shellwords.shellwords(m[/^libpath[ \t]*=[ \t]*(.*)/, 1] || "") -
|
||||||
|
%w[$(libdir) $(topdir)]
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -124,8 +138,7 @@ def extmake(target)
|
||||||
$extlibs ||= []
|
$extlibs ||= []
|
||||||
$extpath ||= []
|
$extpath ||= []
|
||||||
unless $mswin
|
unless $mswin
|
||||||
$extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
|
$extflags = ($extflags.split | $DLDFLAGS.split | $LDFLAGS.split).join(" ")
|
||||||
$extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
|
|
||||||
end
|
end
|
||||||
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
|
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
|
||||||
$extpath |= $LIBPATH
|
$extpath |= $LIBPATH
|
||||||
|
@ -180,7 +193,12 @@ def parse_args()
|
||||||
opts.on('--message [MESSAGE]', String) do |v|
|
opts.on('--message [MESSAGE]', String) do |v|
|
||||||
$message = v
|
$message = v
|
||||||
end
|
end
|
||||||
opts.parse!
|
begin
|
||||||
|
opts.parse!
|
||||||
|
rescue OptionParser::InvalidOption => e
|
||||||
|
retry if /^--/ =~ e.args[0]
|
||||||
|
raise
|
||||||
|
end
|
||||||
end or abort opts.to_s
|
end or abort opts.to_s
|
||||||
|
|
||||||
$destdir ||= ''
|
$destdir ||= ''
|
||||||
|
@ -334,7 +352,7 @@ if $extlist.size > 0
|
||||||
list = $extlist.dup
|
list = $extlist.dup
|
||||||
while e = list.shift
|
while e = list.shift
|
||||||
s,t,i,r = e
|
s,t,i,r = e
|
||||||
if r
|
if r and !r.empty?
|
||||||
l = list.size
|
l = list.size
|
||||||
if (while l > 0; break true if r.include?(list[l-=1][1]) end)
|
if (while l > 0; break true if r.include?(list[l-=1][1]) end)
|
||||||
list.insert(l + 1, e)
|
list.insert(l + 1, e)
|
||||||
|
@ -375,11 +393,13 @@ SRC
|
||||||
end
|
end
|
||||||
rubies = []
|
rubies = []
|
||||||
%w[RUBY RUBYW].each {|r|
|
%w[RUBY RUBYW].each {|r|
|
||||||
config_string(r+"_INSTALL_NAME") {|r| rubies << r+EXEEXT}
|
if r = arg_config("--"+r.downcase) || config_string(r+"_INSTALL_NAME")
|
||||||
|
rubies << r+EXEEXT
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
Dir.chdir ".."
|
Dir.chdir ".."
|
||||||
if $extlist.size > 0
|
if !$extlist.empty? and $extupdate
|
||||||
rm_f(Config::CONFIG["LIBRUBY_SO"])
|
rm_f(Config::CONFIG["LIBRUBY_SO"])
|
||||||
end
|
end
|
||||||
puts "making #{rubies.join(', ')}"
|
puts "making #{rubies.join(', ')}"
|
||||||
|
|
10
lib/mkmf.rb
10
lib/mkmf.rb
|
@ -803,7 +803,7 @@ def dummy_makefile(srcdir)
|
||||||
CLEANFILES = #{$cleanfiles.join(' ')}
|
CLEANFILES = #{$cleanfiles.join(' ')}
|
||||||
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
|
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
|
||||||
|
|
||||||
all install install-so install-rb: Makefile
|
all install static install-so install-rb: Makefile
|
||||||
|
|
||||||
RULES
|
RULES
|
||||||
end
|
end
|
||||||
|
@ -868,6 +868,8 @@ def create_makefile(target, srcprefix = nil)
|
||||||
mfile = open("Makefile", "wb")
|
mfile = open("Makefile", "wb")
|
||||||
mfile.print configuration(srcdir)
|
mfile.print configuration(srcdir)
|
||||||
mfile.print %{
|
mfile.print %{
|
||||||
|
preload = #{$preload.join(" ") if $preload}
|
||||||
|
libpath = #{$LIBPATH.join(" ")}
|
||||||
LIBPATH = #{libpath}
|
LIBPATH = #{libpath}
|
||||||
DEFFILE = #{deffile}
|
DEFFILE = #{deffile}
|
||||||
|
|
||||||
|
@ -915,9 +917,9 @@ static: $(STATIC_LIB)
|
||||||
mfile.print CLEANINGS
|
mfile.print CLEANINGS
|
||||||
dirs = []
|
dirs = []
|
||||||
mfile.print "install: install-so install-rb\n\n"
|
mfile.print "install: install-so install-rb\n\n"
|
||||||
if not $static and target
|
dirs << (dir = "$(RUBYARCHDIR)")
|
||||||
dirs << (dir = "$(RUBYARCHDIR)")
|
mfile.print("install-so: #{dir}\n")
|
||||||
mfile.print("install-so: #{dir}\n")
|
if target
|
||||||
f = "$(DLLIB)"
|
f = "$(DLLIB)"
|
||||||
dest = "#{dir}/#{f}"
|
dest = "#{dir}/#{f}"
|
||||||
mfile.print "install-so: #{dest}\n"
|
mfile.print "install-so: #{dest}\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue