homebrew-core/Formula/unrar.rb
2018-10-05 09:22:05 +02:00

43 lines
1.5 KiB
Ruby

class Unrar < Formula
desc "Extract, view, and test RAR archives"
homepage "https://www.rarlab.com/"
url "https://www.rarlab.com/rar/unrarsrc-5.6.8.tar.gz"
sha256 "a4cc0ac14a354827751912d2af4a0a09e2c2129df5766576fa7e151791dd3dff"
bottle do
cellar :any
sha256 "7e0be06e3eaff12ffe15077e7cba64e28724455fd0610181682ea758d4061fa2" => :mojave
sha256 "5c95916f59938cdf07802ffbf0bf4aa6bac7f052b9911ecfff7281f6cdb924e7" => :high_sierra
sha256 "63beb3bbeb7661646a1c11700f86273c51ba810a3e9e6accd3b6d68d91d30560" => :sierra
end
def install
# upstream doesn't particularly care about their unix targets,
# so we do the dirty work of renaming their shared objects to
# dylibs for them.
inreplace "makefile", "libunrar.so", "libunrar.dylib"
system "make"
# Explicitly clean up for the library build to avoid an issue with an
# apparent implicit clean which confuses the dependencies.
system "make", "clean"
system "make", "lib"
bin.install "unrar"
lib.install "libunrar.dylib"
end
test do
contentpath = "directory/file.txt"
rarpath = testpath/"archive.rar"
data = "UmFyIRoHAM+QcwAADQAAAAAAAACaCHQggDIACQAAAAkAAAADtPej1LZwZE" \
"QUMBIApIEAAGRpcmVjdG9yeVxmaWxlLnR4dEhvbWVicmV3CsQ9ewBABwA="
rarpath.write data.unpack("m").first
assert_equal contentpath, `#{bin}/unrar lb #{rarpath}`.strip
assert_equal 0, $CHILD_STATUS.exitstatus
system "#{bin}/unrar", "x", rarpath, testpath
assert_equal "Homebrew\n", (testpath/contentpath).read
end
end