2010-11-09 10:31:21 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-26 15:49:34 +00:00
|
|
|
class Audiofile < Formula
|
2011-12-11 07:43:57 +00:00
|
|
|
url 'https://github.com/downloads/mpruett/audiofile/audiofile-0.3.2.tar.gz'
|
|
|
|
sha1 'fb55a3c9153475daa8932d3626797e033d149c1d'
|
2010-11-09 10:31:21 +00:00
|
|
|
homepage 'http://www.68k.org/~michael/audiofile/'
|
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'
|
|
|
|
conv_bin = "#{HOMEBREW_PREFIX}/bin/sfconvert"
|
|
|
|
info_bin = "#{HOMEBREW_PREFIX}/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
|
|
|
|
The test program couldn't locate one of these files that normally exist:
|
|
|
|
#{inn}
|
2012-02-05 18:17:04 +00:00
|
|
|
#{conv_bin}
|
|
|
|
#{info_bin}
|
|
|
|
#{hear_bin}
|
2011-09-14 21:21:08 +00:00
|
|
|
We are sorry for the mistake. Another test you can run on this software
|
|
|
|
will occur during install if you add --with-check like this:
|
|
|
|
|
|
|
|
EOS
|
|
|
|
oh1 ' brew rm audiofile'
|
|
|
|
oh1 ' brew -v install audiofile --with-check'
|
2012-02-05 18:17:04 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
mktemp do
|
|
|
|
system "#{conv_bin} #{inn} #{out} format wave"
|
|
|
|
system "#{info_bin} --short --reporterror #{out}"
|
|
|
|
system "#{hear_bin} -p #{out}" if ARGV.verbose?
|
|
|
|
puts
|
|
|
|
oh1 <<-EOS.undent
|
|
|
|
Cheers mate. You converted a system sound from the Audio
|
|
|
|
Interchange File Format \"aiff\" to the MS RIFF Wave format.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
2010-11-09 10:31:21 +00:00
|
|
|
end
|