2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-06-05 11:57:50 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Flac < Formula
|
2013-06-10 06:04:34 +00:00
|
|
|
homepage 'http://xiph.org/flac/'
|
|
|
|
url 'http://downloads.xiph.org/releases/flac/flac-1.3.0.tar.xz'
|
|
|
|
sha1 'a136e5748f8fb1e6c524c75000a765fc63bb7b1b'
|
2010-07-20 01:11:29 +00:00
|
|
|
|
2013-05-11 15:58:41 +00:00
|
|
|
option :universal
|
|
|
|
|
2013-06-10 06:04:34 +00:00
|
|
|
depends_on 'xz' => :build
|
2010-07-20 01:11:29 +00:00
|
|
|
depends_on 'lame'
|
2010-08-24 16:11:11 +00:00
|
|
|
depends_on 'libogg' => :optional
|
2013-10-24 17:47:22 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
|
|
|
depends_on 'libtool' => :build
|
|
|
|
depends_on 'automake' => :build
|
|
|
|
depends_on 'autoconf' => :build
|
2009-06-05 11:57:50 +00:00
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
fails_with :llvm do
|
|
|
|
build 2326
|
|
|
|
cause "Undefined symbols when linking"
|
|
|
|
end
|
2011-02-14 18:57:55 +00:00
|
|
|
|
2013-10-24 17:47:22 +00:00
|
|
|
def patches
|
|
|
|
#fixes compilation on mac os 10.9 maverick
|
|
|
|
[
|
|
|
|
"https://gist.github.com/leiflm/7139949/raw"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2011-03-21 21:24:22 +00:00
|
|
|
def install
|
2013-05-11 15:58:41 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
|
|
|
|
2013-05-02 04:36:21 +00:00
|
|
|
# sadly the asm optimisations won't compile since Leopard
|
2013-10-24 17:47:22 +00:00
|
|
|
system "./autogen.sh"
|
2013-05-11 15:58:41 +00:00
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
|
|
"--disable-debug",
|
2009-08-07 14:41:43 +00:00
|
|
|
"--disable-asm-optimizations",
|
2010-07-20 01:11:29 +00:00
|
|
|
"--enable-sse",
|
2013-06-10 06:04:34 +00:00
|
|
|
"--enable-static",
|
2009-08-07 14:41:43 +00:00
|
|
|
"--prefix=#{prefix}",
|
2010-02-15 22:51:38 +00:00
|
|
|
"--mandir=#{man}"
|
2009-07-31 13:04:49 +00:00
|
|
|
ENV['OBJ_FORMAT']='macho'
|
2013-05-11 15:58:41 +00:00
|
|
|
|
|
|
|
# adds universal flags to the generated libtool script
|
|
|
|
inreplace "libtool" do |s|
|
2013-08-02 03:40:42 +00:00
|
|
|
s.gsub! ":$verstring\"", ":$verstring -arch #{Hardware::CPU.arch_32_bit} -arch #{Hardware::CPU.arch_64_bit}\""
|
2013-05-11 15:58:41 +00:00
|
|
|
end
|
|
|
|
|
2009-07-31 13:04:49 +00:00
|
|
|
system "make install"
|
2013-06-13 18:34:52 +00:00
|
|
|
(bin/'flac2mp3').write DATA.read
|
2009-06-05 11:57:50 +00:00
|
|
|
end
|
2011-02-14 18:57:55 +00:00
|
|
|
end
|
2013-06-13 18:34:52 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
#!/usr/bin/env ruby
|
|
|
|
# http://gist.github.com/gists/2998853/
|
|
|
|
# Forked from http://gist.github.com/gists/124242
|
|
|
|
|
|
|
|
filename, quality = ARGV[0], ARGV[1]
|
|
|
|
abort "Usage: flac2mp3 FLACFILE [V2|V1|V0|320]\nDefault (and recommended) quality is V0." if filename.nil?
|
|
|
|
|
|
|
|
qualarg = case quality
|
|
|
|
when "V0","V1","V2" then quality
|
|
|
|
when "320" then "b 320"
|
|
|
|
else "V0"
|
|
|
|
end
|
|
|
|
|
|
|
|
map = {"TITLE" => "--tt", "ARTIST" => "--ta", "ALBUM" => "--tl", "TRACKNUMBER" => "--tn", "GENRE" => "--tg", "DATE" => "--ty"}
|
|
|
|
args = ""
|
|
|
|
|
|
|
|
`metaflac --export-tags-to=- "#{filename}"`.each_line do |line|
|
|
|
|
key, value = line.strip.split('=', 2)
|
|
|
|
key.upcase!
|
|
|
|
args << %Q{#{map[key]} "#{value.gsub('"', '\"')}" } if map[key]
|
|
|
|
end
|
|
|
|
|
|
|
|
basename = File.basename(filename, File.extname(filename))
|
|
|
|
|
|
|
|
puts "Encoding #{basename}.mp3"
|
|
|
|
exec %Q[flac -sdc "#{filename}" | lame -#{qualarg} #{args} - "#{basename}.mp3"]
|