require 'rbconfig' c = Config::CONFIG def system!(cmd) puts cmd system(cmd) or raise end ver = '1.2.19' core = "xapian-core-#{ver}" bindings = "xapian-bindings-#{ver}" xapian_config = "#{Dir.pwd}/#{core}/xapian-config" task :default do [core,bindings].each do |x| system! "tar -xzvf #{x}.tar.xz" end prefix = File.dirname(Dir.pwd) puts "prefix = #{prefix}" #ENV['LDFLAGS'] = "-R#{prefix}/lib" Dir.chdir core do system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix}" system! "make clean all install" # Alternatively to only install libraries # system! "cp -r .libs/* ../lib/" end Dir.chdir bindings do ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}" ENV['XAPIAN_CONFIG'] = xapian_config system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby" system! "make clean all" system! "cp -LR ./ruby/.libs/_xapian.* #{prefix}/lib" system! "cp ./ruby/xapian.rb #{prefix}/lib" end end