From 571b6e74a852c1d1e090049df1431172265ef674 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 13 Sep 2019 01:54:19 +0000 Subject: [PATCH] minizip2 2.8.9 (new formula) --- Formula/libtcod.rb | 3 ++- Formula/libzip.rb | 3 ++- Formula/minizip.rb | 3 +++ Formula/minizip2.rb | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Formula/minizip2.rb diff --git a/Formula/libtcod.rb b/Formula/libtcod.rb index 42ca7cbb6d61..623220c84fbe 100644 --- a/Formula/libtcod.rb +++ b/Formula/libtcod.rb @@ -17,7 +17,8 @@ class Libtcod < Formula depends_on "pkg-config" => :build depends_on "sdl2" - conflicts_with "libzip", :because => "both install `zip.h` header" + conflicts_with "libzip", "minizip2", + :because => "libtcod, libzip and minizip2 install a `zip.h` header" def install cd "build/autotools" do diff --git a/Formula/libzip.rb b/Formula/libzip.rb index dfff479c309f..8602a65520ce 100644 --- a/Formula/libzip.rb +++ b/Formula/libzip.rb @@ -12,7 +12,8 @@ class Libzip < Formula depends_on "cmake" => :build - conflicts_with "libtcod", :because => "both install `zip.h` header" + conflicts_with "libtcod", "minizip2", + :because => "libtcod, libzip and minizip2 install a `zip.h` header" def install system "cmake", ".", *std_cmake_args diff --git a/Formula/minizip.rb b/Formula/minizip.rb index 52cf73949ea0..87625ebdb592 100644 --- a/Formula/minizip.rb +++ b/Formula/minizip.rb @@ -18,6 +18,9 @@ class Minizip < Formula depends_on "automake" => :build depends_on "libtool" => :build + conflicts_with "minizip2", + :because => "both install a `libminizip.a` library" + def install system "./configure", "--prefix=#{prefix}" system "make" diff --git a/Formula/minizip2.rb b/Formula/minizip2.rb new file mode 100644 index 000000000000..5a0f9abedef1 --- /dev/null +++ b/Formula/minizip2.rb @@ -0,0 +1,34 @@ +class Minizip2 < Formula + desc "Zip file manipulation library with minizip 1.x compatibility layer" + homepage "https://github.com/nmoinvaz/minizip" + url "https://github.com/nmoinvaz/minizip/archive/2.8.9.tar.gz" + sha256 "ad0ab096e325ada77f4c75770ffcb03e3540e4c373e36ee22bb1d47b2b98c36d" + + depends_on "cmake" => :build + + conflicts_with "minizip", + :because => "both install a `libminizip.a` library" + conflicts_with "libtcod", "libzip", + :because => "libtcod, libzip and minizip2 install a `zip.h` header" + + def install + system "cmake", ".", *std_cmake_args + system "make", "install" + end + + test do + (testpath/"test.c").write <<~EOS + #include + #include + #include "mz_zip.h" + #include "mz_compat.h" + int main(void) + { + zipFile hZip = zipOpen2_64("test.zip", APPEND_STATUS_CREATE, NULL, NULL); + return hZip != NULL && mz_zip_close(NULL) == MZ_PARAM_ERROR ? 0 : 1; + } + EOS + system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lminizip", "-lz", "-lbz2", "-framework", "CoreFoundation", "-framework", "Security", "-o", "test" + system "./test" + end +end