aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/lzip.rb
blob: 778465bdaed756e143e0d3af3cb4667126d2ad27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require "formula"

class Lzip < Formula
  homepage "http://www.nongnu.org/lzip/lzip.html"
  url "http://download.savannah.gnu.org/releases/lzip/lzip-1.16.tar.gz"
  sha1 "5bcefbb788305db7be9748d3c0478156518f1025"

  bottle do
    cellar :any
    revision 1
    sha1 "c67e7822fbd4a7f2211b01fbfe85b7ada52ebfd5" => :yosemite
    sha1 "61fe16d13397bb6713c3e60ce72ec63656db6055" => :mavericks
    sha1 "6f8cb35b3a5068c83bc819c4c0d05d3fab366739" => :mountain_lion
  end

  def install
    system "./configure", "--prefix=#{prefix}",
                          "CXX=#{ENV.cxx}",
                          "CXXFLAGS=#{ENV.cflags}"
    system "make", "check"
    ENV.j1
    system "make", "install"
  end

  test do
    path = testpath/"data.txt"
    original_contents = "." * 1000
    path.write original_contents

    # compress: data.txt -> data.txt.lz
    system "#{bin}/lzip", path
    assert !path.exist?

    # decompress: data.txt.lz -> data.txt
    system "#{bin}/lzip", "-d", "#{path}.lz"
    assert_equal original_contents, path.read
  end
end