2011-03-10 05:11:03 +00:00
|
|
|
class Flac < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Free lossless audio codec"
|
2014-11-27 04:21:22 +00:00
|
|
|
homepage "https://xiph.org/flac/"
|
2014-11-27 04:19:58 +00:00
|
|
|
url "http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "4773c0099dba767d963fd92143263be338c48702172e8754b9bc5103efe1c56c"
|
2014-05-16 10:41:47 +00:00
|
|
|
|
2014-02-22 19:14:36 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-09-21 13:04:04 +00:00
|
|
|
sha256 "ba87fb6e7919f334b04745d5c075f5ae12a5374b3b7edd0514cc62d9f8ad28c8" => :el_capitan
|
2015-11-19 15:45:31 +00:00
|
|
|
sha256 "b5c4e452287e0aaf9355fd8f13849450edceca1b63d2401a0aa42d9c3344c143" => :yosemite
|
|
|
|
sha256 "a9caf29aa44208d98d4f885ba78e6d6d3bf56725748007a1cb9e0339631e807e" => :mavericks
|
|
|
|
sha256 "738f8ba2670b9eff4c0ff794813a86841934f6791ce393d9833f1cef56cb8e25" => :mountain_lion
|
2014-02-22 19:14:36 +00:00
|
|
|
end
|
|
|
|
|
2015-10-05 13:50:21 +00:00
|
|
|
head do
|
|
|
|
url "https://git.xiph.org/flac.git"
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
|
|
|
end
|
|
|
|
|
2013-05-11 15:58:41 +00:00
|
|
|
option :universal
|
|
|
|
|
2014-05-16 10:41:47 +00:00
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "libogg" => :optional
|
2013-10-25 05:57:09 +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
|
|
|
|
2014-12-12 05:26:47 +00:00
|
|
|
fails_with :clang do
|
|
|
|
build 500
|
|
|
|
cause "Undefined symbols ___cpuid and ___cpuid_count"
|
|
|
|
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?
|
|
|
|
|
2014-05-16 10:41:47 +00:00
|
|
|
ENV.append "CFLAGS", "-std=gnu89"
|
|
|
|
|
2014-03-10 00:46:21 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--disable-debug
|
|
|
|
--prefix=#{prefix}
|
|
|
|
--mandir=#{man}
|
|
|
|
--enable-sse
|
|
|
|
--enable-static
|
|
|
|
]
|
|
|
|
|
2014-12-05 16:49:44 +00:00
|
|
|
args << "--disable-asm-optimizations" if build.universal? || Hardware.is_32_bit?
|
2014-03-10 00:46:21 +00:00
|
|
|
args << "--without-ogg" if build.without? "libogg"
|
|
|
|
|
2014-12-05 16:49:44 +00:00
|
|
|
system "./autogen.sh" if build.head?
|
2014-03-10 00:46:21 +00:00
|
|
|
system "./configure", *args
|
|
|
|
|
2014-08-08 09:04:27 +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
|
|
|
|
|
2014-08-08 09:04:27 +00:00
|
|
|
system "make", "install"
|
2009-06-05 11:57:50 +00:00
|
|
|
end
|
2014-12-27 22:18:40 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
raw_data = "pseudo audio data that stays the same \x00\xff\xda"
|
|
|
|
(testpath/"in.raw").write raw_data
|
|
|
|
# encode and decode
|
|
|
|
system "#{bin}/flac", "--endian=little", "--sign=signed", "--channels=1", "--bps=8", "--sample-rate=8000", "--output-name=in.flac", "in.raw"
|
|
|
|
system "#{bin}/flac", "--decode", "--force-raw", "--endian=little", "--sign=signed", "--output-name=out.raw", "in.flac"
|
|
|
|
# diff input and output
|
|
|
|
system "diff", "in.raw", "out.raw"
|
|
|
|
end
|
2011-02-14 18:57:55 +00:00
|
|
|
end
|