diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-03-31 21:34:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 21:34:34 +0900 |
commit | bf9908d1698a8c485ee3715f65dd3bbeb5a3c487 (patch) | |
tree | 2fbc49161c8a6b61003b8c229ec06181a8c146e8 | |
parent | ecb6b964f6e6339417908e6b4b7838f2e507ab41 (diff) | |
parent | 5652e32733172c8dd15634859562606dd88309a3 (diff) | |
download | psych-bf9908d1698a8c485ee3715f65dd3bbeb5a3c487.tar.gz |
Merge pull request #554 from nobu/link-pic-objects
Make a static library from PIC object files
-rw-r--r-- | ext/psych/depend | 4 | ||||
-rw-r--r-- | ext/psych/extconf.rb | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/psych/depend b/ext/psych/depend index 4a2ed3f..d0cb1c2 100644 --- a/ext/psych/depend +++ b/ext/psych/depend @@ -2,8 +2,12 @@ $(TARGET_SO): $(LIBYAML) libyaml $(LIBYAML): cd libyaml && $(MAKE) + $(AR) $(ARFLAGS) $(LIBYAML) $(LIBYAML_OBJDIR)/*.$(OBJEXT) + $(RANLIB) $(LIBYAML) + clean-so:: -cd libyaml && $(MAKE) clean + distclean-so:: -cd libyaml && $(MAKE) distclean -$(Q)$(RMDIRS) libyaml/* libyaml diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index f7e610c..54aa730 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: |