depot/third_party/nixpkgs/pkgs/development/ruby-modules/gem-config/xapian-Rakefile
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

33 lines
780 B
Text

# encoding: utf-8
# Install the xapian binaries into the lib folder of the gem
require 'rbconfig'
c = RbConfig::CONFIG
source_dir = 'xapian_source'
bindings = Dir["#{source_dir}/xapian-bindings-*"].first
bindings = File.basename(bindings, ".tar.xz")
task :default do
sh "tar -xJf #{source_dir}/#{bindings}.tar.xz"
prefix = Dir.pwd
ENV['LDFLAGS'] = "-L#{prefix}/lib"
sh "mkdir -p lib"
Dir.chdir bindings do
ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}"
sh "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby"
sh "make clean all"
end
sh "cp -r #{bindings}/ruby/.libs/_xapian.* lib"
sh "cp #{bindings}/ruby/xapian.rb lib"
sh "rm lib/*.la"
sh "rm lib/*.lai"
sh "rm -R #{bindings}"
sh "rm -R #{source_dir}"
end