Skip to content

Commit

Permalink
zstd: update 1.5.6 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Sep 4, 2024
1 parent 6e1916e commit 9f6bfb7
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions Formula/z/zstd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
class Zstd < Formula
desc "Zstandard is a real-time compression algorithm"
homepage "https://facebook.github.io/zstd/"
url "https://github.com/facebook/zstd/archive/refs/tags/v1.5.6.tar.gz"
mirror "http://fresh-center.net/linux/misc/zstd-1.5.6.tar.gz"
mirror "http://fresh-center.net/linux/misc/legacy/zstd-1.5.6.tar.gz"
sha256 "30f35f71c1203369dc979ecde0400ffea93c27391bfd2ac5a9715d2173d92ff7"
license all_of: [
{ any_of: ["BSD-3-Clause", "GPL-2.0-only"] },
"BSD-2-Clause", # programs/zstdgrep, lib/libzstd.pc.in
"MIT", # lib/dictBuilder/divsufsort.c
]
head "https://github.com/facebook/zstd.git", branch: "dev"

# The upstream repository contains old, one-off tags (5.5.5, 6.6.6) that are
# higher than current versions, so we check the "latest" release instead.
livecheck do
url :stable
strategy :github_latest
end

bottle do
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/zstd-1.5.6"
sha256 cellar: :any_skip_relocation, aarch64_linux: "d1ad2634b12791c751384df62456e27b56b5f1fa7031e270cde780f7dfdd699d"
end

depends_on "cmake" => :build
depends_on "lz4"
depends_on "xz"

uses_from_macos "zlib"

def install
# Legacy support is the default after
# https://github.com/facebook/zstd/commit/db104f6e839cbef94df4df8268b5fecb58471274
# Set it to `ON` to be explicit about the configuration.
system "cmake", "-S", "build/cmake", "-B", "builddir",
"-DZSTD_PROGRAMS_LINK_SHARED=ON", # link `zstd` to `libzstd`
"-DZSTD_BUILD_CONTRIB=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
"-DZSTD_LEGACY_SUPPORT=ON",
"-DZSTD_ZLIB_SUPPORT=ON",
"-DZSTD_LZMA_SUPPORT=ON",
"-DZSTD_LZ4_SUPPORT=ON",
"-DCMAKE_CXX_STANDARD=11",
*std_cmake_args
system "cmake", "--build", "builddir"
system "cmake", "--install", "builddir"

# Prevent dependents from relying on fragile Cellar paths.
# https://github.com/ocaml/ocaml/issues/12431
inreplace lib/"pkgconfig/libzstd.pc", prefix, opt_prefix
end

test do
[bin/"zstd", bin/"pzstd", "xz", "lz4", "gzip"].each do |prog|
data = "Hello, #{prog}"
assert_equal data, pipe_output("#{bin}/zstd -d", pipe_output(prog, data))
if prog.to_s.end_with?("zstd")
# `pzstd` can only decompress zstd-compressed data.
assert_equal data, pipe_output("#{bin}/pzstd -d", pipe_output(prog, data))
else
assert_equal data, pipe_output("#{prog} -d", pipe_output("#{bin}/zstd --format=#{prog}", data))
end
end
end
end

0 comments on commit 9f6bfb7

Please sign in to comment.