Skip to content

Instantly share code, notes, and snippets.

@ralphos
Last active August 29, 2015 14:01
Show Gist options
  • Save ralphos/66ef39e06f04def5bbd8 to your computer and use it in GitHub Desktop.
Save ralphos/66ef39e06f04def5bbd8 to your computer and use it in GitHub Desktop.
Sphinx 0.9.9 Formula - updated
require 'formula'
class Sphinx < Formula
url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz'
homepage 'http://www.sphinxsearch.com'
version '0.9.9'
sha1 '8c739b96d756a50972c27c7004488b55d7458015'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
fails_with_llvm "ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)",
:build => 2334
devel do
url 'http://sphinxsearch.com/files/sphinx-2.1.1-beta.tar.gz'
sha1 '2ccbf75146f54338834a6e37250f1af3c73b9746'
end
option 'mysql', 'Force compiling against MySQL'
option 'pgsql', 'Force compiling against PostgreSQL'
depends_on :postgresql if build.include? 'pgsql'
depends_on 'apple-gcc42' if MacOS.version >= :mavericks
resource 'stemmer' do
url 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
sha1 '9b0f120a68a3c688b2f5a8d0f681620465c29d38'
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]
%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