homebrew-core/Formula/xapian.rb

88 lines
2.2 KiB
Ruby
Raw Normal View History

require 'formula'
2011-03-10 05:11:03 +00:00
class XapianBindings < Formula
homepage 'http://xapian.org'
url 'http://oligarchy.co.uk/xapian/1.2.7/xapian-bindings-1.2.7.tar.gz'
sha1 '79e9f0b01f1af3440d10d00469dbe248784ffa1c'
end
2011-03-10 05:11:03 +00:00
class Xapian < Formula
homepage 'http://xapian.org'
url 'http://oligarchy.co.uk/xapian/1.2.7/xapian-core-1.2.7.tar.gz'
sha1 'c6c5c5b14d5d64481858ac2b181429a9b8bdc9a1'
def options
[
["--ruby", "Ruby bindings"],
["--python", "Python bindings"],
["--php", "PHP bindings"],
["--java", "Java bindings"],
]
end
def skip_clean? path
path.extname == '.la'
end
2010-05-18 03:41:51 +00:00
def build_any_bindings?
ARGV.include? '--ruby' or ARGV.include? '--python' or ARGV.include? '--java' or ARGV.include? '--php'
end
def arg_for_lang lang
(ARGV.include? "--#{lang}") ? "--with-#{lang}" : "--without-#{lang}"
end
def install
system "./configure", "--prefix=#{prefix}", "--disable-assertions",
"--disable-dependency-tracking"
system "make install"
return unless build_any_bindings?
XapianBindings.new.brew do
args = [
"XAPIAN_CONFIG=#{bin}/xapian-config",
"--prefix=#{prefix}",
"--disable-debug",
"--disable-dependency-tracking",
"--without-csharp",
"--without-tcl"
]
args << arg_for_lang('ruby')
args << arg_for_lang('java')
2010-05-18 03:41:51 +00:00
if ARGV.include? '--python'
python_lib = lib + "python"
python_lib.mkpath
ENV.append 'PYTHONPATH', python_lib
ENV['OVERRIDE_MACOSX_DEPLOYMENT_TARGET'] = '10.4'
ENV['PYTHON_LIB'] = "#{python_lib}"
args << "--with-python"
else
args << "--without-python"
end
2010-05-18 03:41:51 +00:00
if ARGV.include? '--php'
extension_dir = lib+'php/extensions'
extension_dir.mkpath
args << "--with-php PHP_EXTENSION_DIR=#{extension_dir}"
else
args << "--without-php"
end
system "./configure", *args
system "make install"
end
end
def caveats
s = ""
if ARGV.include? "--python"
s += <<-EOS.undent
The Python bindings won't function until you amend your PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
EOS
end
end
end