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-07-28 21:16:13 +00:00
|
|
|
url 'http://oligarchy.co.uk/xapian/1.2.12/xapian-bindings-1.2.12.tar.gz'
|
|
|
|
sha1 'f75921b43041e6e672821c51fe29dbbaee491791'
|
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-07-28 21:16:13 +00:00
|
|
|
url 'http://oligarchy.co.uk/xapian/1.2.12/xapian-core-1.2.12.tar.gz'
|
|
|
|
sha1 '2b96800280fee41eed767289620172f5226c9c4f'
|
2009-10-21 19:52:59 +00:00
|
|
|
|
2012-08-10 04:45:04 +00:00
|
|
|
option "java", "Java bindings"
|
|
|
|
option "php", "PHP bindings"
|
|
|
|
option "python", "Python bindings"
|
|
|
|
option "ruby", "Ruby bindings"
|
2009-10-21 19:52:59 +00:00
|
|
|
|
|
|
|
def skip_clean? path
|
|
|
|
path.extname == '.la'
|
|
|
|
end
|
|
|
|
|
2010-05-18 03:41:51 +00:00
|
|
|
def build_any_bindings?
|
2012-08-10 04:45:04 +00:00
|
|
|
build.include? 'ruby' or build.include? 'python' or build.include? 'java' or build.include? 'php'
|
2010-05-18 03:41:51 +00:00
|
|
|
end
|
|
|
|
|
2009-10-21 19:52:59 +00:00
|
|
|
def install
|
2012-08-10 04:45:04 +00:00
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}"
|
2009-10-21 19:52:59 +00:00
|
|
|
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
|
2012-08-10 04:45:04 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
XAPIAN_CONFIG=#{bin}/xapian-config
|
|
|
|
--without-csharp
|
|
|
|
--without-tcl
|
2012-02-26 05:00:28 +00:00
|
|
|
]
|
2011-08-01 11:28:09 +00:00
|
|
|
|
2012-08-10 04:45:04 +00:00
|
|
|
if build.include? 'java'
|
|
|
|
args << '--with-java'
|
|
|
|
else
|
|
|
|
args << '--without-java'
|
|
|
|
end
|
2010-05-18 03:41:51 +00:00
|
|
|
|
2012-08-10 04:45:04 +00:00
|
|
|
if build.include? 'ruby'
|
2012-05-09 13:26:27 +00:00
|
|
|
ruby_site = lib+'ruby/site_ruby'
|
|
|
|
ENV['RUBY_LIB'] = ENV['RUBY_LIB_ARCH'] = ruby_site
|
|
|
|
args << '--with-ruby'
|
|
|
|
else
|
|
|
|
args << '--without-ruby'
|
|
|
|
end
|
|
|
|
|
2012-08-10 04:45:04 +00:00
|
|
|
if build.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-08-10 04:45:04 +00:00
|
|
|
if build.include? 'php'
|
2012-02-26 05:00:28 +00:00
|
|
|
extension_dir = lib+'php/extensions'
|
|
|
|
extension_dir.mkpath
|
2012-05-09 13:26:27 +00:00
|
|
|
args << "--with-php" << "PHP_EXTENSION_DIR=#{extension_dir}"
|
2012-02-26 05:00:28 +00:00
|
|
|
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-05-09 13:26:27 +00:00
|
|
|
s = ''
|
2012-08-10 04:45:04 +00:00
|
|
|
if build.include? 'python'
|
2012-05-09 13:26:27 +00:00
|
|
|
s += <<-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
|
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|
2012-08-10 04:45:04 +00:00
|
|
|
if build.include? 'ruby'
|
2012-05-09 13:26:27 +00:00
|
|
|
s += <<-EOS.undent
|
|
|
|
You may need to add the Ruby bindings to your RUBYLIB from:
|
|
|
|
#{HOMEBREW_PREFIX}/lib/ruby/site_ruby
|
|
|
|
|
2011-08-01 11:28:09 +00:00
|
|
|
EOS
|
|
|
|
end
|
2012-05-09 13:26:27 +00:00
|
|
|
return s.empty? ? nil : s
|
2011-08-01 11:28:09 +00:00
|
|
|
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
|