diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-03-31 19:29:24 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-03-31 21:34:48 +0900 |
commit | af2ab0dd1c899356d9ec38b052f0df0706efb8f9 (patch) | |
tree | 30575c0635a9fde722ea6cc80c78ab32ab90b7c4 /ext/psych/extconf.rb | |
parent | 834c3b35455ed50c7ad879b3e2f807eaa9b0a328 (diff) | |
download | ruby-af2ab0dd1c899356d9ec38b052f0df0706efb8f9.tar.gz |
[ruby/psych] Make a static library from PIC object files
On some platforms, PIC and non-PIC code are incompatible and the
latter cannot be used for shared objects.
https://github.com/ruby/psych/commit/5652e32733
Diffstat (limited to 'ext/psych/extconf.rb')
-rw-r--r-- | ext/psych/extconf.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index f7e610ce88..54aa730f44 100644 --- a/ext/psych/extconf.rb +++ b/ext/psych/extconf.rb @@ -39,8 +39,9 @@ if yaml_source puts("Configuring libyaml source in #{yaml_source.quote}") yaml = "libyaml" Dir.mkdir(yaml) unless File.directory?(yaml) + shared = $enable_shared || !$static unless system(yaml_configure, "-q", - "--enable-#{$enable_shared || !$static ? 'shared' : 'static'}", + "--enable-#{shared ? 'shared' : 'static'}", "--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-')}", *(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"), chdir: yaml) @@ -50,12 +51,16 @@ if yaml_source inc = yaml_source.start_with?("#$srcdir/") ? "$(srcdir)#{yaml_source[$srcdir.size..-1]}" : yaml_source $INCFLAGS << " -I#{yaml}/include -I#{inc}/include" Logging.message("INCLFAG=#$INCLFAG\n") - libyaml = "#{yaml}/src/.libs/libyaml.#$LIBEXT" + libyaml = "libyaml.#$LIBEXT" + $cleanfiles << libyaml $LOCAL_LIBS.prepend("$(LIBYAML) ") end create_makefile 'psych' do |mk| mk << "LIBYAML = #{libyaml}".strip << "\n" + mk << "LIBYAML_OBJDIR = libyaml/src#{shared ? '/.libs' : ''}\n" + mk << "OBJEXT = #$OBJEXT" + mk << "RANLIB = #{config_string('RANLIB') || config_string('NULLCMD')}\n" end # :startdoc: |