Sha256: 0bf70dbd949161e6c08fb95528014b0062544fd07dd80617ed5794fd44f0bf6c

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 KB

Contents

#!/usr/bin/env ruby

require 'mkmf'
require 'fileutils'

include RbConfig
include FileUtils

ZSTD_VERSION = '1.5.2'
ZLIB_VERSION = '1.2.12'

RB_VERSION = CONFIG['MAJOR']+'.'+CONFIG['MINOR']
ZMOD_VERSION = RB_VERSION >= '2.3' ? '3.1' : RB_VERSION # Review requirements with every new zlib module release!

 # For cross compiling
ENV['CC'] = RbConfig::CONFIG['CC']
ENV['LD'] = RbConfig::CONFIG['LD']

root = File.dirname(__FILE__)

zmod = File.expand_path "ruby/zlib-#{ZMOD_VERSION}", root
zlib = File.expand_path "zlib-#{ZLIB_VERSION}", root
zstd = File.expand_path "zstd-#{ZSTD_VERSION}/lib", root
zlibwrapper = File.expand_path "zstd-#{ZSTD_VERSION}/zlibWrapper", root

cp "#{zmod}/zstdlib.c", 'zstdlib.c'

$srcs = ['zstdlib.c']

$CFLAGS += ' -fomit-frame-pointer -ffast-math -O3'
$CPPFLAGS += " -I#{zlib} -I#{zlibwrapper} -I#{zstd} -DZWRAP_USE_ZSTD=1 -DGZIP_SUPPORT=1"
$LDFLAGS += ' -s'
$LOCAL_LIBS += ' libzlibwrapper.a libz.a libzstd.a'

create_makefile('zstdlib_c')

File.open('Makefile', 'a') do |file|
file << %~

export CC LD AR CFLAGS CPPFLAGS

$(DLLIB) : libz.a libzstd.a libzlibwrapper.a

libzstd.a :
\texport SRCDIR=#{zstd} && mkdir -p zstd && $(MAKE) -C zstd -f #{File.expand_path root}/zstd.mk

libz.a :
\texport SRCDIR=#{zlib} && mkdir -p zlib && $(MAKE) -C zlib -f #{File.expand_path root}/zlib.mk

libzlibwrapper.a :
\texport SRCDIR=#{zlibwrapper} && mkdir -p zlibwrapper && $(MAKE) -C zlibwrapper -f #{File.expand_path root}/zlibwrapper.mk

~
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zstdlib-0.10.0-x86-mingw32 ext/zstdlib_c/extconf.rb
zstdlib-0.10.0-x86_64-darwin ext/zstdlib_c/extconf.rb
zstdlib-0.10.0-x64-mingw-ucrt ext/zstdlib_c/extconf.rb
zstdlib-0.10.0-x64-mingw32 ext/zstdlib_c/extconf.rb
zstdlib-0.10.0 ext/zstdlib_c/extconf.rb
zstdlib-0.10.0-arm64-darwin ext/zstdlib_c/extconf.rb