Sha256: 1a88873fa9eb079699af04610bd86f8bcab88dd3617eed97c2098eea690d4bf8

Contents?: true

Size: 1.3 KB

Versions: 12

Compression:

Stored size: 1.3 KB

Contents

require File.expand_path('../../lib/rdkafka/version', __FILE__)
require "mini_portile2"
require "fileutils"

task :default => :clean do
  # Download and compile librdkafka
  recipe = MiniPortile.new("librdkafka", Rdkafka::LIBRDKAFKA_VERSION)
  recipe.files = ["https://github.com/edenhill/librdkafka/archive/v#{Rdkafka::LIBRDKAFKA_VERSION}.tar.gz"]
  recipe.configure_options = ["--host=#{recipe.host}"]
  recipe.cook
  # Move dynamic library we're interested in
  if recipe.host.include?('darwin')
    from_extension = '1.dylib'
    to_extension   = 'dylib'
  else
    from_extension = 'so.1'
    to_extension = 'so'
  end
  lib_path = File.join(File.dirname(__FILE__), "ports/#{recipe.host}/librdkafka/#{Rdkafka::LIBRDKAFKA_VERSION}/lib/librdkafka.#{from_extension}")
  FileUtils.mv(lib_path, File.join(File.dirname(__FILE__), "librdkafka.#{to_extension}"))
  # Cleanup files created by miniportile we don't need in the gem
  FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
  FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
end

task :clean do
  FileUtils.rm_f File.join(File.dirname(__FILE__), "librdkafka.dylib")
  FileUtils.rm_f File.join(File.dirname(__FILE__), "librdkafka.so")
  FileUtils.rm_rf File.join(File.dirname(__FILE__), "ports")
  FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp")
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rdkafka-0.3.5 ext/Rakefile
rdkafka-0.3.4 ext/Rakefile
rdkafka-0.3.3 ext/Rakefile
rdkafka-0.3.2 ext/Rakefile
rdkafka-0.3.1 ext/Rakefile
rdkafka-0.3.0 ext/Rakefile
rdkafka-0.2.0 ext/Rakefile
rdkafka-0.1.11 ext/Rakefile
rdkafka-0.1.10 ext/Rakefile
rdkafka-0.1.9 ext/Rakefile
rdkafka-0.1.8 ext/Rakefile
rdkafka-0.1.7 ext/Rakefile