Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* Makefile.in: static link libraries to LIBRUBY_SO with static linked

  ext.  [ruby-dev:21157]

* ext/extmk.rb (extmake): sort extension library initialization order.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit d4094d08334f6d1589fe90ecb9a43f202d2bb254 1 parent de3e7ab
Nobuyoshi Nakada nobu authored

Showing 3 changed files with 28 additions and 11 deletions. Show diff stats Hide diff stats

  1. +7 0 ChangeLog
  2. +11 8 Makefile.in
  3. +10 3 ext/extmk.rb
7 ChangeLog
... ... @@ -1,3 +1,10 @@
  1 +Tue Aug 12 11:12:42 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
  2 +
  3 + * Makefile.in: static link libraries to LIBRUBY_SO with static linked
  4 + ext. [ruby-dev:21157]
  5 +
  6 + * ext/extmk.rb (extmake): sort extension library initialization order.
  7 +
1 8 Tue Aug 12 02:48:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
2 9
3 10 * eval.c (THREAD_SAVE_CONTEXT): should explicitly turn off the
19 Makefile.in
@@ -30,7 +30,7 @@ EXTLIBS =
30 30 LIBS = @LIBS@ $(EXTLIBS)
31 31 MISSING = @LIBOBJS@ @ALLOCA@
32 32 LDSHARED = @LIBRUBY_LDSHARED@
33   -DLDFLAGS = @LIBRUBY_DLDFLAGS@
  33 +DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(EXTLDFLAGS)
34 34 SOLIBS = @SOLIBS@
35 35 MAINLIBS = @MAINLIBS@
36 36
@@ -57,8 +57,11 @@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
57 57
58 58 PREP = @PREP@ @ARCHFILE@
59 59 SETUP =
  60 +EXTSTATIC = @EXTSTATIC@
60 61
61 62 EXTOBJS =
  63 +DLDOBJS = $(DMYEXT)
  64 +DMYEXT = dmyext.@OBJEXT@
62 65
63 66 MAINOBJ = main.@OBJEXT@
64 67
@@ -108,22 +111,22 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
108 111 --make-flags="$(MAKEFLAGS)"
109 112
110 113 all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY)
111   - @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="@EXTSTATIC@" $(SCRIPT_ARGS)
  114 + @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="$(EXTSTATIC)" $(SCRIPT_ARGS)
112 115
113   -miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@
  116 +miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(DMYEXT)
114 117 @rm -f $@
115   - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) dmyext.@OBJEXT@ $(LIBRUBY_A) $(LIBS) -o $@
  118 + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(DMYEXT) $(LIBRUBY_A) $(LIBS) -o $@
116 119
117 120 $(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) $(SETUP) miniruby$(EXEEXT)
118 121 @rm -f $@
119 122 $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
120 123
121   -$(LIBRUBY_A): $(OBJS) dmyext.@OBJEXT@
122   - @AR@ rcu $@ $(OBJS) dmyext.@OBJEXT@
  124 +$(LIBRUBY_A): $(OBJS) $(DMYEXT)
  125 + @AR@ rcu $@ $(OBJS) $(DMYEXT)
123 126 @-@RANLIB@ $@ 2> /dev/null || true
124 127
125   -$(LIBRUBY_SO): $(OBJS) dmyext.@OBJEXT@ miniruby$(EXEEXT) $(PREP)
126   - $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.@OBJEXT@ $(SOLIBS) -o $@
  128 +$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) miniruby$(EXEEXT) $(PREP)
  129 + $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) -o $@
127 130 @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
128 131 File.symlink "$(LIBRUBY_SO)", link}' \
129 132 $(LIBRUBY_ALIASES) || true
13 ext/extmk.rb
@@ -60,6 +60,7 @@ def extmake(target)
60 60 $target = target
61 61 $mdir = target
62 62 $srcdir = File.join($top_srcdir, "ext", $mdir)
  63 + $preload = nil
63 64 unless $ignore
64 65 if $static ||
65 66 !(t = modified?("./Makefile", MTIMES)) ||
@@ -88,7 +89,7 @@ def extmake(target)
88 89 end
89 90 if File.exist?("./Makefile")
90 91 if $static
91   - $extlist.push [$static, $target, File.basename($target)]
  92 + $extlist.push [$static, $target, File.basename($target), $preload]
92 93 end
93 94 unless system($make, *sysquote($mflags))
94 95 $ignore or $continue or return false
@@ -228,7 +229,13 @@ def $mflags.set?(flag)
228 229 if $extlist.size > 0
229 230 $extinit ||= ""
230 231 $extobjs ||= ""
231   - for s,t,i in $extlist
  232 + list = $extlist.dup
  233 + until list.empty?
  234 + s,t,i,r = list.shift
  235 + if r and list.any? {|l| r.include?(l[1])}
  236 + list << [s,t,i]
  237 + next
  238 + end
232 239 f = format("%s/%s.%s", s, i, $LIBEXT)
233 240 if File.exist?(f)
234 241 $extinit += "\tinit(Init_#{i}, \"#{t}.so\");\n"
@@ -252,7 +259,7 @@ def $mflags.set?(flag)
252 259 $extpath.delete("$(topdir)")
253 260 $extflags = libpathflag($extpath) << " " << $extflags.strip
254 261 conf = [
255   - ['SETUP', $setup], ['EXTOBJS', $extobjs],
  262 + ['SETUP', $setup], [$enable_shared ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
256 263 ['EXTLIBS', $extlibs], ['EXTLDFLAGS', $extflags]
257 264 ].map {|n, v|
258 265 "#{n}=#{v}" if v and !(v = v.strip).empty?

0 comments on commit d4094d0

Please sign in to comment.
Something went wrong with that request. Please try again.