Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
Last active October 23, 2016 14:35

Revisions

  1. pixeltrix revised this gist Oct 23, 2016. No changes.
  2. pixeltrix revised this gist Oct 23, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,11 @@ def install
    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
  3. pixeltrix revised this gist Oct 23, 2016. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,13 @@
    class Sphinx < Formula
    url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz'
    homepage 'http://www.sphinxsearch.com'
    sha1 '8c739b96d756a50972c27c7004488b55d7458015'
    sha256 'bf8f55ffc095ff6b628f0cbc7eb54761811140140679a1c869cc1b17c42803e4'

    depends_on 'homebrew/dupes/apple-gcc42'

    resource 'stemmer' do
    url 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
    homepage 'http://snowball.tartarus.org/'
    sha1 '6645992e5a5023dfd7eecf99fbcc58ec8b41facf'
    sha256 '6530c3638f29f5b03bc3786bb9212e39adaf3bf15b5b0a483b2eb5111f7f416e'
    end

    fails_with :llvm do
  4. pixeltrix revised this gist Oct 23, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    require 'formula'

    class Sphinx < Formula
    url 'https://s3-eu-west-1.amazonaws.com/rnaveiras-software/sphinx-0.9.9.tar.gz'
    url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz'
    homepage 'http://www.sphinxsearch.com'
    sha1 '8c739b96d756a50972c27c7004488b55d7458015'

    depends_on 'homebrew/dupes/apple-gcc42'

    resource 'stemmer' do
    url 'https://s3-eu-west-1.amazonaws.com/rnaveiras-software/libstemmer_c.tgz'
    url 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
    homepage 'http://snowball.tartarus.org/'
    sha1 '6645992e5a5023dfd7eecf99fbcc58ec8b41facf'
    # homepage 'http://snowball.tartarus.org/'
    end

    fails_with :llvm do
  5. pixeltrix revised this gist Sep 26, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ def install
    # setting ad-hoc GCC from apple-gcc42
    ENV['CC'] = '/usr/local/bin/gcc-4.2'
    ENV['CXX'] = '/usr/local/bin/g++-4.2'
    ENV['CPP'] = '/usr/local/bin/cpp-4.2'
    ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

    ENV['CFLAGS'] = '-arch x86_64'
  6. pixeltrix revised this gist Sep 26, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,7 @@ def install

    ENV['CFLAGS'] = '-arch x86_64'
    ENV['CCFLAGS'] = '-arch x86_64'
    ENV['CPPFLAGS'] = '-arch x86_64'
    ENV['CXXFLAGS'] = '-arch x86_64'

    resource('stemmer').stage do
  7. pixeltrix created this gist Sep 26, 2016.
    76 changes: 76 additions & 0 deletions sphinx.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    require 'formula'

    class Sphinx < Formula
    url 'https://s3-eu-west-1.amazonaws.com/rnaveiras-software/sphinx-0.9.9.tar.gz'
    homepage 'http://www.sphinxsearch.com'
    sha1 '8c739b96d756a50972c27c7004488b55d7458015'

    depends_on 'homebrew/dupes/apple-gcc42'

    resource 'stemmer' do
    url 'https://s3-eu-west-1.amazonaws.com/rnaveiras-software/libstemmer_c.tgz'
    sha1 '6645992e5a5023dfd7eecf99fbcc58ec8b41facf'
    # homepage 'http://snowball.tartarus.org/'
    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
    # setting ad-hoc GCC from apple-gcc42
    ENV['CC'] = '/usr/local/bin/gcc-4.2'
    ENV['CXX'] = '/usr/local/bin/g++-4.2'
    ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

    ENV['CFLAGS'] = '-arch x86_64'
    ENV['CCFLAGS'] = '-arch x86_64'
    ENV['CXXFLAGS'] = '-arch x86_64'

    resource('stemmer').stage do
    system "cp -r . #{buildpath}/libstemmer_c/ "
    end

    args = ["--prefix=#{prefix}",
    "--disable-debug",
    "--disable-dependency-tracking",
    "--localstatedir=#{var}"]

    # always build with libstemmer support
    args << "--with-libstemmer"
    args << "--with-mysql"

    # configure script won't auto-select PostgreSQL
    args << "--with-pgsql" if `/usr/bin/which pg_config`.size > 0

    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