Sha256: 0e24433f41dc3a1b0cdd8958c1f81fa51e45a3b257ee1208f27395f8fb44c844

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

# encoding: utf-8
# Install the xapian binaries into the lib folder of the gem
require 'rbconfig'

c = RbConfig::CONFIG

def system!(cmd)
  puts cmd
  system(cmd) or raise
end

source_dir = 'xapian_source'
core = "xapian-core"
bindings = "xapian-bindings"
xapian_config = "#{Dir.pwd}/#{core}/xapian-config"

task :default do
  [core, bindings].each do |x|
    system! "tar -xJf #{source_dir}/#{x}.tar.xz"
  end

  prefix = Dir.pwd
  ENV['LDFLAGS'] = "-L#{prefix}/lib"
  ENV['CXXFLAGS'] = "-fms-extensions"

  system! "mkdir -p lib"

  Dir.chdir core do
    system! 'sed -i".bak" -e "s/darwin\\[91\\]/darwin[912]/g" configure'
    system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --enable-64bit-docid --enable-64bit-termcount --enable-64bit-termpos --disable-documentation"
    system! "make"
    system! "cp -r .libs/* ../lib/"
  end

  Dir.chdir bindings do
    system! 'sed -i".bak" -e "s/darwin\\[91\\]/darwin[912]/g" configure'
    ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}"
    ENV['XAPIAN_CONFIG'] = xapian_config
    system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby --disable-documentation"
    system! "make"
  end

  system! "cp -r #{bindings}/ruby/.libs/_xapian.* lib"
  system! "cp #{bindings}/ruby/xapian.rb lib"

  system! "rm lib/*.a"
  system! "rm lib/*.la"
  system! "rm lib/*.lai"

  system! "rm -R #{bindings}"
  system! "rm -R #{core}"
  system! "rm -R #{source_dir}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy_xapian-ruby-1.5.1 Rakefile
easy_xapian-ruby-1.5.0 Rakefile