mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
zlib: try zlib source
* ext/zlib/extconf.rb: try building zlib from the source if exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
958c04898c
commit
21255071d8
1 changed files with 33 additions and 1 deletions
|
@ -13,7 +13,24 @@ dir_config 'zlib'
|
|||
|
||||
if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and
|
||||
have_header('zlib.h') then
|
||||
have_zlib = true
|
||||
else
|
||||
unless File.directory?(zsrc = "#{$srcdir}/zlib")
|
||||
dirs = Dir.open($srcdir) {|z| z.grep(/\Azlib-\d+[.\d]*\z/) {|x|"#{$srcdir}/#{x}"}}
|
||||
dirs.delete_if {|x| !File.directory?(x)}
|
||||
zsrc = dirs.max_by {|x| x.scan(/\d+/).map(&:to_i)}
|
||||
end
|
||||
if zsrc
|
||||
$INCFLAGS << " -I$(ZSRC)"
|
||||
if $mswin or $mingw
|
||||
$libs = append_library($libs, "zdll")
|
||||
dll = "zlib1.dll"
|
||||
end
|
||||
have_zlib = true
|
||||
end
|
||||
end
|
||||
|
||||
if have_zlib
|
||||
defines = []
|
||||
|
||||
Logging::message 'checking for kind of operating system... '
|
||||
|
@ -57,6 +74,21 @@ if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')
|
|||
have_func('adler32_combine', 'zlib.h')
|
||||
have_type('z_crc_t', 'zlib.h')
|
||||
|
||||
create_makefile('zlib')
|
||||
create_makefile('zlib') {|conf|
|
||||
if zsrc
|
||||
conf << "ZSRC = $(srcdir)/#{File.basename(zsrc)}\n"
|
||||
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} $(BINDIR)\n"
|
||||
end
|
||||
end
|
||||
conf
|
||||
}
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue