aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libzdb.rb
blob: 921dd6e5cfcaf00d4b2fc3bd3dd6976c4f57026c (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
73
74
75
76
require 'formula'

class MySqlInstalled < Requirement
  def message
    <<-EOS.undent
      MySQL is required to install.

      You can install this with Homebrew using:
        brew install mysql-connector-c
          For MySQL client libraries only.

        brew install mysql
          For MySQL server.

      Or you can use an official installer from:
        http://dev.mysql.com/downloads/mysql/
    EOS
  end

  def satisfied?
    which 'mysql_config'
  end

  def fatal?
    true
  end
end

class PostgresInstalled < Requirement
  def message
    <<-EOS.undent
      Postgres is required to install.

      You can install this with Homebrew using:
        brew install postgres

      Or you can use an official installer from:
        http://www.postgresql.org/download/macosx/
    EOS
  end

  def satisfied?
    which 'pg_config'
  end

  def fatal?
    true
  end
end

class Libzdb < Formula
  homepage 'http://tildeslash.com/libzdb/'
  url 'http://tildeslash.com/libzdb/dist/libzdb-2.10.5.tar.gz'
  sha1 '30f975e73caf58f1fa02260ed7136185a3ba2d27'

  option 'without-sqlite',     "Compile without SQLite support"
  option 'without-postgresql', "Compile without PostgreSQL support"
  option 'without-mysql',      "Compile without MySQL support"

  depends_on PostgresInstalled.new unless build.include? 'without-postgresql'
  depends_on MySqlInstalled.new    unless build.include? 'without-mysql'
  depends_on 'sqlite'              unless build.include? 'without-sqlite'

  def install
    args = ["--disable-debug",
            "--disable-dependency-tracking",
            "--prefix=#{prefix}"]

    args << "--without-sqlite"     if build.include? 'without-sqlite'
    args << "--without-mysql"      if build.include? 'without-mysql'
    args << "--without-postgresql" if build.include? 'without-postgresql'

    system "./configure", *args
    system "make install"
  end
end