mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
install extra libraries
* ext/extmk.rb (extract_makefile, extmake, configuration): store extra libraries to be installed. * tool/rbinstall.rb (ext-arch): install extra libraries. * ext/zlib/extconf.rb: install zlib if built. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3778f2f3d5
commit
97a016ac8a
4 changed files with 48 additions and 11 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Sat Sep 24 22:26:20 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb (extract_makefile, extmake, configuration): store
|
||||||
|
extra libraries to be installed.
|
||||||
|
|
||||||
|
* tool/rbinstall.rb (ext-arch): install extra libraries.
|
||||||
|
|
||||||
|
* ext/zlib/extconf.rb: install zlib if built.
|
||||||
|
|
||||||
Sat Sep 24 14:24:55 2016 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
Sat Sep 24 14:24:55 2016 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* spec/README: update URL.
|
* spec/README: update URL.
|
||||||
|
|
13
ext/extmk.rb
13
ext/extmk.rb
|
@ -81,6 +81,7 @@ def extract_makefile(makefile, keep = true)
|
||||||
m = File.read(makefile)
|
m = File.read(makefile)
|
||||||
s = m[/^CLEANFILES[ \t]*=[ \t](.*)/, 1] and $cleanfiles = s.split
|
s = m[/^CLEANFILES[ \t]*=[ \t](.*)/, 1] and $cleanfiles = s.split
|
||||||
s = m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] and $distcleanfiles = s.split
|
s = m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] and $distcleanfiles = s.split
|
||||||
|
s = m[/^EXTSO[ \t]*=[ \t](.*)/, 1] and $extso = s.split
|
||||||
if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
|
if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
|
||||||
return keep
|
return keep
|
||||||
end
|
end
|
||||||
|
@ -165,6 +166,7 @@ def extmake(target, basedir = (maybestatic = 'ext'))
|
||||||
$preload = nil
|
$preload = nil
|
||||||
$objs = []
|
$objs = []
|
||||||
$srcs = []
|
$srcs = []
|
||||||
|
$extso = []
|
||||||
$compiled[target] = false
|
$compiled[target] = false
|
||||||
makefile = "./Makefile"
|
makefile = "./Makefile"
|
||||||
static = $static
|
static = $static
|
||||||
|
@ -552,6 +554,10 @@ extend Module.new {
|
||||||
def timestamp_file(name, target_prefix = nil)
|
def timestamp_file(name, target_prefix = nil)
|
||||||
super.sub(%r[/\.extout\.(?:-\.)?], '/.')
|
super.sub(%r[/\.extout\.(?:-\.)?], '/.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def configuration(srcdir)
|
||||||
|
super << "EXTSO #{['=', $extso].join(' ')}\n"
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = Dir.pwd
|
dir = Dir.pwd
|
||||||
|
@ -560,12 +566,14 @@ Dir::chdir('ext')
|
||||||
|
|
||||||
hdrdir = $hdrdir
|
hdrdir = $hdrdir
|
||||||
$hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include"
|
$hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include"
|
||||||
|
extso = []
|
||||||
fails = []
|
fails = []
|
||||||
exts.each do |d|
|
exts.each do |d|
|
||||||
$static = $force_static ? true : $static_ext[d]
|
$static = $force_static ? true : $static_ext[d]
|
||||||
|
|
||||||
if $ignore or !$nodynamic or $static
|
if $ignore or !$nodynamic or $static
|
||||||
result = extmake(d) or abort
|
result = extmake(d) or abort
|
||||||
|
extso |= $extso
|
||||||
fails << result unless result == true
|
fails << result unless result == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -608,6 +616,7 @@ gems.each do |d|
|
||||||
$extout = extout.dup
|
$extout = extout.dup
|
||||||
@gemname = d[%r{\A[^/]+}]
|
@gemname = d[%r{\A[^/]+}]
|
||||||
extmake(d, 'gems')
|
extmake(d, 'gems')
|
||||||
|
extso |= $extso
|
||||||
end
|
end
|
||||||
$extout = extout
|
$extout = extout
|
||||||
Dir.chdir('../ext')
|
Dir.chdir('../ext')
|
||||||
|
@ -745,6 +754,7 @@ if $configure_only and $command_output
|
||||||
mf.macro "gems", gems
|
mf.macro "gems", gems
|
||||||
mf.macro "EXTOBJS", $extlist.empty? ? ["dmyext.#{$OBJEXT}"] : ["ext/extinit.#{$OBJEXT}", *$extobjs]
|
mf.macro "EXTOBJS", $extlist.empty? ? ["dmyext.#{$OBJEXT}"] : ["ext/extinit.#{$OBJEXT}", *$extobjs]
|
||||||
mf.macro "EXTLIBS", $extlibs
|
mf.macro "EXTLIBS", $extlibs
|
||||||
|
mf.macro "EXTSO", extso
|
||||||
mf.macro "EXTLDFLAGS", $extflags.split
|
mf.macro "EXTLDFLAGS", $extflags.split
|
||||||
submakeopts = []
|
submakeopts = []
|
||||||
if enable_config("shared", $enable_shared)
|
if enable_config("shared", $enable_shared)
|
||||||
|
@ -797,6 +807,9 @@ if $configure_only and $command_output
|
||||||
mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
|
mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
mf.puts "\n""extso:\n"
|
||||||
|
mf.puts "\t@echo EXTSO=$(EXTSO)"
|
||||||
|
|
||||||
mf.puts "\n""note:\n"
|
mf.puts "\n""note:\n"
|
||||||
unless fails.empty?
|
unless fails.empty?
|
||||||
mf.puts %Q<\t@echo "*** Following extensions failed to configure:">
|
mf.puts %Q<\t@echo "*** Following extensions failed to configure:">
|
||||||
|
|
|
@ -21,11 +21,27 @@ else
|
||||||
zsrc = dirs.max_by {|x| x.scan(/\d+/).map(&:to_i)}
|
zsrc = dirs.max_by {|x| x.scan(/\d+/).map(&:to_i)}
|
||||||
end
|
end
|
||||||
if zsrc
|
if zsrc
|
||||||
|
addconf = [
|
||||||
|
"ZSRC = $(srcdir)/#{File.basename(zsrc)}\n",
|
||||||
|
"all:\n",
|
||||||
|
]
|
||||||
$INCFLAGS << " -I$(ZSRC)"
|
$INCFLAGS << " -I$(ZSRC)"
|
||||||
if $mswin or $mingw
|
if $mswin or $mingw
|
||||||
$libs = append_library($libs, "zdll")
|
$libs = append_library($libs, "zdll")
|
||||||
dll = "zlib1.dll"
|
dll = "zlib1.dll"
|
||||||
|
$extso << dll
|
||||||
|
addconf.push(
|
||||||
|
"ZIMPLIB = zdll.lib\n",
|
||||||
|
"$(TARGET_SO): $(ZIMPLIB)\n",
|
||||||
|
"$(ZIMPLIB):\n",
|
||||||
|
"\t$(MAKE) -f $(ZSRC)/win32/Makefile.#{$nmake ? 'msc' : 'gcc'} TOP=$(ZSRC) $@\n",
|
||||||
|
"install-so: $(topdir)/#{dll}",
|
||||||
|
"$(topdir)/#{dll}: $(ZIMPLIB)\n",
|
||||||
|
"\t$(Q) $(COPY) #{dll} $(@D)\n",
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
Logging.message "using zlib in #{zsrc}\n"
|
||||||
|
$defs << "-DHAVE_ZLIB_H"
|
||||||
have_zlib = true
|
have_zlib = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -82,17 +98,7 @@ if have_zlib
|
||||||
|
|
||||||
create_makefile('zlib') {|conf|
|
create_makefile('zlib') {|conf|
|
||||||
if zsrc
|
if zsrc
|
||||||
conf << "ZSRC = $(srcdir)/#{File.basename(zsrc)}\n"
|
conf.concat addconf if addconf
|
||||||
conf << "all:\n"
|
|
||||||
if $mingw or $mswin
|
|
||||||
conf << "ZIMPLIB = zdll.lib\n"
|
|
||||||
conf << "$(TARGET_SO): $(ZIMPLIB)\n"
|
|
||||||
conf << "$(ZIMPLIB):\n"
|
|
||||||
conf << "\t$(MAKE) -f $(ZSRC)/win32/Makefile.#{$nmake ? 'msc' : 'gcc'} TOP=$(ZSRC) $@\n"
|
|
||||||
conf << "install-so: $(topdir)/#{dll}"
|
|
||||||
conf << "$(topdir)/#{dll}: $(ZIMPLIB)\n"
|
|
||||||
conf << "\t$(Q) $(COPY) #{dll} $(@D)\n"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,6 +389,15 @@ install?(:ext, :arch, :'ext-arch') do
|
||||||
install_recursive("#{$extout}/#{CONFIG['arch']}", archlibdir, :no_install => noinst, :mode => $prog_mode, :strip => $strip)
|
install_recursive("#{$extout}/#{CONFIG['arch']}", archlibdir, :no_install => noinst, :mode => $prog_mode, :strip => $strip)
|
||||||
prepare "extension objects", sitearchlibdir
|
prepare "extension objects", sitearchlibdir
|
||||||
prepare "extension objects", vendorarchlibdir
|
prepare "extension objects", vendorarchlibdir
|
||||||
|
if extso = File.read("exts.mk")[/^EXTSO[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1] and
|
||||||
|
!(extso = extso.gsub(/\\\n/, '').split).empty?
|
||||||
|
libpathenv = CONFIG["LIBPATHENV"]
|
||||||
|
dest = CONFIG[!libpathenv || libpathenv == "PATH" ? "bindir" : "libdir"]
|
||||||
|
prepare "external libraries", dest
|
||||||
|
for file in extso
|
||||||
|
install file, dest, :mode => $prog_mode
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
install?(:ext, :arch, :hdr, :'arch-hdr') do
|
install?(:ext, :arch, :hdr, :'arch-hdr') do
|
||||||
prepare "extension headers", archhdrdir
|
prepare "extension headers", archhdrdir
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue