2010-11-09 10:31:21 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-26 15:49:34 +00:00
|
|
|
class Audiofile < Formula
|
2010-11-09 10:31:21 +00:00
|
|
|
homepage 'http://www.68k.org/~michael/audiofile/'
|
2012-05-31 14:38:13 +00:00
|
|
|
url 'https://github.com/downloads/mpruett/audiofile/audiofile-0.3.4.tar.gz'
|
|
|
|
sha1 'e6f664b0d551df35ce0c10e38e5617bcd4605335'
|
2011-09-14 21:21:08 +00:00
|
|
|
|
|
|
|
depends_on 'lcov' if ARGV.include? '--with-lcov'
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--with-lcov', 'Enable Code Coverage support using lcov.'],
|
|
|
|
['--with-check', 'Run the test suite during install ~30sec']
|
|
|
|
]
|
|
|
|
end
|
2010-11-09 10:31:21 +00:00
|
|
|
|
|
|
|
def install
|
2011-09-14 21:21:08 +00:00
|
|
|
args = ["--prefix=#{prefix}", "--disable-dependency-tracking"]
|
|
|
|
args << '--enable-coverage' if ARGV.include? '--with-lcov'
|
|
|
|
system "./configure", *args
|
|
|
|
system "make"
|
|
|
|
system "make check" if ARGV.include? '--with-check'
|
2010-11-09 10:31:21 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
2011-09-14 21:21:08 +00:00
|
|
|
|
|
|
|
def test
|
|
|
|
inn = '/System/Library/Sounds/Glass.aiff'
|
|
|
|
out = 'Glass.wav'
|
2012-02-05 18:17:04 +00:00
|
|
|
hear_bin = '/usr/bin/qlmanage'
|
2012-05-06 06:02:49 +00:00
|
|
|
conv_bin = "#{bin}/sfconvert"
|
|
|
|
info_bin = "#{bin}/sfinfo"
|
2011-09-14 21:21:08 +00:00
|
|
|
|
2012-02-05 18:17:04 +00:00
|
|
|
unless File.exist?(conv_bin) and File.exist?(inn) and
|
|
|
|
File.exist?(hear_bin) and File.exist?(info_bin)
|
2011-09-14 21:21:08 +00:00
|
|
|
opoo <<-EOS.undent
|
2012-05-06 06:03:01 +00:00
|
|
|
One of the following files could not be located, and so
|
|
|
|
the test was not executed:
|
2011-09-14 21:21:08 +00:00
|
|
|
#{inn}
|
2012-02-05 18:17:04 +00:00
|
|
|
#{conv_bin}
|
|
|
|
#{info_bin}
|
|
|
|
#{hear_bin}
|
2011-09-14 21:21:08 +00:00
|
|
|
|
2012-05-06 06:03:01 +00:00
|
|
|
Audiofile can also be tested at build-time:
|
|
|
|
brew install -v audiofile --with-check
|
2011-09-14 21:21:08 +00:00
|
|
|
EOS
|
2012-02-05 18:17:04 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
mktemp do
|
2012-05-15 18:31:21 +00:00
|
|
|
system conv_bin, inn, out, 'format', 'wave'
|
|
|
|
system info_bin, '--short', '--reporterror', out
|
|
|
|
system hear_bin, '-p', out if ARGV.verbose?
|
2012-02-05 18:17:04 +00:00
|
|
|
end
|
|
|
|
end
|
2010-11-09 10:31:21 +00:00
|
|
|
end
|