aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/audiofile.rb
blob: 637dc432d88ae4bf732f024216087d701ded42e9 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class Audiofile < Formula
  homepage "http://www.68k.org/~michael/audiofile/"
  url "http://audiofile.68k.org/audiofile-0.3.6.tar.gz"
  sha1 "3aba3ef724b1b5f88cfc20ab9f8ce098e6c35a0e"

  bottle do
    cellar :any
    sha1 "3ee5b808776b2ee6269aad02db795e8da61fa181" => :yosemite
    sha1 "a15e1ae96b15c18c62cfd19e387eb5d21f0992f2" => :mavericks
    sha1 "9994dc853442647fee82bf7291df0a2d35b93d16" => :mountain_lion
  end

  head do
    url "https://github.com/mpruett/audiofile.git"
    depends_on "asciidoc" => :build
    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
  end

  option "with-lcov", "Enable Code Coverage support using lcov"
  option "with-check", "Run the test suite during install ~30sec"

  depends_on "lcov" => :optional

  def install
    if build.head?
      inreplace "autogen.sh", "libtool", "glibtool"
      ENV["XML_CATALOG_FILES"] = "#{HOMEBREW_PREFIX}/etc/xml/catalog"
    end

    configure = build.head? ? "./autogen.sh" : "./configure"
    args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
    args << "--enable-coverage" if build.with? "lcov"
    system configure, *args
    system "make"
    system "make", "check" if build.with? "check"
    system "make", "install"
  end

  test do
    inn  = "/System/Library/Sounds/Glass.aiff"
    out  = "Glass.wav"
    conv_bin = "#{bin}/sfconvert"
    info_bin = "#{bin}/sfinfo"

    unless File.exist?(conv_bin) and File.exist?(inn) and File.exist?(info_bin)
      opoo <<-EOS.undent
        One of the following files could not be located, and so
        the test was not executed:
           #{inn}
           #{conv_bin}
           #{info_bin}

        Audiofile can also be tested at build-time:
          brew install -v audiofile --with-check
      EOS
      return
    end

    system conv_bin, inn, out, "format", "wave"
    system info_bin, "--short", "--reporterror", out
  end
end