Skip to content

Commit 9f6bfb7

Browse files
committed
zstd: update 1.5.6 bottle.
1 parent 6e1916e commit 9f6bfb7

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

Formula/z/zstd.rb

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
class Zstd < Formula
2+
desc "Zstandard is a real-time compression algorithm"
3+
homepage "https://facebook.github.io/zstd/"
4+
url "https://github.com/facebook/zstd/archive/refs/tags/v1.5.6.tar.gz"
5+
mirror "http://fresh-center.net/linux/misc/zstd-1.5.6.tar.gz"
6+
mirror "http://fresh-center.net/linux/misc/legacy/zstd-1.5.6.tar.gz"
7+
sha256 "30f35f71c1203369dc979ecde0400ffea93c27391bfd2ac5a9715d2173d92ff7"
8+
license all_of: [
9+
{ any_of: ["BSD-3-Clause", "GPL-2.0-only"] },
10+
"BSD-2-Clause", # programs/zstdgrep, lib/libzstd.pc.in
11+
"MIT", # lib/dictBuilder/divsufsort.c
12+
]
13+
head "https://github.com/facebook/zstd.git", branch: "dev"
14+
15+
# The upstream repository contains old, one-off tags (5.5.5, 6.6.6) that are
16+
# higher than current versions, so we check the "latest" release instead.
17+
livecheck do
18+
url :stable
19+
strategy :github_latest
20+
end
21+
22+
bottle do
23+
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/zstd-1.5.6"
24+
sha256 cellar: :any_skip_relocation, aarch64_linux: "d1ad2634b12791c751384df62456e27b56b5f1fa7031e270cde780f7dfdd699d"
25+
end
26+
27+
depends_on "cmake" => :build
28+
depends_on "lz4"
29+
depends_on "xz"
30+
31+
uses_from_macos "zlib"
32+
33+
def install
34+
# Legacy support is the default after
35+
# https://github.com/facebook/zstd/commit/db104f6e839cbef94df4df8268b5fecb58471274
36+
# Set it to `ON` to be explicit about the configuration.
37+
system "cmake", "-S", "build/cmake", "-B", "builddir",
38+
"-DZSTD_PROGRAMS_LINK_SHARED=ON", # link `zstd` to `libzstd`
39+
"-DZSTD_BUILD_CONTRIB=ON",
40+
"-DCMAKE_INSTALL_RPATH=#{rpath}",
41+
"-DZSTD_LEGACY_SUPPORT=ON",
42+
"-DZSTD_ZLIB_SUPPORT=ON",
43+
"-DZSTD_LZMA_SUPPORT=ON",
44+
"-DZSTD_LZ4_SUPPORT=ON",
45+
"-DCMAKE_CXX_STANDARD=11",
46+
*std_cmake_args
47+
system "cmake", "--build", "builddir"
48+
system "cmake", "--install", "builddir"
49+
50+
# Prevent dependents from relying on fragile Cellar paths.
51+
# https://github.com/ocaml/ocaml/issues/12431
52+
inreplace lib/"pkgconfig/libzstd.pc", prefix, opt_prefix
53+
end
54+
55+
test do
56+
[bin/"zstd", bin/"pzstd", "xz", "lz4", "gzip"].each do |prog|
57+
data = "Hello, #{prog}"
58+
assert_equal data, pipe_output("#{bin}/zstd -d", pipe_output(prog, data))
59+
if prog.to_s.end_with?("zstd")
60+
# `pzstd` can only decompress zstd-compressed data.
61+
assert_equal data, pipe_output("#{bin}/pzstd -d", pipe_output(prog, data))
62+
else
63+
assert_equal data, pipe_output("#{prog} -d", pipe_output("#{bin}/zstd --format=#{prog}", data))
64+
end
65+
end
66+
end
67+
end

0 commit comments

Comments
 (0)