mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-16 11:26:17 +00:00
Compare commits
2 Commits
a0c0f11aae
...
2cc802ff78
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cc802ff78 | |||
| 829e431fb3 |
40
lib/build.sh
40
lib/build.sh
@@ -273,8 +273,6 @@ cmake 3.31.8 tar.gz https://github.com/Kitware/CMake/archive/refs/tags/v${ve
|
|||||||
else
|
else
|
||||||
extracted_dir="${BUILD_DIR}/${build}-v${ver}"
|
extracted_dir="${BUILD_DIR}/${build}-v${ver}"
|
||||||
fi
|
fi
|
||||||
# download the release
|
|
||||||
download_release || return 1
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -366,15 +364,16 @@ FB_FUNC_COMPLETION['do_build']="$(get_build_conf supported)"
|
|||||||
do_build() {
|
do_build() {
|
||||||
local build="${1:-''}"
|
local build="${1:-''}"
|
||||||
get_build_conf "${build}" || return 1
|
get_build_conf "${build}" || return 1
|
||||||
|
download_release || return 1
|
||||||
# add build configuration to FFMPEG_BUILDER_INFO
|
|
||||||
FFMPEG_BUILDER_INFO+=("${build}=${ver}")
|
|
||||||
|
|
||||||
set_compile_opts || return 1
|
set_compile_opts || return 1
|
||||||
for dep in "${deps[@]}"; do
|
for dep in "${deps[@]}"; do
|
||||||
do_build "${dep}" || return 1
|
do_build "${dep}" || return 1
|
||||||
done
|
done
|
||||||
get_build_conf "${build}" || return 1
|
get_build_conf "${build}" || return 1
|
||||||
|
download_release || return 1
|
||||||
|
|
||||||
|
# start build
|
||||||
echo_info -n "building ${build} "
|
echo_info -n "building ${build} "
|
||||||
pushd "$extracted_dir" >/dev/null || return 1
|
pushd "$extracted_dir" >/dev/null || return 1
|
||||||
# check for any patches
|
# check for any patches
|
||||||
@@ -419,9 +418,6 @@ build() {
|
|||||||
test -f "${testfile}" && ${SUDO_MODIFY} rm "${testfile}"
|
test -f "${testfile}" && ${SUDO_MODIFY} rm "${testfile}"
|
||||||
test -d "${PREFIX}/bin/" || { ${SUDO_MODIFY} mkdir -p "${PREFIX}/bin/" || return 1; }
|
test -d "${PREFIX}/bin/" || { ${SUDO_MODIFY} mkdir -p "${PREFIX}/bin/" || return 1; }
|
||||||
|
|
||||||
# embed this project's enables/versions
|
|
||||||
# into ffmpeg with this variable
|
|
||||||
FFMPEG_BUILDER_INFO=("ffmpeg-builder=$(cd "${REPO_DIR}" && git rev-parse HEAD)")
|
|
||||||
for build in ${ENABLE}; do
|
for build in ${ENABLE}; do
|
||||||
do_build "${build}" || return 1
|
do_build "${build}" || return 1
|
||||||
done
|
done
|
||||||
@@ -747,8 +743,15 @@ build_libvmaf() {
|
|||||||
|
|
||||||
### AUTOTOOLS ###
|
### AUTOTOOLS ###
|
||||||
build_libx264() {
|
build_libx264() {
|
||||||
|
# libx264 does not support LTO
|
||||||
|
local configureFlags=()
|
||||||
|
for flag in "${CONFIGURE_FLAGS[@]}"; do
|
||||||
|
test "${flag}" == '--enable-lto' && continue
|
||||||
|
configureFlags+=("${flag}")
|
||||||
|
done
|
||||||
|
|
||||||
./configure \
|
./configure \
|
||||||
"${CONFIGURE_FLAGS[@]}" \
|
"${configureFlags[@]}" \
|
||||||
--disable-cli || return 1
|
--disable-cli || return 1
|
||||||
ccache make -j"${JOBS}" || return 1
|
ccache make -j"${JOBS}" || return 1
|
||||||
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
|
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
|
||||||
@@ -784,13 +787,28 @@ build_libnuma() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_project_versioning_to_ffmpeg() {
|
add_project_versioning_to_ffmpeg() {
|
||||||
local fname='ffmpeg_opt.c'
|
# embed this project's enables/versions
|
||||||
|
# into ffmpeg with FFMPEG_BUILDER_INFO
|
||||||
|
local FFMPEG_BUILDER_INFO=(
|
||||||
|
'' # pad with empty line
|
||||||
|
"ffmpeg-builder=$(git -C "${REPO_DIR}" rev-parse HEAD)"
|
||||||
|
)
|
||||||
|
for build in ${ENABLE}; do
|
||||||
|
get_build_conf "${build}" || return 1
|
||||||
|
# add build configuration info
|
||||||
|
FFMPEG_BUILDER_INFO+=("${build}=${ver}")
|
||||||
|
done
|
||||||
|
# and finally for ffmpeg itself
|
||||||
|
get_build_conf ffmpeg || return 1
|
||||||
|
FFMPEG_BUILDER_INFO+=("${build}=${ver}")
|
||||||
|
|
||||||
|
local fname='opt_common.c'
|
||||||
local optFile="fftools/${fname}"
|
local optFile="fftools/${fname}"
|
||||||
if [[ ! -f ${optFile} ]]; then
|
if [[ ! -f ${optFile} ]]; then
|
||||||
echo_fail "could not find ${fname} to add project versioning"
|
echo_fail "could not find ${fname} to add project versioning"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local searchFor='Universal media converter\n'
|
local searchFor='static void print_all_libs_info'
|
||||||
local foundUsageStart=0
|
local foundUsageStart=0
|
||||||
local newOptFile="${TMP_DIR}/${fname}"
|
local newOptFile="${TMP_DIR}/${fname}"
|
||||||
test -f "${newOptFile}" && rm "${newOptFile}"
|
test -f "${newOptFile}" && rm "${newOptFile}"
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ get_encode_versions() {
|
|||||||
audioEncVersion=''
|
audioEncVersion=''
|
||||||
|
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local output="$(ffmpeg -hide_banner 2>&1)"
|
local output="$(ffmpeg -version 2>&1)"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if line_contains "${line}" 'ffmpeg='; then
|
if line_contains "${line}" 'ffmpeg='; then
|
||||||
ffmpegVersion="${line}"
|
ffmpegVersion="${line}"
|
||||||
@@ -91,6 +91,29 @@ get_encode_versions() {
|
|||||||
fi
|
fi
|
||||||
done <<<"${output}"
|
done <<<"${output}"
|
||||||
|
|
||||||
|
local version
|
||||||
|
if [[ ${ffmpegVersion} == '' ]]; then
|
||||||
|
while read -r line; do
|
||||||
|
if line_starts_with "${line}" 'ffmpeg version '; then
|
||||||
|
read -r _ _ version _ <<<"${line}"
|
||||||
|
ffmpegVersion="ffmpeg=${version}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done <<<"${output}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${videoEncVersion} == '' ]]; then
|
||||||
|
version="$(get_pkgconfig_version SvtAv1Enc)"
|
||||||
|
test "${version}" == '' && return 1
|
||||||
|
videoEncVersion="libsvtav1=${version}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${audioEncVersion} == '' ]]; then
|
||||||
|
version="$(get_pkgconfig_version opus)"
|
||||||
|
test "${version}" == '' && return 1
|
||||||
|
audioEncVersion="libopus=${version}"
|
||||||
|
fi
|
||||||
|
|
||||||
test "${ffmpegVersion}" == '' && return 1
|
test "${ffmpegVersion}" == '' && return 1
|
||||||
test "${videoEncVersion}" == '' && return 1
|
test "${videoEncVersion}" == '' && return 1
|
||||||
test "${audioEncVersion}" == '' && return 1
|
test "${audioEncVersion}" == '' && return 1
|
||||||
@@ -166,7 +189,7 @@ set_encode_opts() {
|
|||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
get_encode_versions print
|
get_encode_versions print
|
||||||
exit 0
|
exit $?
|
||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
|
|||||||
13
lib/utils.sh
13
lib/utils.sh
@@ -30,12 +30,12 @@ void() { echo "$@" >/dev/null; }
|
|||||||
|
|
||||||
echo_if_fail() {
|
echo_if_fail() {
|
||||||
local cmd=("$@")
|
local cmd=("$@")
|
||||||
local logName="${LOGNAME:-${RANDOM}}"
|
local logName="${LOGNAME:-${RANDOM}}-"
|
||||||
local out="${TMP_DIR}/.stdout-${logName}"
|
local out="${TMP_DIR}/.${logName}stdout"
|
||||||
local err="${TMP_DIR}/.stderr-${logName}"
|
local err="${TMP_DIR}/.${logName}stderr"
|
||||||
|
|
||||||
# set trace to the cmdEvalTrace and open file descriptor
|
# set trace to the cmdEvalTrace and open file descriptor
|
||||||
local cmdEvalTrace="${TMP_DIR}/.cmdEvalTrace-${logName}"
|
local cmdEvalTrace="${TMP_DIR}/.${logName}cmdEvalTrace"
|
||||||
test -d "${TMP_DIR}" || mkdir -p "${TMP_DIR}"
|
test -d "${TMP_DIR}" || mkdir -p "${TMP_DIR}"
|
||||||
exec 5>"${cmdEvalTrace}"
|
exec 5>"${cmdEvalTrace}"
|
||||||
export BASH_XTRACEFD=5
|
export BASH_XTRACEFD=5
|
||||||
@@ -297,3 +297,8 @@ spinner() {
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_pkgconfig_version() {
|
||||||
|
local pkg="$1"
|
||||||
|
pkg-config --modversion "${pkg}"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user