Skip to content

Commit

Permalink
zlib: update 1.3.1 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Sep 4, 2024
1 parent d8dd677 commit c2a302c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Formula/z/zlib.rb
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

0 comments on commit c2a302c

Please sign in to comment.