summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-22 12:50:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-22 12:50:36 +0000
commit78b95b49f8715a4782f5b9bdc4c163e445cdc303 (patch)
tree2663d78a4c0516cb6533267a248e40f4b1a6af9c /ext
parent709a60f92d1f922211c7f9e0c8a3f72a23bf8d11 (diff)
template/extinit.c.tmpl
* template/extinit.c.tmpl: separate from ext/extmk.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rwxr-xr-xext/extmk.rb25
1 files changed, 4 insertions, 21 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb
index dc6bd04945..486712af47 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -11,7 +11,6 @@ $destdir = nil
$dryrun = false
$clean = nil
$nodynamic = nil
-$extinit = nil
$extobjs = []
$extflags = ""
$extlibs = nil
@@ -642,13 +641,12 @@ if $ignore
exit
end
-$extinit ||= ""
$extobjs ||= []
$extpath ||= []
$extflags ||= ""
$extlibs ||= []
+extinits = {}
unless $extlist.empty?
- $extinit << "\n" unless $extinit.empty?
list = $extlist.dup
built = []
while e = list.shift
@@ -662,27 +660,11 @@ unless $extlist.empty?
next
end
base = File.basename(feature)
- $extinit << " init(Init_#{base}, \"#{feature}.so\");\n"
+ extinits[base] = feature
$extobjs << format("ext/%s/%s.%s", target, base, $LIBEXT)
built << target
end
- src = %{\
-#include "ruby/ruby.h"
-
-#define init(func, name) { \\
- extern void func(void); \\
- ruby_init_ext(name, func); \\
-}
-
-void ruby_init_ext(const char *name, void (*init)(void));
-
-void Init_ext(void)\n{\n#$extinit}
-}
- if !modified?(extinit.c, MTIMES) || IO.read(extinit.c) != src
- open(extinit.c, "w") {|fe| fe.print src}
- end
-
$extpath.delete("$(topdir)")
$extflags = libpathflag($extpath) << " " << $extflags.strip
conf = [
@@ -749,6 +731,7 @@ if $configure_only and $command_output
mf.macro "EXTLIBS", $extlibs
mf.macro "EXTSO", extso
mf.macro "EXTLDFLAGS", $extflags.split
+ mf.macro "EXTINITS", extinits.map {|k, v| "#{k},#{v}"}
submakeopts = []
if enable_config("shared", $enable_shared)
submakeopts << 'DLDOBJS="$(EXTOBJS) $(EXTENCS)"'
@@ -785,7 +768,7 @@ if $configure_only and $command_output
mf.puts "#{tgt}:\n\t#{submake} $@"
end
mf.puts "libencs:\n\t$(Q)$(MAKE) -f enc.mk V=$(V) $@"
- mf.puts "ext/extinit.#{$OBJEXT}:\n\t$(Q)$(MAKE) $(MFLAGS) V=$(V) $@" if $static
+ mf.puts "ext/extinit.#{$OBJEXT}:\n\t$(Q)$(MAKE) $(MFLAGS) V=$(V) EXTINITS=\"$(EXTINITS)\" $@" if $static
mf.puts
if $gnumake == "yes"
submake = "$(MAKE) -C $(@D)"