aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/xapian.rb
blob: e83ba745dbb0b8584f9c5ddd982cd065c00a7c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require 'formula'

class XapianBindings <Formula
  url 'http://oligarchy.co.uk/xapian/1.0.16/xapian-bindings-1.0.16.tar.gz'
  homepage 'http://xapian.org'
  md5 'c330b2ccc451c890916c44446e148f07'
end

class Xapian <Formula
  url 'http://oligarchy.co.uk/xapian/1.0.16/xapian-core-1.0.16.tar.gz'
  homepage 'http://xapian.org'
  md5 '19756e128d804faa6e7975a629ca3b70'

  def options
    [
      ["--ruby", "Ruby bindings"],
      ["--python", "Python bindings"],
      ["--php", "PHP bindings"],
      ["--java", "Java bindings"],
    ]
  end

  def skip_clean? path
    path.extname == '.la'
  end

  def install
    ENV.O3 # takes forever otherwise

    system "./configure", "--prefix=#{prefix}", "--disable-assertions",
                          "--disable-dependency-tracking"
    system "make install"

    XapianBindings.new.brew do
      if ARGV.include? '--ruby' or ARGV.include? '--python' or ARGV.include? '--java' or ARGV.include? '--php'
        args = [
          "XAPIAN_CONFIG=#{bin}/xapian-config",
          "--prefix=#{prefix}",
          "--disable-debug",
          "--disable-dependency-tracking",
          "--without-csharp",
          "--without-tcl"
        ]
        if ARGV.include? '--ruby'
          args << "--with-ruby"
        else
          args << "--without-ruby"
        end
        if ARGV.include? '--python'
          args << "--with-python"
        else
          args << "--without-python"
        end
        if ARGV.include? '--php'
          lib.mkdir
          extension_dir = (lib+'php'+'extensions')
          extension_dir.mkdir
          args << "--with-php PHP_EXTENSION_DIR=#{extension_dir}"
        else
          args << "--without-php"
        end
        if ARGV.include? '--java'
          args << "--with-java"
        else
          args << "--without-java"
        end
        system "./configure", *args
        system "make install"
      end
    end
  end
end