-
-
Save sars/b8a7e10af907bd0d1020eb8609d6cd1c to your computer and use it in GitHub Desktop.
Homebrew formula for sphinx 2.0.9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Sphinx20 < Formula | |
homepage 'http://www.sphinxsearch.com' | |
url 'http://sphinxsearch.com/files/sphinx-2.0.9-release.tar.gz' | |
sha256 'c4fb5d7951bc0831e46f102d17b5f32bbde11434ce3b00b20531dfe9e646869d' | |
head 'http://sphinxsearch.googlecode.com/svn/trunk/' | |
devel do | |
url 'http://sphinxsearch.com/files/sphinx-2.1.1-beta.tar.gz' | |
sha256 '1fbd1d52c784a3c479dac6e9d40d24b75486b3914af3c170fa26c5e65996a1a3' | |
end | |
option 'mysql', 'Force compiling against MySQL' | |
option 'pgsql', 'Force compiling against PostgreSQL' | |
option 'id64', 'Force compiling with 64-bit ID support' | |
depends_on :mysql if build.include? 'mysql' | |
depends_on :postgresql if build.include? 'pgsql' | |
resource 'stemmer' do | |
url 'http://snowball.tartarus.org/dist/libstemmer_c.tgz' | |
sha256 '6530c3638f29f5b03bc3786bb9212e39adaf3bf15b5b0a483b2eb5111f7f416e' | |
end | |
fails_with :llvm do | |
build 2334 | |
cause "ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)" | |
end | |
fails_with :clang do | |
build 421 | |
cause "sphinxexpr.cpp:1802:11: error: use of undeclared identifier 'ExprEval'" | |
end | |
def install | |
ENV['CC'] = '/usr/local/bin/gcc-4.9' | |
ENV['CXX'] = '/usr/local/bin/g++-4.9' | |
ENV['CPP'] = '/usr/local/bin/cpp-4.9' | |
ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.9' | |
ENV['CFLAGS'] = '-arch x86_64' | |
ENV['CCFLAGS'] = '-arch x86_64' | |
ENV['CPPFLAGS'] = '-arch x86_64' | |
ENV['CXXFLAGS'] = '-arch x86_64' | |
# libstemmer changed the name of the non-UTF8 Hungarian source files, | |
# but the released version of sphinx still refers to it under the old name. | |
inreplace "libstemmer_c/Makefile.in", | |
"stem_ISO_8859_1_hungarian", "stem_ISO_8859_2_hungarian" | |
resource('stemmer').stage do | |
system "cp -r . #{buildpath}/libstemmer_c/ " | |
end | |
args = %W[--prefix=#{prefix} | |
--disable-dependency-tracking | |
--localstatedir=#{var} | |
--with-libstemmer] | |
args << "--enable-id64" if build.include? 'id64' | |
%w{mysql pgsql}.each do |db| | |
if build.include? db | |
args << "--with-#{db}" | |
else | |
args << "--without-#{db}" | |
end | |
end | |
system "./configure", *args | |
system "make install" | |
end | |
def caveats; <<-EOS.undent | |
Sphinx has been compiled with libstemmer support. | |
Sphinx depends on either MySQL or PostreSQL as a datasource. | |
You can install these with Homebrew with: | |
brew install mysql | |
For MySQL server. | |
brew install mysql-connector-c | |
For MySQL client libraries only. | |
brew install postgresql | |
For PostgreSQL server. | |
We don't install these for you when you install this formula, as | |
we don't know which datasource you intend to use. | |
EOS | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment