aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/szip.rb
blob: 672438c7e1582a242649097458945d2cd89a5e7d (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
class Szip < Formula
  homepage "http://www.hdfgroup.org/HDF5/release/obtain5.html#extlibs"
  url "http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz"
  sha1 "d241c9acc26426a831765d660b683b853b83c131"

  bottle do
    cellar :any
    sha1 "75413c328dc915c2bc638d308fd15a1e93fddd18" => :yosemite
    sha1 "71a91cec13090ab85a0b1c7339df98610561562d" => :mavericks
    sha1 "37a8018d670680d3002fd68aec8fae0992635911" => :mountain_lion
  end

  option :universal

  def install
    ENV.universal_binary if build.universal?
    system "./configure", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    (testpath/"test.c").write <<-EOS.undent
      #include <assert.h>
      #include <stdlib.h>
      #include <stdio.h>
      #include "szlib.h"

      int main()
      {
        sz_stream c_stream;
        c_stream.bits_per_pixel = 8;
        c_stream.pixels_per_block = 8;
        c_stream.pixels_per_scanline = 16;
        assert(SZ_CompressInit(&c_stream) == SZ_OK);
        assert(SZ_CompressEnd(&c_stream) == SZ_OK);
        return 0;
      }
    EOS
    system ENV.cc, "-lsz", "test.c", "-o", "test"
    system "./test"
  end
end