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): 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:
nobu 2004-04-02 09:00:12 +00:00
parent c0ab40c785
commit 5c51ccc35c
3 changed files with 43 additions and 13 deletions

View file

@ -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>
* eval.c (top_include): include in the wrapped load is done for
@ -50,7 +58,7 @@ Thu Apr 1 19:58:37 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
object with soap/marshal.
added URIFactory class for URI mapping. BasetypeFactory checks
instance_variables when original mapping is not allowed (ivar must
be empty). Instance of URI have instance_variables but it must be
be empty). Instance of URI have instance_variables but it must be
llowed whenever original mapping is allowed or not.
Wed Mar 31 19:06:23 2004 Tanaka Akira <akr@m17n.org>

View file

@ -16,6 +16,7 @@ alias $PROGRAM_NAME $0
alias $0 $progname
$extlist = []
$extupdate = false
$:.replace ["."]
require 'rbconfig'
@ -74,8 +75,7 @@ def extmake(target)
$preload = nil
makefile = "./Makefile"
unless $ignore
if $static ||
!(t = modified?(makefile, MTIMES)) ||
if !(t = modified?(makefile, MTIMES)) ||
%W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
#{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])}
then
@ -91,6 +91,7 @@ def extmake(target)
else
create_makefile(target)
end
$extupdate = true
File.exist?(makefile)
rescue SystemExit
# ignore
@ -100,6 +101,19 @@ def extmake(target)
Config::CONFIG["srcdir"] = $top_srcdir
end
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
end
else
@ -124,8 +138,7 @@ def extmake(target)
$extlibs ||= []
$extpath ||= []
unless $mswin
$extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
$extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
$extflags = ($extflags.split | $DLDFLAGS.split | $LDFLAGS.split).join(" ")
end
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
$extpath |= $LIBPATH
@ -180,7 +193,12 @@ def parse_args()
opts.on('--message [MESSAGE]', String) do |v|
$message = v
end
opts.parse!
begin
opts.parse!
rescue OptionParser::InvalidOption => e
retry if /^--/ =~ e.args[0]
raise
end
end or abort opts.to_s
$destdir ||= ''
@ -334,7 +352,7 @@ if $extlist.size > 0
list = $extlist.dup
while e = list.shift
s,t,i,r = e
if r
if r and !r.empty?
l = list.size
if (while l > 0; break true if r.include?(list[l-=1][1]) end)
list.insert(l + 1, e)
@ -375,11 +393,13 @@ SRC
end
rubies = []
%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 ".."
if $extlist.size > 0
if !$extlist.empty? and $extupdate
rm_f(Config::CONFIG["LIBRUBY_SO"])
end
puts "making #{rubies.join(', ')}"

View file

@ -803,7 +803,7 @@ def dummy_makefile(srcdir)
CLEANFILES = #{$cleanfiles.join(' ')}
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
all install install-so install-rb: Makefile
all install static install-so install-rb: Makefile
RULES
end
@ -868,6 +868,8 @@ def create_makefile(target, srcprefix = nil)
mfile = open("Makefile", "wb")
mfile.print configuration(srcdir)
mfile.print %{
preload = #{$preload.join(" ") if $preload}
libpath = #{$LIBPATH.join(" ")}
LIBPATH = #{libpath}
DEFFILE = #{deffile}
@ -915,9 +917,9 @@ static: $(STATIC_LIB)
mfile.print CLEANINGS
dirs = []
mfile.print "install: install-so install-rb\n\n"
if not $static and target
dirs << (dir = "$(RUBYARCHDIR)")
mfile.print("install-so: #{dir}\n")
dirs << (dir = "$(RUBYARCHDIR)")
mfile.print("install-so: #{dir}\n")
if target
f = "$(DLLIB)"
dest = "#{dir}/#{f}"
mfile.print "install-so: #{dest}\n"