-
-
Save thedavemarshall/33c4bafa6e9b24b7d1cf to your computer and use it in GitHub Desktop.
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
| # Original: https://gist.githubusercontent.com/pcorliss/5628491/raw/eccb38d840734854dd5a10b25e7d52b71612f0d7/sphinx.rb | |
| require 'formula' | |
| class Sphinx < Formula | |
| homepage 'http://www.sphinxsearch.com' | |
| url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz' | |
| sha1 '8c739b96d756a50972c27c7004488b55d7458015' | |
| head 'http://sphinxsearch.googlecode.com/svn/trunk/' | |
| option 'mysql', 'Force compiling against MySQL' | |
| option 'pgsql', 'Force compiling against PostgreSQL' | |
| option 'id64', 'Force compiling with 64-bit ID support' | |
| depends_on "re2" => :optional | |
| depends_on :mysql if build.include? 'mysql' | |
| depends_on :postgresql if build.include? 'pgsql' | |
| # http://snowball.tartarus.org/ | |
| resource 'stemmer' do | |
| # upstream is constantly changing the tarball, | |
| # so doing checksum verification here would require | |
| # constant, rapid updates to this formula. | |
| url 'http://snowball.tartarus.org/dist/libstemmer_c.tgz' | |
| sha1 '1ac6bb16e829e9f3a58f62c27047c26784975aa1' | |
| 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 | |
| (buildpath/'libstemmer_c').install resource('stemmer') | |
| # 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" | |
| args = %W[--prefix=#{prefix} | |
| --disable-dependency-tracking | |
| --localstatedir=#{var} | |
| --with-libstemmer] | |
| args << "--enable-id64" if build.include? 'id64' | |
| args << "--with-re2" if build.with? 're2' | |
| %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