Link with system-provided libzstd. skippable frames are experimental feature that is available only for static linking, so we have to remove it. --- a/ext/zstdruby/common.h +++ b/ext/zstdruby/common.h @@ -6,7 +6,7 @@ #include #endif #include -#include "./libzstd/zstd.h" +#include static int convert_compression_level(VALUE compression_level_value) { --- a/ext/zstdruby/extconf.rb +++ b/ext/zstdruby/extconf.rb @@ -2,24 +2,12 @@ have_func('rb_gc_mark_movable') -$CFLAGS = '-I. -O3 -std=c99 -DZSTD_STATIC_LINKING_ONLY -DZSTD_MULTITHREAD -pthread -DDEBUGLEVEL=0' -$CPPFLAGS += " -fdeclspec" if CONFIG['CXX'] =~ /clang/ +pkg_config("libzstd") -Dir.chdir File.expand_path('..', __FILE__) do - $srcs = Dir['**/*.c', '**/*.S'] - - Dir.glob('libzstd/*') do |path| - if Dir.exist?(path) - $VPATH << "$(srcdir)/#{path}" - $INCFLAGS << " -I$(srcdir)/#{path}" - end - end - -end - # add include path to the internal folder # $(srcdir) is a root folder, where "extconf.rb" is stored -$INCFLAGS << " -I$(srcdir) -I$(srcdir)/libzstd" +$INCFLAGS << " -I$(srcdir)" + # add folder, where compiler can search source files $VPATH << "$(srcdir)" --- a/ext/zstdruby/main.c +++ b/ext/zstdruby/main.c @@ -2,7 +2,6 @@ VALUE rb_mZstd; void zstd_ruby_init(void); -void zstd_ruby_skippable_frame_init(void); void zstd_ruby_streaming_compress_init(void); void zstd_ruby_streaming_decompress_init(void); @@ -15,7 +14,6 @@ rb_mZstd = rb_define_module("Zstd"); zstd_ruby_init(); - zstd_ruby_skippable_frame_init(); zstd_ruby_streaming_compress_init(); zstd_ruby_streaming_decompress_init(); } --- a/spec/zstd-ruby_spec.rb +++ b/spec/zstd-ruby_spec.rb @@ -13,6 +13,7 @@ describe 'zstd_version' do it 'should work' do + skip 'do not require specific zstd version' # XXX-Patch expect(Zstd.zstd_version).to eq(10506) end end