mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-15 19:06:17 +00:00
add project versioning
This commit is contained in:
43
lib/build.sh
43
lib/build.sh
@@ -281,6 +281,10 @@ do_build() {
|
|||||||
local build="${1:-''}"
|
local build="${1:-''}"
|
||||||
download_release "${build}" || return 1
|
download_release "${build}" || return 1
|
||||||
get_build_conf "${build}" || return 1
|
get_build_conf "${build}" || 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
|
||||||
@@ -315,6 +319,9 @@ build() {
|
|||||||
fi
|
fi
|
||||||
test -f "${testfile}" && ${SUDO_MODIFY} rm "${testfile}"
|
test -f "${testfile}" && ${SUDO_MODIFY} rm "${testfile}"
|
||||||
|
|
||||||
|
# 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 "${FFMPEG_ENABLES[@]}"; do
|
for build in "${FFMPEG_ENABLES[@]}"; do
|
||||||
do_build "${build}" || return 1
|
do_build "${build}" || return 1
|
||||||
done
|
done
|
||||||
@@ -464,11 +471,47 @@ build_libopus() {
|
|||||||
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
|
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
add_project_versioning_to_ffmpeg() {
|
||||||
|
local optFile
|
||||||
|
optFile="$(command ls ./**/ffmpeg_opt.c)"
|
||||||
|
if [[ ! $? -eq 0 || ${optFile} == '' || ! -f ${optFile} ]]; then
|
||||||
|
echo_fail "could not find ffmpeg_opt.c to add project versioning"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local lineNum=0
|
||||||
|
local searchFor='Universal media converter\n'
|
||||||
|
local foundUsageStart=0
|
||||||
|
while read -r line; do
|
||||||
|
lineNum=$((lineNum + 1))
|
||||||
|
if line_contains "${line}" "${searchFor}"; then
|
||||||
|
foundUsageStart=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ ${foundUsageStart} -eq 1 ]]; then
|
||||||
|
if line_starts_with "${line}" '}'; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <"${optFile}"
|
||||||
|
|
||||||
|
echo_info "found ${line} on ${lineNum}"
|
||||||
|
for info in "${FFMPEG_BUILDER_INFO[@]}"; do
|
||||||
|
local newline="\ av_log(NULL, AV_LOG_INFO, \"${info}\\\n\");"
|
||||||
|
sed -i "${lineNum}i ${newline}" "${optFile}" || return 1
|
||||||
|
lineNum=$((lineNum + 1))
|
||||||
|
done
|
||||||
|
local newline="\ av_log(NULL, AV_LOG_INFO, \"\\\n\");"
|
||||||
|
sed -i "${lineNum}i ${newline}" "${optFile}" || return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
build_ffmpeg() {
|
build_ffmpeg() {
|
||||||
for enable in "${FFMPEG_ENABLES[@]}"; do
|
for enable in "${FFMPEG_ENABLES[@]}"; do
|
||||||
test "${enable}" == 'libsvtav1_psy' && enable='libsvtav1'
|
test "${enable}" == 'libsvtav1_psy' && enable='libsvtav1'
|
||||||
CONFIGURE_FLAGS+=("--enable-${enable}")
|
CONFIGURE_FLAGS+=("--enable-${enable}")
|
||||||
done
|
done
|
||||||
|
add_project_versioning_to_ffmpeg || return 1
|
||||||
|
|
||||||
./configure \
|
./configure \
|
||||||
"${CONFIGURE_FLAGS[@]}" \
|
"${CONFIGURE_FLAGS[@]}" \
|
||||||
"${FFMPEG_EXTRA_FLAGS[@]}" \
|
"${FFMPEG_EXTRA_FLAGS[@]}" \
|
||||||
|
|||||||
@@ -148,3 +148,13 @@ line_contains() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_starts_with() {
|
||||||
|
local line="$1"
|
||||||
|
local substr="$2"
|
||||||
|
if [[ $line == "${substr}"* ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -198,16 +198,6 @@ docker_run_image() {
|
|||||||
for distro in "${DISTROS[@]}"; do
|
for distro in "${DISTROS[@]}"; do
|
||||||
image_tag="$(set_distro_image_tag "${distro}")"
|
image_tag="$(set_distro_image_tag "${distro}")"
|
||||||
|
|
||||||
# if a docker registry is defined, pull from it
|
|
||||||
if [[ ${DOCKER_REGISTRY} != '' ]]; then
|
|
||||||
docker_login || return 1
|
|
||||||
docker pull \
|
|
||||||
"${DOCKER_REGISTRY}/${image_tag}"
|
|
||||||
docker tag "${DOCKER_REGISTRY}/${image_tag}" "${image_tag}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo_info "running ffmpeg build for ${image_tag}"
|
|
||||||
|
|
||||||
# TODO REMOVE
|
# TODO REMOVE
|
||||||
if is_root_owned "${IGN_DIR}"; then
|
if is_root_owned "${IGN_DIR}"; then
|
||||||
docker run \
|
docker run \
|
||||||
@@ -229,6 +219,16 @@ docker_run_image() {
|
|||||||
rm -rf "${DOCKER_WORKDIR}"/gitignore
|
rm -rf "${DOCKER_WORKDIR}"/gitignore
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if a docker registry is defined, pull from it
|
||||||
|
if [[ ${DOCKER_REGISTRY} != '' ]]; then
|
||||||
|
docker_login || return 1
|
||||||
|
docker pull \
|
||||||
|
"${DOCKER_REGISTRY}/${image_tag}"
|
||||||
|
docker tag "${DOCKER_REGISTRY}/${image_tag}" "${image_tag}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo_info "running ffmpeg build for ${image_tag}"
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
"${DOCKER_RUN_FLAGS[@]}" \
|
"${DOCKER_RUN_FLAGS[@]}" \
|
||||||
-u "$(id -u):$(id -g)" \
|
-u "$(id -u):$(id -g)" \
|
||||||
|
|||||||
Reference in New Issue
Block a user