aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/zpaq.rb
blob: 3fab88d3fa825532633692ed31c9038b9469b76d (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
require "formula"

class Zpaq < Formula
  homepage "http://mattmahoney.net/dc/zpaq.html"
  url "http://mattmahoney.net/dc/zpaq649.zip"
  sha1 "aa0d8241679f314d0be8a43e7a87e5b4d4529017"
  version "6.49"

  def install
    ENV.append_to_cflags "-Dunix -O3"
    system "make", "libzpaq.o", "divsufsort.o", "zpaq.o"
    system "ar", "-r", "libzpaq.a", "libzpaq.o", "divsufsort.o"
    system ENV.cxx, "-o", "zpaq", "libzpaq.a", "zpaq.o"
    lib.install "libzpaq.a"
    include.install "libzpaq.h"
    bin.install "zpaq"
  end

  test do
    archive = testpath/'test.zpaq'
    zpaq = bin/"zpaq"
    system zpaq, "a", archive, "#{include}/libzpaq.h"
    system zpaq, "t", archive
    assert_equal "7kSt", archive.read(4)
  end
end