Sha256: 19c320388a3ca152ba9c953cc4c3df32f1fcaf8e78780c0aea1a219ec314ecf7

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

#!ruby
#vim: set fileencoding:utf-8

require "mkmf"

module MyExtensions
  refine Object do
    # ruby-2.3 から追加されたメソッドの確認と追加

    unless Object.method_defined?(:append_cppflags)
      def append_cppflags(flags)
        return false unless try_cppflags(flags)
        $CPPFLAGS << " #{flags}"
        true
      end
    end

    unless Object.method_defined?(:append_cflags)
      def append_cflags(flags)
        return false unless try_cflags(flags)
        $CFLAGS << " #{flags}"
        true
      end
    end

    unless Object.method_defined?(:append_ldflags)
      def append_ldflags(flags)
        return false unless try_ldflags(flags)
        $LDFLAGS << " #{flags}"
        true
      end
    end
  end
end

using MyExtensions


# TODO: システムにインストールされた lz4 がある場合、バージョンを確認してより新しければそちらを利用する

append_cppflags "-I$(srcdir)/../contrib/lz4/lib"

if RbConfig::CONFIG["arch"] =~ /mingw/
  append_ldflags "-static-libgcc"
else
  if try_compile(%q(__attribute__ ((visibility("default"))) void testfunc(void) { }))
    if append_cflags "-fvisibility=hidden"
      localsymbol = true
    end
  end
end

if localsymbol
  $defs << %q('-DRBEXT_API=__attribute__ ((visibility("default")))') <<
           %q(-DRBEXT_VISIBILITY=1)
else
  $defs << %q(-DRBEXT_API=)
end

create_makefile File.join(RUBY_VERSION[/\d+\.\d+/], "extlz4")

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
extlz4-0.3.4 ext/extconf.rb
extlz4-0.3.3 ext/extconf.rb
extlz4-0.3.2 ext/extconf.rb
extlz4-0.3.1 ext/extconf.rb
extlz4-0.3 ext/extconf.rb
extlz4-0.2.5 ext/extconf.rb
extlz4-0.2.4.3 ext/extconf.rb
extlz4-0.2.4.2 ext/extconf.rb