-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class Zlib < Formula | ||
desc "General-purpose lossless data-compression library" | ||
homepage "https://zlib.net/" | ||
url "https://zlib.net/zlib-1.3.1.tar.gz" | ||
mirror "https://downloads.sourceforge.net/project/libpng/zlib/1.3.1/zlib-1.3.1.tar.gz" | ||
mirror "http://fresh-center.net/linux/misc/zlib-1.3.1.tar.gz" | ||
mirror "http://fresh-center.net/linux/misc/legacy/zlib-1.3.1.tar.gz" | ||
sha256 "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" | ||
license "Zlib" | ||
head "https://github.com/madler/zlib.git", branch: "develop" | ||
|
||
livecheck do | ||
url :homepage | ||
regex(/href=.*?zlib[._-]v?(\d+(?:\.\d+)+)\.t/i) | ||
end | ||
|
||
bottle do | ||
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/zlib-1.3.1" | ||
sha256 cellar: :any_skip_relocation, aarch64_linux: "343b667a2d94c71bcc0d5aaa610c685cdefdb0be7d874f6d3cfbd664f9d35b46" | ||
end | ||
|
||
keg_only :provided_by_macos | ||
|
||
# https://zlib.net/zlib_how.html | ||
resource "test_artifact" do | ||
url "https://zlib.net/zpipe.c" | ||
version "20051211" | ||
sha256 "68140a82582ede938159630bca0fb13a93b4bf1cb2e85b08943c26242cf8f3a6" | ||
end | ||
|
||
def install | ||
system "./configure", "--prefix=#{prefix}" | ||
system "make", "install" | ||
|
||
# Avoid rebuilds of dependents that hardcode this path. | ||
inreplace lib/"pkgconfig/zlib.pc", prefix, opt_prefix | ||
end | ||
|
||
test do | ||
testpath.install resource("test_artifact") | ||
system ENV.cc, "zpipe.c", "-I#{include}", "-L#{lib}", "-lz", "-o", "zpipe" | ||
|
||
text = "Hello, Homebrew!" | ||
compressed = pipe_output("./zpipe", text) | ||
assert_equal text, pipe_output("./zpipe -d", compressed) | ||
end | ||
end |