2009-10-21 19:52:59 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class XapianBindings < Formula
|
2009-10-21 19:52:59 +00:00
|
|
|
homepage 'http://xapian.org'
|
2012-03-09 10:43:05 +00:00
|
|
|
url 'http://oligarchy.co.uk/xapian/1.2.8/xapian-bindings-1.2.8.tar.gz'
|
|
|
|
sha1 '92cf39c9c00a52a33727e47a1a7aaee2a1b23c2f'
|
2009-10-21 19:52:59 +00:00
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Xapian < Formula
|
2009-10-21 19:52:59 +00:00
|
|
|
homepage 'http://xapian.org'
|
2012-03-09 10:43:05 +00:00
|
|
|
url 'http://oligarchy.co.uk/xapian/1.2.8/xapian-core-1.2.8.tar.gz'
|
|
|
|
sha1 '4bdd3845278812d467b8d0fb73ee27a5be05b2d9'
|
2009-10-21 19:52:59 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-10-21 19:52:59 +00:00
|
|
|
def install
|
|
|
|
system "./configure", "--prefix=#{prefix}", "--disable-assertions",
|
|
|
|
"--disable-dependency-tracking"
|
|
|
|
system "make install"
|
2012-02-26 05:00:28 +00:00
|
|
|
return unless build_any_bindings?
|
2009-10-21 19:52:59 +00:00
|
|
|
|
2012-02-26 05:00:28 +00:00
|
|
|
XapianBindings.new.brew do
|
|
|
|
args = [
|
|
|
|
"XAPIAN_CONFIG=#{bin}/xapian-config",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--disable-debug",
|
|
|
|
"--disable-dependency-tracking",
|
|
|
|
"--without-csharp",
|
|
|
|
"--without-tcl"
|
|
|
|
]
|
2011-08-01 11:28:09 +00:00
|
|
|
|
2012-02-26 05:00:28 +00:00
|
|
|
args << arg_for_lang('ruby')
|
|
|
|
args << arg_for_lang('java')
|
2010-05-18 03:41:51 +00:00
|
|
|
|
2012-02-26 05:00:28 +00:00
|
|
|
if ARGV.include? '--python'
|
2012-03-24 03:15:33 +00:00
|
|
|
python_lib = lib/which_python/'site-packages'
|
2012-02-26 05:00:28 +00:00
|
|
|
python_lib.mkpath
|
|
|
|
ENV.append 'PYTHONPATH', python_lib
|
|
|
|
ENV['OVERRIDE_MACOSX_DEPLOYMENT_TARGET'] = '10.4'
|
2012-03-24 03:15:33 +00:00
|
|
|
ENV['PYTHON_LIB'] = python_lib
|
2012-02-26 05:00:28 +00:00
|
|
|
args << "--with-python"
|
|
|
|
else
|
|
|
|
args << "--without-python"
|
|
|
|
end
|
2010-05-18 03:41:51 +00:00
|
|
|
|
2012-02-26 05:00:28 +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"
|
2009-10-21 19:52:59 +00:00
|
|
|
end
|
2012-02-26 05:00:28 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
|
|
|
system "make install"
|
2009-10-21 19:52:59 +00:00
|
|
|
end
|
|
|
|
end
|
2011-08-01 11:28:09 +00:00
|
|
|
|
|
|
|
def caveats
|
2012-03-24 03:15:33 +00:00
|
|
|
if ARGV.include? "--python" then <<-EOS.undent
|
|
|
|
The Python bindings won't function until you amend your PYTHONPATH like so:
|
|
|
|
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
|
2011-08-01 11:28:09 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
2012-03-24 03:15:33 +00:00
|
|
|
|
|
|
|
def which_python
|
|
|
|
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
|
|
|
|
end
|
2010-05-13 12:18:34 +00:00
|
|
|
end
|