aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libcouchbase.rb
blob: 749f2d374f71a7d45568928cb41ea523c5947238 (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
require 'formula'

class Libcouchbase < Formula
  homepage 'http://couchbase.com/communities/c'
  url 'http://packages.couchbase.com/clients/c/libcouchbase-2.4.4.tar.gz'
  sha1 'eedc67ef4f85fd51b6bc43cb222e07f6d07241a8'
  head "https://github.com/couchbase/libcouchbase", :using => :git

  bottle do
    sha1 "9bb6e3e3a8e7ea35a9bbed61276ae151646c852f" => :yosemite
    sha1 "8da9e14594a3565d2746107ac0f00e4cb30f5840" => :mavericks
    sha1 "b9074a78a2ac0106cb19b8c810980ba7f8ce0005" => :mountain_lion
  end

  option :universal
  option "with-libev", "Build libev plugin"
  option "without-libevent", "Do not build libevent plugin"

  deprecated_option "with-libev-plugin" => "with-libev"
  deprecated_option "without-libevent-plugin" => "without-libevent"

  depends_on "libev" => :optional
  depends_on "libuv" => :optional
  depends_on "libevent" => :recommended
  depends_on "openssl"
  depends_on 'cmake' => :build

  def install
    args = std_cmake_args
    args << '-DLCB_NO_TESTS=1'

    ['libev', 'libevent', 'libuv'].each do |pname|
        args << "-DLCB_BUILD_#{pname.upcase}=" + (build.with?("#{pname}") ? 'ON' : 'OFF')
    end
    if build.universal?
      args << '-DLCB_UNIVERSAL_BINARY=1'
      ENV.universal_binary
    end
    if build.without?('libev') && build.without?('libuv') && build.without?('libevent')
      args << '-DLCB_NO_PLUGINS=1'
    end

    ln_s cached_download/".git", ".git" if build.head?
    mkdir 'LCB-BUILD' do
      system "cmake", "..", *args
      system 'make install'
    end
  end

  test do
    system "#{bin}/cbc", "version"
  end
end