66 lines
2.2 KiB
Ruby
66 lines
2.2 KiB
Ruby
class X265 < Formula
|
|
desc "H.265/HEVC encoder"
|
|
homepage "https://bitbucket.org/multicoreware/x265_git"
|
|
url "https://bitbucket.org/multicoreware/x265_git/get/3.4.tar.gz"
|
|
sha256 "7f2771799bea0f53b5ab47603d5bea46ea2a221e047a7ff398115e9976fd5f86"
|
|
license "GPL-2.0-only"
|
|
revision 2
|
|
head "https://bitbucket.org/multicoreware/x265_git.git"
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "89918f59466d00820cd7e978c89b405959d082f108db2382bd76fe2bdedcfc5c"
|
|
sha256 big_sur: "8db84444f732498e1f1e3f8564b3091360ebb277a9c7f5d0bd457893a194f5a6"
|
|
sha256 catalina: "c7be7296406476bf93e13580eab209646680bafaa5fb46d31cf491ef3e3f0a25"
|
|
sha256 mojave: "d6bce1ae70ea86a7203a42ab807e1a2334550a9b4af5ca7ebb9a0e89139c8444"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "nasm" => :build if Hardware::CPU.intel?
|
|
|
|
def install
|
|
# 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
|
|
-DCMAKE_INSTALL_RPATH=#{lib}
|
|
]
|
|
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", "-DENABLE_HDR10_PLUS=ON", *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
|