From a1c2758e2f74252ecf718fa326f1060822c4e142 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 1 Mar 2014 01:03:03 +0000 Subject: build: attempt to fix --with-static-ext Most warnings are suppressed and dependencies fixed. However, loading the mathn/complex and mathn/rational extensions means we cannot pass tests. --- ext/extmk.rb | 15 +++++++++++++-- ext/openssl/extconf.rb | 1 + ext/psych/extconf.rb | 1 + load.c | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ext/extmk.rb b/ext/extmk.rb index ef9afa0676..1e6ba177c0 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -250,7 +250,9 @@ def extmake(target) end if $static and ok and !$objs.empty? and !noinstall args += ["static"] unless $clean - $extlist.push [$static, target, $target, $preload] + feature_rb = "#$srcdir/lib/#{target}.rb" + postload = File.exist?(feature_rb) + $extlist.push [$static, target, $target, $preload, postload] end FileUtils.rm_f(old_cleanfiles - $distcleanfiles) FileUtils.rm_f(old_objs - $objs) @@ -556,7 +558,7 @@ unless $extlist.empty? list = $extlist.dup built = [] while e = list.shift - _, target, feature, required = e + _, target, feature, required, postload = e if required and !(required -= built).empty? l = list.size if (while l > 0; break true if required.include?(list[l-=1][1]) end) @@ -566,6 +568,15 @@ unless $extlist.empty? end base = File.basename(feature) $extinit << " init(Init_#{base}, \"#{feature}.so\");\n" + if postload + case feature + when "dl" # special case for deprecated libs + else + $extinit << " rb_require(\"#{feature}\");\n" + end + else + $extinit << " rb_provide(\"#{feature}\");\n" + end $extobjs << format("ext/%s/%s.%s", target, base, $LIBEXT) built << target end diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index e272cba092..e156a9a963 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -17,6 +17,7 @@ require "mkmf" require File.expand_path('../deprecation', __FILE__) +$preload = %w[stringio.so] dir_config("openssl") dir_config("kerberos") diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index 65e83a3554..1ff8ddb9ba 100644 --- a/ext/psych/extconf.rb +++ b/ext/psych/extconf.rb @@ -1,6 +1,7 @@ # -*- coding: us-ascii -*- require 'mkmf' require 'fileutils' +$preload = %w[stringio.so] # :stopdoc: diff --git a/load.c b/load.c index 811d03511f..e88abfbb0c 100644 --- a/load.c +++ b/load.c @@ -1059,10 +1059,13 @@ ruby_init_ext(const char *name, void (*init)(void)) { st_table *loading_tbl = get_loading_table(); + if (rb_provided(name)) + return; if (!loading_tbl) { GET_VM()->loading_table = loading_tbl = st_init_strtable(); } st_update(loading_tbl, (st_data_t)name, register_init_ext, (st_data_t)init); + rb_provide(name); } /* -- cgit v1.2.3-24-ge0c7