-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
af55058
commit 6bc2cfe
Showing
5 changed files
with
264 additions
and
16 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
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,69 @@ | ||
class Bzip2 < Formula | ||
desc "Freely available high-quality data compressor" | ||
homepage "https://sourceware.org/bzip2/" | ||
url "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz" | ||
sha256 "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269" | ||
license "bzip2-1.0.6" | ||
|
||
livecheck do | ||
url "https://sourceware.org/pub/bzip2/" | ||
regex(/href=.*?bzip2[._-]v?(\d+(?:\.\d+)+)\.t/i) | ||
end | ||
|
||
bottle do | ||
rebuild 2 | ||
sha256 cellar: :any_skip_relocation, arm64_sonoma: "f148a0cf9cec0d1711b5bd16c18047e0a9933acec37bfec30a182f29ae364577" | ||
sha256 cellar: :any_skip_relocation, arm64_ventura: "52f70f97b2f8f2c6bc309e55970ed03ccd1b8110cf5f15fc16c2a930180a99f7" | ||
sha256 cellar: :any_skip_relocation, arm64_monterey: "bcc8f2e728b154d43e76e8e81f77e934d905b8868b7be69e3b9b40b5868f7c34" | ||
sha256 cellar: :any_skip_relocation, arm64_big_sur: "12f184d77bb72cc7d9278af9bd34fd74c610f7aa144559e2aa2d9f4a4b09bd76" | ||
sha256 cellar: :any_skip_relocation, sonoma: "0aa9de4f40daf644d2c5745e35a20fac2babda8df0218e58bd471d0132ba8457" | ||
sha256 cellar: :any_skip_relocation, ventura: "2cf2591f8865d9a806736a6f1b74f0905477b5520dd730f025aa12d4c5e0749b" | ||
sha256 cellar: :any_skip_relocation, monterey: "fc4dd056738e20b1c850c6834405e27071a992f7671137306c1764c7c0eef350" | ||
sha256 cellar: :any_skip_relocation, big_sur: "d222e089bf7b4ab714b150ad754cb76b88b548f57c4bdbbaa4857d6e0541a096" | ||
sha256 cellar: :any_skip_relocation, x86_64_linux: "a731afa70daaafec28359b4f10f1c68455c1955ae66cdbb6b6d52eee277bbd3e" | ||
end | ||
|
||
keg_only :provided_by_macos | ||
|
||
def install | ||
inreplace "Makefile", "$(PREFIX)/man", "$(PREFIX)/share/man" | ||
|
||
system "make", "install", "PREFIX=#{prefix}" | ||
return if OS.mac? | ||
|
||
# Install shared libraries | ||
system "make", "-f", "Makefile-libbz2_so", "clean" | ||
system "make", "-f", "Makefile-libbz2_so" | ||
lib.install "libbz2.so.#{version}", "libbz2.so.#{version.major_minor}" | ||
lib.install_symlink "libbz2.so.#{version}" => "libbz2.so.#{version.major}" | ||
lib.install_symlink "libbz2.so.#{version}" => "libbz2.so" | ||
|
||
# Create pkgconfig file based on 1.1.x repository. | ||
# https://gitlab.com/bzip2/bzip2/-/blob/master/bzip2.pc.in | ||
(lib/"pkgconfig/bzip2.pc").write <<~EOS | ||
prefix=#{opt_prefix} | ||
exec_prefix=${prefix} | ||
bindir=${exec_prefix}/bin | ||
libdir=${exec_prefix}/lib | ||
includedir=${prefix}/include | ||
Name: bzip2 | ||
Description: Lossless, block-sorting data compression | ||
Version: #{version} | ||
Libs: -L${libdir} -lbz2 | ||
Cflags: -I${includedir} | ||
EOS | ||
end | ||
|
||
test do | ||
testfilepath = testpath + "sample_in.txt" | ||
zipfilepath = testpath + "sample_in.txt.bz2" | ||
|
||
testfilepath.write "TEST CONTENT" | ||
|
||
system "#{bin}/bzip2", testfilepath | ||
system "#{bin}/bunzip2", zipfilepath | ||
|
||
assert_equal "TEST CONTENT", testfilepath.read | ||
end | ||
end |
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,118 @@ | ||
class Unzip < Formula | ||
desc "Extraction utility for .zip compressed archives" | ||
homepage "https://infozip.sourceforge.net/UnZip.html" | ||
url "https://downloads.sourceforge.net/project/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz" | ||
version "6.0" | ||
sha256 "036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37" | ||
license "Info-ZIP" | ||
revision 8 | ||
|
||
livecheck do | ||
url :stable | ||
regex(%r{url=.*?(?:%20)?v?(\d+(?:\.\d+)+)/unzip\d+\.t}i) | ||
end | ||
|
||
bottle do | ||
sha256 cellar: :any_skip_relocation, arm64_sonoma: "09f467768e0ed9226eebc40f40fd5628c7f9cfa5f314b483751bbf0bf4d05bab" | ||
sha256 cellar: :any_skip_relocation, arm64_ventura: "9f7f6a03fa3ada4a305f5c9b4016b4e8bbe11d66f559273849d8cacd26524e26" | ||
sha256 cellar: :any_skip_relocation, arm64_monterey: "1df3fd1e9b3f5fd816f793355797818113e43378c81e6a0a6a8d1b3e52c0dd36" | ||
sha256 cellar: :any_skip_relocation, arm64_big_sur: "a6cdeb65d1d235eb609cb7ae5b5df19f0c9b20d572661bb3501658f1d5b2d5ef" | ||
sha256 cellar: :any_skip_relocation, sonoma: "4d0a7fbb4f53486b0a9f25f00d0903f52eea8778fdbb0e497fb4ce5ba49c7510" | ||
sha256 cellar: :any_skip_relocation, ventura: "5f332be4c6b05a05a90835e7bef6c93b6b57edcd0cba1571bcdedddb27300fb9" | ||
sha256 cellar: :any_skip_relocation, monterey: "86fbf9a289406fbe3fff052c0818431d757b6123e5776418c3e13370ee2d4af9" | ||
sha256 cellar: :any_skip_relocation, big_sur: "94f235026d1d96ebb52961dcfb6880701d11efdc9cd9869987f8e4712714f9a5" | ||
sha256 cellar: :any_skip_relocation, catalina: "b6cb709857bee04881acb626d24ddb1dcccf50b4508c16a9599625667b4b7617" | ||
sha256 cellar: :any_skip_relocation, x86_64_linux: "baf15e19852a0f9756e3302fa6f3866eaeccc06730c9907bffc19f32861d64bf" | ||
end | ||
|
||
keg_only :provided_by_macos | ||
|
||
uses_from_macos "zip" => :test | ||
uses_from_macos "bzip2" | ||
|
||
# Upstream is unmaintained so we use the Ubuntu patchset: | ||
# https://packages.ubuntu.com/kinetic/unzip | ||
patch do | ||
url "http://archive.ubuntu.com/ubuntu/pool/main/u/unzip/unzip_6.0-27ubuntu1.debian.tar.xz" | ||
sha256 "9249780437220a5dc81518f2e4c5213b502bf56899c03992572cf9bb5caf724e" | ||
apply %w[ | ||
patches/01-manpages-in-section-1-not-in-section-1l.patch | ||
patches/02-this-is-debian-unzip.patch | ||
patches/03-include-unistd-for-kfreebsd.patch | ||
patches/04-handle-pkware-verification-bit.patch | ||
patches/05-fix-uid-gid-handling.patch | ||
patches/06-initialize-the-symlink-flag.patch | ||
patches/07-increase-size-of-cfactorstr.patch | ||
patches/08-allow-greater-hostver-values.patch | ||
patches/09-cve-2014-8139-crc-overflow.patch | ||
patches/10-cve-2014-8140-test-compr-eb.patch | ||
patches/11-cve-2014-8141-getzip64data.patch | ||
patches/12-cve-2014-9636-test-compr-eb.patch | ||
patches/13-remove-build-date.patch | ||
patches/14-cve-2015-7696.patch | ||
patches/15-cve-2015-7697.patch | ||
patches/16-fix-integer-underflow-csiz-decrypted.patch | ||
patches/17-restore-unix-timestamps-accurately.patch | ||
patches/18-cve-2014-9913-unzip-buffer-overflow.patch | ||
patches/19-cve-2016-9844-zipinfo-buffer-overflow.patch | ||
patches/20-cve-2018-1000035-unzip-buffer-overflow.patch | ||
patches/20-unzip60-alt-iconv-utf8.patch | ||
patches/21-fix-warning-messages-on-big-files.patch | ||
patches/22-cve-2019-13232-fix-bug-in-undefer-input.patch | ||
patches/23-cve-2019-13232-zip-bomb-with-overlapped-entries.patch | ||
patches/24-cve-2019-13232-do-not-raise-alert-for-misplaced-central-directory.patch | ||
patches/25-cve-2019-13232-fix-bug-in-uzbunzip2.patch | ||
patches/26-cve-2019-13232-fix-bug-in-uzinflate.patch | ||
patches/27-zipgrep-avoid-test-errors.patch | ||
patches/28-cve-2022-0529-and-cve-2022-0530.patch | ||
] | ||
end | ||
|
||
def install | ||
# These macros also follow Ubuntu, and are required: | ||
# - to correctly handle large archives (> 4GB) | ||
# - extract & print archive contents with non-latin characters | ||
loc_macros = %w[ | ||
-DLARGE_FILE_SUPPORT | ||
-DUNICODE_SUPPORT | ||
-DUNICODE_WCHAR | ||
-DUTF8_MAYBE_NATIVE | ||
-DNO_WORKING_ISPRINT | ||
] | ||
args = %W[ | ||
CC=#{ENV.cc} | ||
LOC=#{loc_macros.join(" ")} | ||
D_USE_BZ2=-DUSE_BZIP2 | ||
L_BZ2=-lbz2 | ||
macosx | ||
] | ||
args << "LFLAGS1=-liconv" if OS.mac? | ||
system "make", "-f", "unix/Makefile", *args | ||
system "make", "prefix=#{prefix}", "MANDIR=#{man1}", "install" | ||
end | ||
|
||
test do | ||
(testpath/"test1").write "Hello!" | ||
(testpath/"test2").write "Bonjour!" | ||
(testpath/"test3").write "Hej!" | ||
|
||
if OS.mac? | ||
system "/usr/bin/zip", "test.zip", "test1", "test2", "test3" | ||
else | ||
system Formula["zip"].bin/"zip", "test.zip", "test1", "test2", "test3" | ||
end | ||
%w[test1 test2 test3].each do |f| | ||
rm f | ||
refute_predicate testpath/f, :exist?, "Text files should have been removed!" | ||
end | ||
|
||
system bin/"unzip", "test.zip" | ||
%w[test1 test2 test3].each do |f| | ||
assert_predicate testpath/f, :exist?, "Failure unzipping test.zip!" | ||
end | ||
|
||
assert_match "Hello!", File.read(testpath/"test1") | ||
assert_match "Bonjour!", File.read(testpath/"test2") | ||
assert_match "Hej!", File.read(testpath/"test3") | ||
end | ||
end |
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,63 @@ | ||
# Upstream project has requested we use a mirror as the main URL | ||
# https://github.com/Homebrew/legacy-homebrew/pull/21419 | ||
class Xz < Formula | ||
desc "General-purpose data compression with high compression ratio" | ||
homepage "https://tukaani.org/xz/" | ||
# The archive.org mirror below needs to be manually created at `archive.org`. | ||
url "https://downloads.sourceforge.net/project/lzmautils/xz-5.4.4.tar.gz" | ||
mirror "https://tukaani.org/xz/xz-5.4.4.tar.gz" | ||
mirror "https://archive.org/download/xz-5.4.4/xz-5.4.4.tar.gz" | ||
mirror "http://archive.org/download/xz-5.4.4/xz-5.4.4.tar.gz" | ||
sha256 "aae39544e254cfd27e942d35a048d592959bd7a79f9a624afb0498bb5613bdf8" | ||
license all_of: [ | ||
:public_domain, | ||
"LGPL-2.1-or-later", | ||
"GPL-2.0-or-later", | ||
"GPL-3.0-or-later", | ||
] | ||
|
||
bottle do | ||
sha256 cellar: :any, arm64_sonoma: "2e78578e241975899342fa4ad4ca4315a4e74117696af09440cf2ce485febebb" | ||
sha256 cellar: :any, arm64_ventura: "ba318d89eea54f33cc3613b1cb69ca4217a8f961e59026418e569e8421afbb8c" | ||
sha256 cellar: :any, arm64_monterey: "c8a9e7812c258a3b5043c0207b8044ba099a0a4a97d3ab5314a0dbd171fff3f4" | ||
sha256 cellar: :any, arm64_big_sur: "1857edbbd38cff88854e529670e708e6d87e9d01641e291efee79cafa82fe5b2" | ||
sha256 cellar: :any, sonoma: "bc3b9885851178a5363c88917f7a439af880ec4ecdac24b0061608c5963b6bf6" | ||
sha256 cellar: :any, ventura: "4c25f68798c0b4c9b869e78fdfbd9cd7f8f723c51ea56d643b5644456288d69e" | ||
sha256 cellar: :any, monterey: "39a76706744e6f78f883c38e800d277bc6df71186313cc5fa362072d6c79f991" | ||
sha256 cellar: :any, big_sur: "7bc66bbf17c331e226b65947a7b2c326a883bc70ccdd13127802612713ae1cc2" | ||
sha256 x86_64_linux: "f68637417bc856ba59f1ec25f7fcb0ccba14a9d53557837dcf2ab0ddb652fb8b" | ||
end | ||
|
||
def install | ||
system "./configure", "--disable-debug", | ||
"--disable-dependency-tracking", | ||
"--disable-silent-rules", | ||
"--prefix=#{prefix}" | ||
system "make", "check" | ||
system "make", "install" | ||
end | ||
|
||
test do | ||
path = testpath/"data.txt" | ||
original_contents = "." * 1000 | ||
path.write original_contents | ||
|
||
# compress: data.txt -> data.txt.xz | ||
system bin/"xz", path | ||
refute_predicate path, :exist? | ||
|
||
# decompress: data.txt.xz -> data.txt | ||
system bin/"xz", "-d", "#{path}.xz" | ||
assert_equal original_contents, path.read | ||
|
||
# Check that http mirror works | ||
xz_tar = testpath/"xz.tar.gz" | ||
stable.mirrors.each do |mirror| | ||
next if mirror.start_with?("https") | ||
|
||
xz_tar.unlink if xz_tar.exist? | ||
system "curl", "--location", mirror, "--output", xz_tar | ||
assert_equal stable.checksum.hexdigest, xz_tar.sha256 | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.