at 18.09-beta 886 B view raw
1# encoding: utf-8 2# Install the xapian binaries into the lib folder of the gem 3require 'rbconfig' 4 5c = RbConfig::CONFIG 6 7def system!(cmd) 8 puts cmd 9 system(cmd) or raise 10end 11 12source_dir = 'xapian_source' 13bindings = Dir["#{source_dir}/xapian-bindings-*"].first 14bindings = File.basename(bindings, ".tar.xz") 15 16task :default do 17 system! "tar -xJf #{source_dir}/#{bindings}.tar.xz" 18 19 prefix = Dir.pwd 20 ENV['LDFLAGS'] = "-L#{prefix}/lib" 21 22 system! "mkdir -p lib" 23 24 Dir.chdir bindings do 25 ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}" 26 system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby" 27 system! "make clean all" 28 end 29 30 system! "cp -r #{bindings}/ruby/.libs/_xapian.* lib" 31 system! "cp #{bindings}/ruby/xapian.rb lib" 32 33 system! "rm lib/*.la" 34 system! "rm lib/*.lai" 35 36 system! "rm -R #{bindings}" 37 system! "rm -R #{source_dir}" 38end