more small fixes

This commit is contained in:
2025-12-16 17:48:07 -06:00
parent 0b35c8b94a
commit 1b03235761

View File

@@ -85,9 +85,36 @@ set_compile_opts() {
local compilerDir="${LOCAL_PREFIX}/compiler-tools"
test -d "${compilerDir}" && rm -rf "${compilerDir}"
mkdir "${compilerDir}"
echo -e "#!/bin/sh\nexec ${CC} -fuse-ld=${USE_LD} \"\$@\"" >"${compilerDir}"/cc
echo -e "#!/bin/sh\nexec ${CXX} -fuse-ld=${USE_LD} \"\$@\"" >"${compilerDir}"/c++
echo -e "#!/bin/sh\nexec ld.lld \"\$@\"" >"${compilerDir}"/ld
# real:gnu:clang:generic
local compilerMap="\
${CC}:gcc:clang:cc
${CXX}:g++:clang++:c++
ld.lld:ld:lld:ld"
local realT gnuT clangT genericT addArgs
while read -r line; do
echo_warn "${line}"
IFS=: read -r realT gnuT clangT genericT <<<"${line}"
# full path to the real tool
realT="$(command -v "${realT}")"
# add fuse-ld if not ld itself
addArgs=''
if line_contains "${clangT}" "clang"; then addArgs="-fuse-ld=${USE_LD}"; fi
echo_warn "realT:${realT}"
echo_warn "gnuT:${gnuT}"
echo_warn "clangT:${clangT}"
echo_warn "genericT:${genericT}"
# create generic tool version
echo "#!/usr/bin/env bash
echo \$@ > ${compilerDir}/${genericT}.\${RANDOM}
exec \"${realT}\" ${addArgs} \"\$@\"" >"${compilerDir}/${genericT}"
# copy generic to gnu/clang variants
# cp "${compilerDir}/${genericT}" "${compilerDir}/${gnuT}" 2>/dev/null
if is_darwin; then
cp "${compilerDir}/${genericT}" "${compilerDir}/${clangT}" 2>/dev/null
fi
done <<<"${compilerMap}"
chmod +x "${compilerDir}"/*
export PATH="${compilerDir}:${PATH}"
@@ -163,13 +190,14 @@ set_compile_opts() {
"-DBUILD_SHARED_LIBS=OFF"
)
# darwin does not support static linkage
if ! is_darwin; then
if is_darwin; then
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]} -static")
CMAKE_FLAGS+=("-DCMAKE_EXE_LINKER_FLAGS=${LDFLAGS_ARR[*]} -static")
else
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]}")
CMAKE_FLAGS+=("-DCMAKE_EXE_LINKER_FLAGS=${LDFLAGS_ARR[*]}")
fi
FFMPEG_EXTRA_FLAGS+=(
"--pkg-config-flags=--static"
"--extra-ldflags=${LDFLAGS_ARR[*]} -static"
)
FFMPEG_EXTRA_FLAGS+=("--pkg-config-flags=--static")
# remove shared libraries for static builds
USE_LIB_SUFF="${STATIC_LIB_SUFF}"
DEL_LIB_SUFF="${SHARED_LIB_SUFF}"
@@ -899,7 +927,6 @@ build_libx264() {
}
build_libmp3lame() {
autoreconf -i || return 1
# https://sourceforge.net/p/lame/mailman/message/36081038/
if is_darwin; then
remove_line \