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

class I2util < Formula
  homepage "http://software.internet2.edu/"
  url "http://software.internet2.edu/sources/I2util/I2util-1.2.tar.gz"
  sha1 "56218a6e0f1306a70b641246fa6f63dd686e6766"

  bottle do
    cellar :any
    sha1 "14336de85e35136a369e889d1072adf866998f09" => :yosemite
    sha1 "c88dd13937831bab2efd3ad928d54635a48ef129" => :mavericks
    sha1 "eced6a87c580fe024730ca09fa61c6a5e3cc4d63" => :mountain_lion
  end

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

  test do
    (testpath/"test.c").write <<-EOS.undent
      #include <I2util/util.h>
      #include <string.h>
      int main() {
        uint8_t buf[2];
        if (!I2HexDecode("beef", buf, sizeof(buf))) return 1;
        if (buf[0] != 190 || buf[1] != 239) return 1;
        return 0;
      }
    EOS
    system ENV.cc, "test.c", "-lI2util", "-o", "test"
    system "./test"
  end
end