aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/glog.rb
blob: 95d134c60934a35bd76ade263c431b9903c1a4d0 (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
require "formula"

class Glog < Formula
  homepage "https://code.google.com/p/google-glog/"
  url "https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz"
  sha1 "ed40c26ecffc5ad47c618684415799ebaaa30d65"

  bottle do
    sha1 "58f13dfb8f3c3804e3918930b1404efaaf1a19f8" => :yosemite
    sha1 "aace7209305a11ae57a4e45ed283adaa0d82472f" => :mavericks
    sha1 "086c05d1e18c99783c16d38dd7ad454137299e36" => :mountain_lion
  end

  # Vendor an older version of gflags as the new version makes compile = nope.
  resource "gflags" do
    url "https://gflags.googlecode.com/files/gflags-2.0.tar.gz"
    sha1 "dfb0add1b59433308749875ac42796c41e824908"
  end

  if MacOS.version >= :mavericks
    # Since 0.3.4 has not yet been released, manually apply
    # r134 that refactors the way headers are included.
    patch do
      url "https://gist.githubusercontent.com/danslo/7128754/raw/9b19991da4753f5efb87ae9a6939e6c3e9bc1fdf/glog_logging_r134.diff"
      sha1 "a4a1a3d1467115f927935c441715b0f8c362abba"
    end

    # Don't use tr1 prefix when we're using libc++:
    # https://code.google.com/p/google-glog/issues/detail?id=121 (patch mirrored on gist.github.com)
    patch do
      url "https://gist.githubusercontent.com/noahm/7364571/raw/436283200fe5a3ac5d00d769bb2203260bebfcf9/libc%2B%2B.diff"
      sha1 "14fe8c422a92ebd6908861ee22cfe1a689191c18"
    end
  end

  def install
    resource("gflags").stage do
      system "./configure", "--disable-dependency-tracking", "--prefix=#{libexec}/gflags"
      system "make", "install"
    end

    # Find our sandboxed gflags.
    ENV.append_to_cflags "-I#{libexec}/gflags/include"
    ENV.append "LDFLAGS", "-L#{libexec}/gflags/lib"

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

  test do
    assert_equal "#{libexec}/gflags/lib/libgflags.2.dylib (compatibility version 4.0.0, current version 4.0.0)",
    shell_output("otool -L #{lib}/libglog.0.dylib | grep libgflags").strip
  end
end