aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/rdup.rb
blob: 90b7da226b3ab29c6e2bbb441fe6fe9e506ca8fe (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
39
40
41
42
43
44
45
46
47
48
49
require 'formula'

class LibarchiveHeader < Formula
  url 'https://raw.github.com/libarchive/libarchive/8076b31490c90aaf0edccecf760004c30bd95edc/libarchive/archive.h'
  sha1 '03c57e135cad9ca9d52604324d798ca1115838ce'
  version '3.0.4'
end
class LibarchiveEntryHeader < Formula
  url 'https://raw.github.com/libarchive/libarchive/8076b31490c90aaf0edccecf760004c30bd95edc/libarchive/archive_entry.h'
  sha1 '7eaee18321409fbb249cb59e9997757c740d7ecf'
  version '3.0.4'
end

class Rdup < Formula
  homepage 'http://miek.nl/projects/rdup/index.html'
  url 'http://miek.nl/projects/rdup/rdup-1.1.14.tar.bz2'
  sha1 '49dc7570122bfa362f36a26a2ffa8bfe8ad55182'

  depends_on 'pkg-config' => :build
  depends_on 'automake' => :build
  depends_on 'nettle'
  depends_on 'pcre'
  depends_on 'glib'

  def install
    ENV.deparallelize
    # to pick up locally downloaded libarchive headers
    ENV.append 'CFLAGS', "-I."

    system "./configure", "--prefix=#{prefix}"

    # let rdup know that we actually have dirfd
    system "echo '#define HAVE_DIRFD 1' >> config.h"

    # get required libarchive headers (they don't come with OS X,
    #   although libarchive itself is there)
    LibarchiveHeader.new.brew { cp "archive.h", buildpath }
    LibarchiveEntryHeader.new.brew { cp "archive_entry.h", buildpath }

    system "make", "install"
  end

  def test
    # tell rdup to archive itself, then let rdup-tr make a tar archive of it,
    # and test with tar and grep whether the resulting tar archive actually
    # contains rdup
    system "#{bin}/rdup /dev/null #{bin}/rdup | #{bin}/rdup-tr -O tar | tar tvf - | grep #{bin}/rdup"
  end
end