class Lz4 < Formula desc "Extremely Fast Compression algorithm" homepage "https://lz4.github.io/lz4/" url "https://github.com/lz4/lz4/archive/refs/tags/v1.10.0.tar.gz" mirror "http://fresh-center.net/linux/misc/lz4-1.10.0.tar.gz" mirror "http://fresh-center.net/linux/misc/legacy/lz4-1.10.0.tar.gz" sha256 "537512904744b35e232912055ccf8ec66d768639ff3abe5788d90d792ec5f48b" license "BSD-2-Clause" head "https://github.com/lz4/lz4.git", branch: "dev" livecheck do url :stable strategy :github_latest end def install system "make", "install", "PREFIX=#{prefix}" # Prevent dependents from hardcoding Cellar paths. inreplace lib/"pkgconfig/liblz4.pc", prefix, opt_prefix end test do input = "testing compression and decompression" input_file = testpath/"in" input_file.write input output_file = testpath/"out" system "sh", "-c", "cat #{input_file} | #{bin}/lz4 | #{bin}/lz4 -d > #{output_file}" assert_equal output_file.read, input end end