aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-02-19 16:13:24 +0800
committerXu Cheng2015-02-19 16:37:34 +0800
commit3488721d7c78470fcb0e0638d9b92c0a6fa94388 (patch)
treeea092ffb45b36e01663b00d38a81fede7860d323 /Library
parenteb41d05a093bc121dcb7c4e0337adb4db11b493d (diff)
downloadhomebrew-3488721d7c78470fcb0e0638d9b92c0a6fa94388.tar.bz2
szip: add test and modernize
Closes #36953. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/szip.rb32
1 files changed, 26 insertions, 6 deletions
diff --git a/Library/Formula/szip.rb b/Library/Formula/szip.rb
index beaec4623..dd122a697 100644
--- a/Library/Formula/szip.rb
+++ b/Library/Formula/szip.rb
@@ -1,9 +1,7 @@
-require 'formula'
-
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'
+ 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"
option :universal
@@ -11,6 +9,28 @@ class Szip < Formula
ENV.universal_binary if build.universal?
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
- system "make install"
+ 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