aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libyaml.rb
blob: 28cdd35445ee0ff358ca2e2e704c63ab5d06c9b6 (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
class Libyaml < Formula
  homepage "http://pyyaml.org/wiki/LibYAML"
  url "http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz"
  mirror "https://mirrors.kernel.org/debian/pool/main/liby/libyaml/libyaml_0.1.6.orig.tar.gz"
  sha1 "f3d404e11bec3c4efcddfd14c42d46f1aabe0b5d"
  revision 1

  bottle do
    cellar :any
    sha1 "fe12271b6ad73806e26dd5e1c7d9090c739361a1" => :yosemite
    sha1 "c1db85f1e26699b0788cea8383fba127cfb4c83b" => :mavericks
    sha1 "5b2af750962a1cdc36384f49d2fe96b0f00d5fda" => :mountain_lion
  end

  option :universal

  # address CVE-2014-9130
  # https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-9130
  patch do
    url "https://bitbucket.org/xi/libyaml/commits/2b9156756423e967cfd09a61d125d883fca6f4f2/raw/"
    sha1 "174dbe1f5161853cdb1c6ba94df6a826cf25870c"
  end

  def install
    ENV.universal_binary if build.universal?

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

  test do
    (testpath/"test.c").write <<-EOS.undent
      #include <yaml.h>

      int main()
      {
        yaml_parser_t parser;
        yaml_parser_initialize(&parser);
        yaml_parser_delete(&parser);
        return 0;
      }
    EOS
    system ENV.cc, "test.c", "-lyaml", "-o", "test"
    system "./test"
  end
end