homebrew-core/Formula/x264.rb
2019-10-11 00:21:20 +02:00

57 lines
1.5 KiB
Ruby

class X264 < Formula
desc "H.264/AVC encoder"
homepage "https://www.videolan.org/developers/x264.html"
revision 1
head "https://git.videolan.org/git/x264.git"
stable do
# the latest commit on the stable branch
url "https://git.videolan.org/git/x264.git",
:revision => "0a84d986e7020f8344f00752e3600b9769cc1e85"
version "r2917"
end
bottle do
cellar :any
sha256 "33fac8bf40d8b533b0991860d5ef33eafe808d7a94ae39a6711c3cae9d9db0f3" => :catalina
sha256 "735ec621d4592320681fdb7a0b21405e675a9b5c1237e3a4a4c7c6b07b20fe86" => :mojave
sha256 "6ffa207553ba4fa48a193d3b84f72db75b53eef5e6b8f6a650f9ead6046f4c68" => :high_sierra
end
depends_on "nasm" => :build
def install
# Work around Xcode 11 clang bug
# https://bitbucket.org/multicoreware/x265/issues/514/wrong-code-generated-on-macos-1015
ENV.append_to_cflags "-fno-stack-check" if DevelopmentTools.clang_build_version >= 1010
args = %W[
--prefix=#{prefix}
--disable-lsmash
--enable-shared
--enable-static
--enable-strip
]
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdint.h>
#include <x264.h>
int main()
{
x264_picture_t pic;
x264_picture_init(&pic);
x264_picture_alloc(&pic, 1, 1, 1);
x264_picture_clean(&pic);
return 0;
}
EOS
system ENV.cc, "-L#{lib}", "-lx264", "test.c", "-o", "test"
system "./test"
end
end