szip: add test and modernize
Closes Homebrew/homebrew#36953. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
5066415690
commit
7f56c18f45
1 changed files with 26 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue