ruby-changes:23658
From: nobu <ko1@a...>
Date: Sat, 19 May 2012 11:38:17 +0900 (JST)
Subject: [ruby-changes:23658] nobu:r35709 (trunk): static-linked-ext: into libruby
nobu 2012-05-19 11:37:21 +0900 (Sat, 19 May 2012) New Revision: 35709 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35709 Log: static-linked-ext: into libruby * Makefile.in, common.mk (PROGRAM): no extension libraries. * common.mk (build-ext): pass macros for libruby.so. * ext/extmk.rb (command_output): link extension libraries and encoding libraries into libruby.so, not ruby executable. Modified files: trunk/ChangeLog trunk/Makefile.in trunk/common.mk trunk/ext/extmk.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 35708) +++ ChangeLog (revision 35709) @@ -1,5 +1,12 @@ -Sat May 19 11:36:22 2012 Nobuyoshi Nakada <nobu@r...> +Sat May 19 11:37:18 2012 Nobuyoshi Nakada <nobu@r...> + * Makefile.in, common.mk (PROGRAM): no extension libraries. + + * common.mk (build-ext): pass macros for libruby.so. + + * ext/extmk.rb (command_output): link extension libraries and encoding + libraries into libruby.so, not ruby executable. + * ext/extmk.rb (command_output): fold long macro lines. * Makefile.in (LIBEXT): add macro. Index: common.mk =================================================================== --- common.mk (revision 35708) +++ common.mk (revision 35709) @@ -32,6 +32,7 @@ DMYEXT = dmyext.$(OBJEXT) NORMALMAINOBJ = main.$(OBJEXT) MAINOBJ = $(NORMALMAINOBJ) +EXTOBJS = DLDOBJS = $(DMYEXT) MINIOBJS = $(ARCHMINIOBJS) dmyencoding.$(OBJEXT) dmyversion.$(OBJEXT) miniprelude.$(OBJEXT) ENC_MK = enc.mk @@ -173,7 +174,7 @@ configure-ext: $(EXTS_MK) build-ext: $(EXTS_MK) - $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) $(EXTSTATIC) + $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) $(EXTSTATIC) LIBRUBY_EXTS=$(LIBRUBY_EXTS) ENCOBJS="$(ENCOBJS)" $(MKMAIN_CMD): $(MKFILES) incs $(PREP) $(RBCONFIG) $(LIBRUBY) $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$@ $(EXTMK_ARGS) @@ -206,7 +207,7 @@ program: showflags $(PROGRAM) wprogram: showflags $(WPROGRAM) -$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(ENCOBJS) $(SETUP) $(PREP) +$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP) $(LIBRUBY_A): $(OBJS) $(MAINOBJ) $(DMYEXT) $(ARCHFILE) Index: Makefile.in =================================================================== --- Makefile.in (revision 35708) +++ Makefile.in (revision 35709) @@ -181,7 +181,7 @@ $(PROGRAM): @$(RM) $@ $(ECHO) linking $@ - $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(ENCOBJS) $(LIBRUBYARG) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@ + $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@ $(Q) $(POSTLINK) # We must `rm' the library each time this rule is invoked because "updating" a Index: ext/extmk.rb =================================================================== --- ext/extmk.rb (revision 35708) +++ ext/extmk.rb (revision 35709) @@ -654,16 +654,22 @@ end mf.puts mf.puts "all: #{rubies.join(' ')}" - mf.puts "static: ext/extinit.#{$OBJEXT} #{rubies.join(' ')}" + mf.puts "static: #{rubies.join(' ')}" mf.puts "clean:\n\t-$(Q)$(RM) ext/extinit.#{$OBJEXT}" mf.puts "distclean:\n\t-$(Q)$(RM) ext/extinit.c" mf.puts mf.puts "#{rubies.join(' ')}: $(extensions:/.=/#{$force_static ? 'static' : 'all'})" rubies.each do |tgt| mf.print "#{tgt}:\n\t$(Q)$(MAKE) " - mf.puts '$(MFLAGS) EXTOBJS="$(EXTOBJS)" EXTLIBS="$(EXTLIBS)" EXTLDFLAGS="$(EXTLDFLAGS)" $@' + mf.print "$(MFLAGS) " + if enable_config("shared", $enable_shared) + mf.print %[DLDOBJS="$(EXTOBJS)" SOLIBS="$(ENCOBJS) $(EXTLIBS)" ] + mf.print 'LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS) ' + else + mf.print %[EXTOBJS="$(EXTOBJS)" EXTLIBS="$(EXTLIBS)" ] + end + mf.puts 'EXTLDFLAGS="$(EXTLDFLAGS)" $@' end - mf.puts "ext/extinit.#{$OBJEXT}:\n\t$(Q)$(MAKE) $(MFLAGS) V=$(V) $@" mf.puts exec = config_string("exec") {|str| str + " "} targets.each do |tgt| -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/