mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-16 11:26:17 +00:00
Compare commits
3 Commits
e1d5595b06
...
5c9e97e0a2
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c9e97e0a2 | |||
| 687a8473b5 | |||
| c07b52f5c2 |
32
lib/build.sh
32
lib/build.sh
@@ -60,9 +60,13 @@ set_compile_opts() {
|
||||
LIBDIR="${PREFIX}/lib"
|
||||
LDFLAGS_ARR=("-L${LIBDIR}")
|
||||
|
||||
# HACK rope in libm
|
||||
if is_android; then
|
||||
test -f "${LIBDIR}/libm.so" || ln -s /system/lib64/libm.so "${LIBDIR}/libm.so"
|
||||
# android does not find libraries due to different names
|
||||
if is_android && [[ ! -f "${LIBDIR}/libm.so" ]]; then
|
||||
LDFLAGS_ARR+=(
|
||||
"-L/system/lib64"
|
||||
"-lm"
|
||||
"-landroid-shmem"
|
||||
)
|
||||
fi
|
||||
|
||||
# use clang
|
||||
@@ -84,13 +88,14 @@ set_compile_opts() {
|
||||
if ! is_darwin; then
|
||||
USE_LD=lld
|
||||
LDFLAGS_ARR+=("-fuse-ld=${USE_LD}")
|
||||
CMAKE_FLAGS+=(
|
||||
"-DCMAKE_LINKER_TYPE=${USE_LD^^}"
|
||||
"-DCMAKE_LINKER=${USE_LD}"
|
||||
)
|
||||
# android does not like LINKER_TYPE despite only using lld
|
||||
if ! is_android; then
|
||||
CMAKE_FLAGS+=("-DCMAKE_LINKER_TYPE=${USE_LD^^}")
|
||||
fi
|
||||
CMAKE_FLAGS+=("-DCMAKE_LINKER=${USE_LD}")
|
||||
local compilerDir="${LOCAL_PREFIX}/compiler-tools"
|
||||
test -d "${compilerDir}" && rm -rf "${compilerDir}"
|
||||
mkdir "${compilerDir}"
|
||||
mkdir -p "${compilerDir}"
|
||||
# real:gnu:clang:generic
|
||||
local compilerMap="\
|
||||
${CC}:gcc:clang:cc
|
||||
@@ -110,12 +115,13 @@ ld.lld:ld:lld:ld"
|
||||
echo "#!/usr/bin/env bash
|
||||
echo \$@ > ${compilerDir}/${genericT}.\${RANDOM}
|
||||
exec \"${realT}\" ${addFlag} \"\$@\"" >"${compilerDir}/${genericT}"
|
||||
chmod +x "${compilerDir}/${genericT}"
|
||||
echo_if_fail "${compilerDir}/${genericT}" --version || return 1
|
||||
|
||||
# copy generic to gnu/clang variants
|
||||
# cp "${compilerDir}/${genericT}" "${compilerDir}/${gnuT}" 2>/dev/null
|
||||
# cp "${compilerDir}/${genericT}" "${compilerDir}/${clangT}" 2>/dev/null
|
||||
done <<<"${compilerMap}"
|
||||
chmod +x "${compilerDir}"/*
|
||||
export PATH="${compilerDir}:${PATH}"
|
||||
fi
|
||||
|
||||
@@ -214,10 +220,7 @@ exec \"${realT}\" ${addFlag} \"\$@\"" >"${compilerDir}/${genericT}"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=${LDFLAGS_ARR[*]}"
|
||||
)
|
||||
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]}")
|
||||
LDFLAGS_ARR+=(
|
||||
"-Wl,-rpath,${LIBDIR}"
|
||||
"-Wl,-rpath-link,${LIBDIR}"
|
||||
)
|
||||
LDFLAGS_ARR+=("-Wl,-rpath,${LIBDIR}")
|
||||
CONFIGURE_FLAGS+=(
|
||||
'--enable-shared'
|
||||
'--disable-static'
|
||||
@@ -792,7 +795,8 @@ build_cmake3() {
|
||||
overrideFlags+=("${flag}")
|
||||
fi
|
||||
done
|
||||
CMAKE_FLAGS='' meta_cmake_build \
|
||||
CMAKE_FLAGS='' CFLAGS='' CXXFLAGS='' LDFLAGS='' \
|
||||
meta_cmake_build \
|
||||
"${overrideFlags[@]}" || return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ get_docker_image_tag() {
|
||||
local image="$1"
|
||||
local tag=''
|
||||
case "${image}" in
|
||||
ubuntu) tag='ubuntu:24.04@sha256:9cbed754112939e914291337b5e554b07ad7c392491dba6daf25eef1332a22e8' ;;
|
||||
debian) tag='debian:13@sha256:833c135acfe9521d7a0035a296076f98c182c542a2b6b5a0fd7063d355d696be' ;;
|
||||
fedora) tag='fedora:42@sha256:6af051ad0a294182c3a957961df6203d91f643880aa41c2ffe3d1302e7505890' ;;
|
||||
archlinux) tag='ogarcia/archlinux:latest@sha256:b93f426b23cd0ea0e1befd7d58a26eaf3e6eda3c154c0e8dd75145d11c21304c' ;;
|
||||
ubuntu) tag='ubuntu:24.04@sha256:c35e29c9450151419d9448b0fd75374fec4fff364a27f176fb458d472dfc9e54' ;;
|
||||
debian) tag='debian:13@sha256:0d01188e8dd0ac63bf155900fad49279131a876a1ea7fac917c62e87ccb2732d' ;;
|
||||
fedora) tag='fedora:42@sha256:b3d16134560afa00d7cc2a9e4967eb5b954512805f3fe27d8e70bbed078e22ea' ;;
|
||||
archlinux) tag='ogarcia/archlinux:latest@sha256:1d70273180e43b1f51b41514bdaa73c61f647891a53a9c301100d5c4807bf628' ;;
|
||||
esac
|
||||
echo "${tag}"
|
||||
}
|
||||
@@ -161,7 +161,7 @@ docker_build_image() {
|
||||
echo "RUN pipx install virtualenv"
|
||||
# rust
|
||||
local rustupVersion='1.28.2'
|
||||
local rustcVersion='1.88.0'
|
||||
local rustcVersion='1.90.0'
|
||||
local rustupTarball="rustup-${rustupVersion}.tar.gz"
|
||||
local rustupTarballPath="${DOCKER_DIR}/${rustupTarball}"
|
||||
if [[ ! -f ${rustupTarballPath} ]]; then
|
||||
@@ -178,10 +178,15 @@ docker_build_image() {
|
||||
# install cargo-c
|
||||
echo "RUN cargo-binstall -y cargo-c"
|
||||
|
||||
# final mods for PS1
|
||||
echo 'USER root'
|
||||
echo "RUN echo \"PS1='id=\\\$(id -u)@${image}:\w\\$ '\" >> /etc/bash.bashrc"
|
||||
echo 'USER 65534:65534'
|
||||
|
||||
echo "WORKDIR ${DOCKER_WORKDIR}"
|
||||
|
||||
} >"${dockerfile}"
|
||||
|
||||
# return 1
|
||||
image_tag="$(set_distro_image_tag "${image}")"
|
||||
docker buildx build \
|
||||
--platform "${PLATFORM}" \
|
||||
|
||||
@@ -67,12 +67,12 @@ print_req_pkgs() {
|
||||
"${common_linux_pkgs[@]}" pipx
|
||||
build-essential libssl-dev gobjc++
|
||||
mawk libc6-dev mediainfo ninja-build
|
||||
mkvtoolnix libgtest-dev
|
||||
mkvtoolnix libgtest-dev lld
|
||||
)
|
||||
# shellcheck disable=SC2034
|
||||
local pacman_pkgs=(
|
||||
"${common_linux_pkgs[@]}" base-devel
|
||||
python-pipx ninja
|
||||
python-pipx ninja lld
|
||||
)
|
||||
# shellcheck disable=SC2034
|
||||
local dnf_pkgs=(
|
||||
@@ -157,6 +157,7 @@ check_for_req_pkgs() {
|
||||
|
||||
echo_pass "packages from ${pkg_mgr} installed"
|
||||
has_cmd pipx || echo_if_fail python3 -m pip install --user pipx || return 1
|
||||
has_cmd pipx || echo_if_fail python3 -m pipx ensurepath && source ~/.bashrc || return 1
|
||||
echo_if_fail pipx install virtualenv || return 1
|
||||
echo_if_fail pipx ensurepath || return 1
|
||||
has_cmd meson || echo_if_fail pipx install meson || return 1
|
||||
|
||||
Reference in New Issue
Block a user