le0pard/zopfli-ffi

View on GitHub
ext/zopfli_ffi/Rakefile

Summary

Maintainability
Test Coverage
require 'ffi-compiler/compile_task'

FFI::Compiler::CompileTask.new('zopfli_ffi') do |c|
  c.have_header?('stdio.h', '/usr/local/include')
  c.have_func?('puts')
  c.have_library?('z')
  # zopfli
  c.have_header?('zopfli.h', '/usr/local/include')
  c.have_func?('ZopfliInitOptions')
  c.have_func?('ZopfliCompress')
  c.have_library?('zopfli')
  # compiler flags
  if c.platform.mac?
    c.cflags << "-arch x86_64"
    c.ldflags << "-arch x86_64"
  end
  c.ldflags << ENV['LD_FLAGS'] if ENV['LD_FLAGS']
  c.cflags << ENV['C_FLAGS'] if ENV['C_FLAGS']
end