mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
This commit is contained in:
parent
834c3b3545
commit
af2ab0dd1c
2 changed files with 11 additions and 2 deletions
|
@ -2,8 +2,12 @@ $(TARGET_SO): $(LIBYAML)
|
||||||
|
|
||||||
libyaml $(LIBYAML):
|
libyaml $(LIBYAML):
|
||||||
cd libyaml && $(MAKE)
|
cd libyaml && $(MAKE)
|
||||||
|
$(AR) $(ARFLAGS) $(LIBYAML) $(LIBYAML_OBJDIR)/*.$(OBJEXT)
|
||||||
|
$(RANLIB) $(LIBYAML)
|
||||||
|
|
||||||
clean-so::
|
clean-so::
|
||||||
-cd libyaml && $(MAKE) clean
|
-cd libyaml && $(MAKE) clean
|
||||||
|
|
||||||
distclean-so::
|
distclean-so::
|
||||||
-cd libyaml && $(MAKE) distclean
|
-cd libyaml && $(MAKE) distclean
|
||||||
-$(Q)$(RMDIRS) libyaml/* libyaml
|
-$(Q)$(RMDIRS) libyaml/* libyaml
|
||||||
|
|
|
@ -39,8 +39,9 @@ if yaml_source
|
||||||
puts("Configuring libyaml source in #{yaml_source.quote}")
|
puts("Configuring libyaml source in #{yaml_source.quote}")
|
||||||
yaml = "libyaml"
|
yaml = "libyaml"
|
||||||
Dir.mkdir(yaml) unless File.directory?(yaml)
|
Dir.mkdir(yaml) unless File.directory?(yaml)
|
||||||
|
shared = $enable_shared || !$static
|
||||||
unless system(yaml_configure, "-q",
|
unless system(yaml_configure, "-q",
|
||||||
"--enable-#{$enable_shared || !$static ? 'shared' : 'static'}",
|
"--enable-#{shared ? 'shared' : 'static'}",
|
||||||
"--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-')}",
|
"--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-')}",
|
||||||
*(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"),
|
*(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"),
|
||||||
chdir: yaml)
|
chdir: yaml)
|
||||||
|
@ -50,12 +51,16 @@ if yaml_source
|
||||||
inc = yaml_source.start_with?("#$srcdir/") ? "$(srcdir)#{yaml_source[$srcdir.size..-1]}" : yaml_source
|
inc = yaml_source.start_with?("#$srcdir/") ? "$(srcdir)#{yaml_source[$srcdir.size..-1]}" : yaml_source
|
||||||
$INCFLAGS << " -I#{yaml}/include -I#{inc}/include"
|
$INCFLAGS << " -I#{yaml}/include -I#{inc}/include"
|
||||||
Logging.message("INCLFAG=#$INCLFAG\n")
|
Logging.message("INCLFAG=#$INCLFAG\n")
|
||||||
libyaml = "#{yaml}/src/.libs/libyaml.#$LIBEXT"
|
libyaml = "libyaml.#$LIBEXT"
|
||||||
|
$cleanfiles << libyaml
|
||||||
$LOCAL_LIBS.prepend("$(LIBYAML) ")
|
$LOCAL_LIBS.prepend("$(LIBYAML) ")
|
||||||
end
|
end
|
||||||
|
|
||||||
create_makefile 'psych' do |mk|
|
create_makefile 'psych' do |mk|
|
||||||
mk << "LIBYAML = #{libyaml}".strip << "\n"
|
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
|
end
|
||||||
|
|
||||||
# :startdoc:
|
# :startdoc:
|
||||||
|
|
Loading…
Reference in a new issue