diff --git a/Aliases/7-zip b/Aliases/7-zip new file mode 120000 index 00000000000..3aebe4b978f --- /dev/null +++ b/Aliases/7-zip @@ -0,0 +1 @@ +../Formula/sevenzip.rb \ No newline at end of file diff --git a/Aliases/7zip b/Aliases/7zip new file mode 120000 index 00000000000..3aebe4b978f --- /dev/null +++ b/Aliases/7zip @@ -0,0 +1 @@ +../Formula/sevenzip.rb \ No newline at end of file diff --git a/Formula/sevenzip.rb b/Formula/sevenzip.rb new file mode 100644 index 00000000000..72fe6383d7f --- /dev/null +++ b/Formula/sevenzip.rb @@ -0,0 +1,33 @@ +class Sevenzip < Formula + desc "7-Zip is a file archiver with a high compression ratio" + homepage "https://7-zip.org" + url "https://7-zip.org/a/7z2106-src.7z" + version "21.06" + sha256 "675eaa90de3c6a3cd69f567bba4faaea309199ca75a6ad12bac731dcdae717ac" + license all_of: ["LGPL-2.1-or-later", "BSD-3-Clause"] + + def install + cd "CPP/7zip/Bundles/Alone2" do + mac_suffix = Hardware::CPU.intel? ? "x64" : Hardware::CPU.arch + mk_suffix, directory = if OS.mac? + ["mac_#{mac_suffix}", "m_#{mac_suffix}"] + else + ["gcc", "g"] + end + + system "make", "-f", "../../cmpl_#{mk_suffix}.mak" + + # Cherry pick the binary manually. This should be changed to something + # like `make install' if the upstream adds an install target. + # See: https://sourceforge.net/p/sevenzip/discussion/45797/thread/1d5b04f2f1/ + bin.install "b/#{directory}/7zz" + end + end + + test do + (testpath/"foo.txt").write("hello world!\n") + system bin/"7zz", "a", "-t7z", "foo.7z", "foo.txt" + system bin/"7zz", "e", "foo.7z", "-oout" + assert_equal "hello world!\n", (testpath/"out/foo.txt").read + end +end