class Snappy < Formula desc "Compression/decompression library aiming for high speed" homepage "https://google.github.io/snappy/" url "https://github.com/google/snappy/releases/download/1.1.4/snappy-1.1.4.tar.gz" sha256 "134bfe122fd25599bb807bb8130e7ba6d9bdb851e0b16efcb83ac4f5d0b70057" bottle do cellar :any sha256 "c0db3b0eb4ca734ce33c312e28a736d8a3ba642a022267060892141e3f6f2bcb" => :sierra sha256 "171e6724d109bed4cc95b6a843c2637fa0f5ed301dda5063a89b1353c1282488" => :yosemite end head do url "https://github.com/google/snappy.git" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build def install ENV.deparallelize if build.stable? system "./autogen.sh" if build.head? system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do (testpath/"test.cpp").write <<-EOS.undent #include #include #include using namespace std; using namespace snappy; int main() { string source = "Hello World!"; string compressed, decompressed; Compress(source.data(), source.size(), &compressed); Uncompress(compressed.data(), compressed.size(), &decompressed); assert(source == decompressed); return 0; } EOS system ENV.cxx, "test.cpp", "-L#{lib}", "-lsnappy", "-o", "test" system "./test" end end