mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-15 19:06:17 +00:00
more small fixes
This commit is contained in:
45
lib/build.sh
45
lib/build.sh
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user