67 lines
2.2 KiB
Ruby
67 lines
2.2 KiB
Ruby
class X265 < Formula
|
|
desc "H.265/HEVC encoder"
|
|
homepage "https://bitbucket.org/multicoreware/x265"
|
|
url "https://bitbucket.org/multicoreware/x265/downloads/x265_3.2.1.tar.gz"
|
|
sha256 "fb9badcf92364fd3567f8b5aa0e5e952aeea7a39a2b864387cec31e3b58cbbcc"
|
|
head "https://bitbucket.org/multicoreware/x265", :using => :hg
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "1b0ba2cbc5a5776f28ca0e35e057dea92b3562f023e897c04eee202f8c6a5e41" => :catalina
|
|
sha256 "69be6670b0f82f1229ebe281e635e2f588c0bf2c45aec9d8a6194a3700cb2563" => :mojave
|
|
sha256 "4dcc40b0d54784a6f3c3a878bddc79f7cbd657a17e4fd6a1aef0ff7f259e4824" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
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
|
|
|
|
# Build based off the script at ./build/linux/multilib.sh
|
|
args = std_cmake_args + %w[
|
|
-DLINKED_10BIT=ON
|
|
-DLINKED_12BIT=ON
|
|
-DEXTRA_LINK_FLAGS=-L.
|
|
-DEXTRA_LIB=x265_main10.a;x265_main12.a
|
|
]
|
|
high_bit_depth_args = std_cmake_args + %w[
|
|
-DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF
|
|
-DENABLE_SHARED=OFF -DENABLE_CLI=OFF
|
|
]
|
|
(buildpath/"8bit").mkpath
|
|
|
|
mkdir "10bit" do
|
|
system "cmake", buildpath/"source", *high_bit_depth_args
|
|
system "make"
|
|
mv "libx265.a", buildpath/"8bit/libx265_main10.a"
|
|
end
|
|
|
|
mkdir "12bit" do
|
|
system "cmake", buildpath/"source", "-DMAIN12=ON", *high_bit_depth_args
|
|
system "make"
|
|
mv "libx265.a", buildpath/"8bit/libx265_main12.a"
|
|
end
|
|
|
|
cd "8bit" do
|
|
system "cmake", buildpath/"source", *args
|
|
system "make"
|
|
mv "libx265.a", "libx265_main.a"
|
|
system "libtool", "-static", "-o", "libx265.a", "libx265_main.a",
|
|
"libx265_main10.a", "libx265_main12.a"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
yuv_path = testpath/"raw.yuv"
|
|
x265_path = testpath/"x265.265"
|
|
yuv_path.binwrite "\xCO\xFF\xEE" * 3200
|
|
system bin/"x265", "--input-res", "80x80", "--fps", "1", yuv_path, x265_path
|
|
header = "AAAAAUABDAH//w=="
|
|
assert_equal header.unpack("m"), [x265_path.read(10)]
|
|
end
|
|
end
|