FFmpeg-Builds/scripts.d/50-x265.sh

83 lines
1.9 KiB
Bash
Raw Normal View History

2020-09-03 20:49:43 +00:00
#!/bin/bash
2022-07-12 15:54:12 +00:00
SCRIPT_REPO="https://bitbucket.org/multicoreware/x265_git.git"
2023-02-12 13:40:12 +00:00
SCRIPT_COMMIT="6da609e41ca5ae1d661a1b5c4805ed7a3f4117cc"
2020-09-03 20:49:43 +00:00
ffbuild_enabled() {
2021-06-20 19:59:48 +00:00
[[ $VARIANT == lgpl* ]] && return -1
2020-09-03 20:49:43 +00:00
return 0
}
ffbuild_dockerbuild() {
2022-07-12 15:54:12 +00:00
git clone "$SCRIPT_REPO" x265
2020-09-03 20:49:43 +00:00
cd x265
2022-07-12 15:54:12 +00:00
git checkout "$SCRIPT_COMMIT"
2020-09-03 20:49:43 +00:00
2021-05-13 11:59:25 +00:00
local common_config=(
-DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX"
-DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN"
-DCMAKE_BUILD_TYPE=Release
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
-DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy
)
2020-09-27 20:10:05 +00:00
if [[ $TARGET != *32 ]]; then
mkdir 8bit 10bit 12bit
2021-05-13 11:59:25 +00:00
cmake "${common_config[@]}" -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_HDR10_PLUS=ON -DMAIN12=ON -S source -B 12bit &
cmake "${common_config[@]}" -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_HDR10_PLUS=ON -S source -B 10bit &
cmake "${common_config[@]}" -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -S source -B 8bit &
2020-12-22 23:22:24 +00:00
wait
2020-09-03 20:49:43 +00:00
2020-12-22 23:22:24 +00:00
cat >Makefile <<"EOF"
all: 12bit/libx265.a 10bit/libx265.a 8bit/libx265.a
2020-09-03 20:49:43 +00:00
2020-12-22 23:22:24 +00:00
%/libx265.a:
$(MAKE) -C $(subst /libx265.a,,$@)
2020-09-03 20:49:43 +00:00
2020-12-22 23:22:24 +00:00
.PHONY: all
EOF
2020-12-22 21:34:59 +00:00
2020-12-22 23:22:24 +00:00
make -j$(nproc)
2020-12-22 21:34:59 +00:00
2020-12-22 23:22:24 +00:00
cd 8bit
mv ../12bit/libx265.a ../8bit/libx265_main12.a
mv ../10bit/libx265.a ../8bit/libx265_main10.a
mv libx265.a libx265_main.a
2020-09-27 20:10:05 +00:00
${FFBUILD_CROSS_PREFIX}ar -M <<EOF
2020-09-03 20:49:43 +00:00
CREATE libx265.a
ADDLIB libx265_main.a
ADDLIB libx265_main10.a
ADDLIB libx265_main12.a
SAVE
END
EOF
2020-09-27 20:10:05 +00:00
else
mkdir 8bit
cd 8bit
2021-05-13 11:59:25 +00:00
cmake "${common_config[@]}" ../source
2020-09-27 20:10:05 +00:00
make -j$(nproc)
fi
2020-09-03 20:49:43 +00:00
2020-12-22 23:22:24 +00:00
make install
2022-06-13 21:57:40 +00:00
echo "Libs.private: -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/x265.pc
2020-09-03 20:49:43 +00:00
}
ffbuild_configure() {
echo --enable-libx265
}
ffbuild_unconfigure() {
echo --disable-libx265
}
ffbuild_cflags() {
return 0
}
ffbuild_ldflags() {
return 0
}