Compare commits

...

2 Commits

Author SHA1 Message Date
97289eed42 fixes to git downloads and x265 for cmake v4 2025-09-07 11:47:17 -05:00
6be45728bd fix numa 2025-09-07 09:19:43 -05:00
4 changed files with 100 additions and 50 deletions

4
Jenkinsfile vendored
View File

@@ -18,7 +18,7 @@ pipeline {
stage('build docker image') { stage('build docker image') {
matrix { matrix {
axes { axes {
axis { name 'DISTRO'; values 'ubuntu-24.04', 'fedora-42', 'debian-13', 'archlinux-latest' } axis { name 'DISTRO'; values 'ubuntu', 'fedora', 'debian', 'archlinux' }
} }
stages { stages {
stage('build multiarch image') { stage('build multiarch image') {
@@ -52,7 +52,7 @@ pipeline {
matrix { matrix {
axes { axes {
axis { name 'ARCH'; values 'armv8-a', 'x86-64-v3' } axis { name 'ARCH'; values 'armv8-a', 'x86-64-v3' }
axis { name 'DISTRO'; values 'ubuntu-24.04', 'fedora-42', 'debian-13', 'archlinux-latest' } axis { name 'DISTRO'; values 'ubuntu', 'fedora', 'debian', 'archlinux' }
axis { name 'OPT_LTO'; values 'OPT=0 LTO=OFF', 'OPT=3 LTO=ON' } axis { name 'OPT_LTO'; values 'OPT=0 LTO=OFF', 'OPT=3 LTO=ON' }
axis { name 'STATIC'; values 'ON', 'OFF' } axis { name 'STATIC'; values 'ON', 'OFF' }
} }

View File

@@ -45,7 +45,6 @@ set_compile_opts() {
) )
PKG_CONFIG_PATH="${LIBDIR}/pkgconfig" PKG_CONFIG_PATH="${LIBDIR}/pkgconfig"
export PKG_CONFIG_PATH export PKG_CONFIG_PATH
echo_info "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
# add prefix include # add prefix include
C_FLAGS+=("-I${PREFIX}/include") C_FLAGS+=("-I${PREFIX}/include")
@@ -55,7 +54,6 @@ set_compile_opts() {
unset LTO_FLAG unset LTO_FLAG
export LTO_FLAG export LTO_FLAG
if [[ ${LTO} == 'ON' ]]; then if [[ ${LTO} == 'ON' ]]; then
echo_info "building with LTO"
LTO_FLAG='-flto' LTO_FLAG='-flto'
C_FLAGS+=("${LTO_FLAG}") C_FLAGS+=("${LTO_FLAG}")
if ! is_darwin; then if ! is_darwin; then
@@ -64,7 +62,6 @@ set_compile_opts() {
MESON_FLAGS+=("-Db_lto=true") MESON_FLAGS+=("-Db_lto=true")
RUSTFLAGS+=("-C lto=yes" "-C inline-threshold=1000" "-C codegen-units=1") RUSTFLAGS+=("-C lto=yes" "-C inline-threshold=1000" "-C codegen-units=1")
else else
echo_info "building without LTO"
LTO_FLAG='' LTO_FLAG=''
MESON_FLAGS+=("-Db_lto=false") MESON_FLAGS+=("-Db_lto=false")
RUSTFLAGS+=("-C lto=no") RUSTFLAGS+=("-C lto=no")
@@ -92,9 +89,16 @@ set_compile_opts() {
export PKG_CONFIG_FLAGS LIB_SUFF export PKG_CONFIG_FLAGS LIB_SUFF
if [[ ${STATIC} == 'ON' ]]; then if [[ ${STATIC} == 'ON' ]]; then
LDFLAGS+=('-static') LDFLAGS+=('-static')
CONFIGURE_FLAGS+=('--enable-static') CONFIGURE_FLAGS+=(
'--enable-static'
'--disable-shared'
)
MESON_FLAGS+=('--default-library=static') MESON_FLAGS+=('--default-library=static')
CMAKE_FLAGS+=("-DBUILD_SHARED_LIBS=OFF") CMAKE_FLAGS+=(
"-DENABLE_STATIC=${STATIC}"
"-DENABLE_SHARED=OFF"
"-DBUILD_SHARED_LIBS=OFF"
)
RUSTFLAGS+=("-C target-feature=+crt-static") RUSTFLAGS+=("-C target-feature=+crt-static")
PKG_CONFIG_FLAGS='--static' PKG_CONFIG_FLAGS='--static'
# darwin does not support static linkage # darwin does not support static linkage
@@ -107,8 +111,13 @@ set_compile_opts() {
DEL_LIB_SUFF="${SHARED_LIB_SUFF}" DEL_LIB_SUFF="${SHARED_LIB_SUFF}"
else else
LDFLAGS+=("-Wl,-rpath,${LIBDIR}" "-Wl,-rpath-link,${LIBDIR}") LDFLAGS+=("-Wl,-rpath,${LIBDIR}" "-Wl,-rpath-link,${LIBDIR}")
CONFIGURE_FLAGS+=('--enable-shared') CONFIGURE_FLAGS+=(
'--enable-shared'
'--disable-static'
)
CMAKE_FLAGS+=( CMAKE_FLAGS+=(
"-DENABLE_STATIC=${STATIC}"
"-DENABLE_SHARED=ON"
"-DBUILD_SHARED_LIBS=ON" "-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_INSTALL_RPATH=${LIBDIR}" "-DCMAKE_INSTALL_RPATH=${LIBDIR}"
) )
@@ -137,7 +146,6 @@ set_compile_opts() {
CMAKE_FLAGS+=("-DCMAKE_C_FLAGS=${C_FLAGS[*]}") CMAKE_FLAGS+=("-DCMAKE_C_FLAGS=${C_FLAGS[*]}")
CMAKE_FLAGS+=("-DCMAKE_CXX_FLAGS=${CXX_FLAGS[*]}") CMAKE_FLAGS+=("-DCMAKE_CXX_FLAGS=${CXX_FLAGS[*]}")
MESON_FLAGS+=("-Dc_args=${C_FLAGS[*]}" "-Dcpp_args=${CPP_FLAGS[*]}") MESON_FLAGS+=("-Dc_args=${C_FLAGS[*]}" "-Dcpp_args=${CPP_FLAGS[*]}")
echo_info "CLEAN: $CLEAN"
dump_arr CONFIGURE_FLAGS dump_arr CONFIGURE_FLAGS
dump_arr C_FLAGS dump_arr C_FLAGS
dump_arr RUSTFLAGS dump_arr RUSTFLAGS
@@ -145,6 +153,7 @@ set_compile_opts() {
dump_arr CMAKE_FLAGS dump_arr CMAKE_FLAGS
dump_arr MESON_FLAGS dump_arr MESON_FLAGS
dump_arr PKG_CONFIG_FLAGS dump_arr PKG_CONFIG_FLAGS
echo_info "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
# extra ffmpeg flags # extra ffmpeg flags
FFMPEG_EXTRA_FLAGS+=( FFMPEG_EXTRA_FLAGS+=(
@@ -174,6 +183,14 @@ set_compile_opts() {
echo echo
} }
get_remote_head() {
local url="$1"
local remoteHEAD=''
IFS=$' \t' read -r remoteHEAD _ <<< \
"$(git ls-remote "${url}" HEAD)"
echo "${remoteHEAD}"
}
get_build_conf() { get_build_conf() {
local getBuild="${1}" local getBuild="${1}"
@@ -193,10 +210,10 @@ libaom 3.12.1 tar.gz https://storage.googleapis.com/aom-releases/libaom-${ve
libvmaf 3.0.0 tar.gz https://github.com/Netflix/vmaf/archive/refs/tags/v${ver}.${ext} libvmaf 3.0.0 tar.gz https://github.com/Netflix/vmaf/archive/refs/tags/v${ver}.${ext}
libopus 1.5.2 tar.gz https://github.com/xiph/opus/releases/download/v${ver}/opus-${ver}.${ext} libopus 1.5.2 tar.gz https://github.com/xiph/opus/releases/download/v${ver}/opus-${ver}.${ext}
libdav1d 1.5.1 tar.xz http://downloads.videolan.org/videolan/dav1d/${ver}/dav1d-${ver}.${ext} libdav1d 1.5.1 tar.xz http://downloads.videolan.org/videolan/dav1d/${ver}/dav1d-${ver}.${ext}
libx264 latest git https://code.videolan.org/videolan/x264.git libx264 latest git https://code.videolan.org/videolan/x264.git
libx265 4.1 tar.gz https://bitbucket.org/multicoreware/x265_git/downloads/x265_${ver}.${ext} libnuma libx265 4.1 tar.gz https://bitbucket.org/multicoreware/x265_git/downloads/x265_${ver}.${ext} cmake
libnuma 2.0.19 tar.gz https://github.com/numactl/numactl/archive/refs/tags/v${ver}.${ext} cmake 3.31.8 tar.gz https://github.com/Kitware/CMake/archive/refs/tags/v${ver}.${ext}
' '
local supported_builds=() local supported_builds=()
@@ -227,31 +244,38 @@ libnuma 2.0.19 tar.gz https://github.com/numactl/numactl/archive/refs/tags/v
# set dependencies array # set dependencies array
# shellcheck disable=SC2206 # shellcheck disable=SC2206
deps=(${deps//,/ }) deps=(${deps//,/ })
# set extracted directory # set version based off of remote head
extracted_dir="${BUILD_DIR}/${build}-v${ver}" # and set extracted directory
if [[ ${ext} == 'git' ]]; then
ver="$(get_remote_head "${url}")"
extracted_dir="${BUILD_DIR}/${build}-${ext}"
else
extracted_dir="${BUILD_DIR}/${build}-v${ver}"
fi
# download the release
download_release || return 1
return 0 return 0
} }
download_release() { download_release() {
local build="${1}" local base_path="$(bash_basename "${extracted_dir}")"
# set env for wget download
get_build_conf "${build}" || return 1
local base_path="${build}-v${ver}"
local base_dl_path="${DL_DIR}/${base_path}" local base_dl_path="${DL_DIR}/${base_path}"
# remove other versions of a download # remove other versions of a download
for wrong_ver_dl in "${DL_DIR}/${build}-v"*; do for wrong_ver_dl in "${DL_DIR}/${build}-"*; do
if [[ ${wrong_ver_dl} =~ ${base_path} ]]; then if line_contains "${wrong_ver_dl}" "${base_path}"; then
continue
fi
if [[ ! -d ${wrong_ver_dl} && ! -f ${wrong_ver_dl} ]]; then
continue continue
fi fi
test -f "${wrong_ver_dl}" || continue
echo_warn "removing wrong version: ${wrong_ver_dl}" echo_warn "removing wrong version: ${wrong_ver_dl}"
rm -rf "${wrong_ver_dl}" rm -rf "${wrong_ver_dl}"
done done
# remove other versions of a build # remove other versions of a build
for wrong_ver_build in "${BUILD_DIR}/${build}-v"*; do for wrong_ver_build in "${BUILD_DIR}/${build}-"*; do
if [[ ${wrong_ver_build} =~ ${base_path} ]]; then if line_contains "${wrong_ver_build}" "${base_path}"; then
continue continue
fi fi
test -d "${wrong_ver_build}" || continue test -d "${wrong_ver_build}" || continue
@@ -296,8 +320,7 @@ download_release() {
cd "${base_dl_path}" || exit 1 cd "${base_dl_path}" || exit 1
local localHEAD remoteHEAD local localHEAD remoteHEAD
localHEAD="$(git rev-parse HEAD)" localHEAD="$(git rev-parse HEAD)"
IFS=$' \t' read -r remoteHEAD _ <<< \ remoteHEAD="$(get_remote_head "$(git config --get remote.origin.url)")"
"$(git ls-remote "$(git config --get remote.origin.url)" HEAD)"
if [[ ${localHEAD} != "${remoteHEAD}" ]]; then if [[ ${localHEAD} != "${remoteHEAD}" ]]; then
git pull --ff-only git pull --ff-only
fi fi
@@ -320,7 +343,6 @@ FB_FUNC_DESCS['do_build']='build a specific project'
FB_FUNC_COMPLETION['do_build']="$(get_build_conf supported)" FB_FUNC_COMPLETION['do_build']="$(get_build_conf supported)"
do_build() { do_build() {
local build="${1:-''}" local build="${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 # add build configuration to FFMPEG_BUILDER_INFO
@@ -531,12 +553,41 @@ build_libopus() {
sanitize_sysroot_libs 'libopus' || return 1 sanitize_sysroot_libs 'libopus' || return 1
} }
build_libx265() { # libx265 does not support cmake >= 4
build_cmake() {
local cmakeVersion verMajor
# don't need to build if system version is below 4
IFS=$' \t' read -r _ _ cmakeVersion <<<"$(cmake --version)"
IFS='.' read -r verMajor _ _ <<<"${cmakeVersion}"
if [[ ${verMajor} -lt 4 ]]; then
return 0
fi
# don't need to rebuild if already built
local cmake="${PREFIX}/bin/cmake"
if [[ -f ${cmake} ]]; then
IFS=$' \t' read -r _ _ cmakeVersion <<<"$("${cmake}" --version)"
IFS='.' read -r verMajor _ _ <<<"${cmakeVersion}"
if [[ ${verMajor} -lt 4 ]]; then
return 0
fi
fi
cmake \ cmake \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release || return 1
ccache make -j"${JOBS}" || return 1
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
}
build_libx265() {
PATH="${PREFIX}/bin:$PATH" cmake \
"${CMAKE_FLAGS[@]}" \ "${CMAKE_FLAGS[@]}" \
-G "Unix Makefiles" \ -G "Unix Makefiles" \
-DHIGH_BIT_DEPTH=ON \ -DHIGH_BIT_DEPTH=ON \
-DENABLE_HDR10_PLUS=ON \ -DENABLE_HDR10_PLUS=OFF \
./source || return 1 ./source || 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
@@ -604,15 +655,6 @@ build_libx264() {
sanitize_sysroot_libs 'libx264' || return 1 sanitize_sysroot_libs 'libx264' || return 1
} }
build_libnuma() {
./autogen.sh || return 1
./configure \
"${CONFIGURE_FLAGS[@]}" || return 1
ccache make -j"${JOBS}" || return 1
${SUDO_MODIFY} make -j"${JOBS}" install || return 1
sanitize_sysroot_libs 'libnuma' || return 1
}
add_project_versioning_to_ffmpeg() { add_project_versioning_to_ffmpeg() {
local optFile local optFile
local fname='ffmpeg_opt.c' local fname='ffmpeg_opt.c'

View File

@@ -1,11 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VALID_DOCKER_IMAGES=( VALID_DOCKER_IMAGES=(
'ubuntu-24.04' 'ubuntu'
'fedora-42' 'fedora'
'fedora-41' 'debian'
'debian-13' 'archlinux'
'archlinux-latest'
) )
DOCKER_WORKDIR='/workdir' DOCKER_WORKDIR='/workdir'
@@ -33,6 +32,19 @@ check_docker() {
set_docker_run_flags || return 1 set_docker_run_flags || return 1
} }
# get full image digest for a given image
get_docker_image_tag() {
local distro="$1"
local tag=''
case "${distro}" in
ubuntu) tag='ubuntu:24.04' ;;
debian) tag='debian:13' ;;
fedora) tag='fedora:42' ;;
archlinux) tag='ogarcia/archlinux:latest' ;;
esac
echo "${tag}"
}
# change dash to colon for docker and add namespace # change dash to colon for docker and add namespace
set_distro_image_tag() { set_distro_image_tag() {
local image_tag="${1}" local image_tag="${1}"
@@ -91,12 +103,7 @@ docker_build_image() {
for distro in "${DISTROS[@]}"; do for distro in "${DISTROS[@]}"; do
echo_info "sourcing package manager for ${distro}" echo_info "sourcing package manager for ${distro}"
local dockerDistro="${distro}" local dockerDistro="$(get_docker_image_tag "${distro}")"
# custom multi-arch image for archlinux
test "${distro}" == 'archlinux-latest' &&
dockerDistro='ogarcia/archlinux-latest'
# docker expects colon instead of dash
dockerDistro="${dockerDistro//-/:}"
# specific file for evaluated package manager info # specific file for evaluated package manager info
distroPkgMgr="${DOCKER_DIR}/$(bash_basename "${distro}")-pkg_mgr" distroPkgMgr="${DOCKER_DIR}/$(bash_basename "${distro}")-pkg_mgr"
# get package manager info # get package manager info
@@ -117,7 +124,7 @@ docker_build_image() {
echo 'ENV DEBIAN_FRONTEND=noninteractive' echo 'ENV DEBIAN_FRONTEND=noninteractive'
# arch is rolling release, so highly likely # arch is rolling release, so highly likely
# an updated is required between pkg changes # an updated is required between pkg changes
if line_contains "${dockerDistro}" 'archlinux'; then if line_contains "${dockerDistro}" 'arch'; then
local archRuns='' local archRuns=''
archRuns+="${pkg_mgr_update}" archRuns+="${pkg_mgr_update}"
archRuns+=" && ${pkg_mgr_upgrade}" archRuns+=" && ${pkg_mgr_upgrade}"

View File

@@ -70,7 +70,7 @@ print_req_pkgs() {
# shellcheck disable=SC2034 # shellcheck disable=SC2034
local pacman_pkgs=( local pacman_pkgs=(
"${common_linux_pkgs[@]}" base-devel "${common_linux_pkgs[@]}" base-devel
python-pipx ninja python-pipx ninja numactl
) )
# shellcheck disable=SC2034 # shellcheck disable=SC2034
local dnf_pkgs=( local dnf_pkgs=(
@@ -78,6 +78,7 @@ print_req_pkgs() {
pipx ninja-build fontconfig-devel wget2 pipx ninja-build fontconfig-devel wget2
cpuinfo-devel glibc-static glibc-devel cpuinfo-devel glibc-static glibc-devel
libstdc++-static libstdc++-devel patch libstdc++-static libstdc++-devel patch
numactl-devel
) )
# shellcheck disable=SC2034 # shellcheck disable=SC2034
local android_pkgs=( local android_pkgs=(