aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/gdbm.rb
blob: 48013d01b59644c9ff78e3a812c5e445fe696c76 (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
class Gdbm < Formula
  homepage "https://www.gnu.org/software/gdbm/"
  url "https://ftpmirror.gnu.org/gdbm/gdbm-1.11.tar.gz"
  mirror "https://ftp.gnu.org/gnu/gdbm/gdbm-1.11.tar.gz"
  sha1 "ce433d0f192c21d41089458ca5c8294efe9806b4"

  bottle do
    cellar :any
    revision 2
    sha1 "ae6850dce748a51b1d4270ae201dc50eb1a05d24" => :yosemite
    sha1 "b6e5a8d874b0a28cf9405e625c0d99799ad78c68" => :mavericks
    sha1 "a7786dbb967f0b42d6a25b6e25582270435de6c0" => :mountain_lion
  end

  option :universal
  option "with-libgdbm-compat", "Build libgdbm_compat, a compatibility layer which provides UNIX-like dbm and ndbm interfaces."

  def install
    ENV.universal_binary if build.universal?

    args = %W[
      --disable-dependency-tracking
      --disable-silent-rules
      --prefix=#{prefix}
    ]

    args << "--enable-libgdbm-compat" if build.with? "libgdbm-compat"

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

  test do
    pipe_output("#{bin}/gdbmtool --norc --newdb test", "store 1 2\nquit\n")
    assert File.exist?("test")
    assert_match /2/, pipe_output("#{bin}/gdbmtool --norc test", "fetch 1\nquit\n")
  end
end