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:
49
lib/build.sh
49
lib/build.sh
@@ -85,9 +85,36 @@ set_compile_opts() {
|
|||||||
local compilerDir="${LOCAL_PREFIX}/compiler-tools"
|
local compilerDir="${LOCAL_PREFIX}/compiler-tools"
|
||||||
test -d "${compilerDir}" && rm -rf "${compilerDir}"
|
test -d "${compilerDir}" && rm -rf "${compilerDir}"
|
||||||
mkdir "${compilerDir}"
|
mkdir "${compilerDir}"
|
||||||
echo -e "#!/bin/sh\nexec ${CC} -fuse-ld=${USE_LD} \"\$@\"" >"${compilerDir}"/cc
|
# real:gnu:clang:generic
|
||||||
echo -e "#!/bin/sh\nexec ${CXX} -fuse-ld=${USE_LD} \"\$@\"" >"${compilerDir}"/c++
|
local compilerMap="\
|
||||||
echo -e "#!/bin/sh\nexec ld.lld \"\$@\"" >"${compilerDir}"/ld
|
${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}"/*
|
chmod +x "${compilerDir}"/*
|
||||||
export PATH="${compilerDir}:${PATH}"
|
export PATH="${compilerDir}:${PATH}"
|
||||||
|
|
||||||
@@ -125,10 +152,10 @@ set_compile_opts() {
|
|||||||
# enabling link-time optimization
|
# enabling link-time optimization
|
||||||
if [[ ${LTO} == 'ON' ]]; then
|
if [[ ${LTO} == 'ON' ]]; then
|
||||||
LTO_FLAG='-flto'
|
LTO_FLAG='-flto'
|
||||||
CONFIGURE_FLAGS+=('--enable-lto')
|
CONFIGURE_FLAGS+=('--enable-lto ')
|
||||||
MESON_FLAGS+=("-Db_lto=true")
|
MESON_FLAGS+=("-Db_lto=true")
|
||||||
else
|
else
|
||||||
LTO_FLAG=' '
|
LTO_FLAG=''
|
||||||
MESON_FLAGS+=("-Db_lto=false")
|
MESON_FLAGS+=("-Db_lto=false")
|
||||||
fi
|
fi
|
||||||
CFLAGS_ARR+=("${LTO_FLAG}")
|
CFLAGS_ARR+=("${LTO_FLAG}")
|
||||||
@@ -163,13 +190,14 @@ set_compile_opts() {
|
|||||||
"-DBUILD_SHARED_LIBS=OFF"
|
"-DBUILD_SHARED_LIBS=OFF"
|
||||||
)
|
)
|
||||||
# darwin does not support static linkage
|
# 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")
|
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
|
fi
|
||||||
FFMPEG_EXTRA_FLAGS+=(
|
FFMPEG_EXTRA_FLAGS+=("--pkg-config-flags=--static")
|
||||||
"--pkg-config-flags=--static"
|
|
||||||
"--extra-ldflags=${LDFLAGS_ARR[*]} -static"
|
|
||||||
)
|
|
||||||
# remove shared libraries for static builds
|
# remove shared libraries for static builds
|
||||||
USE_LIB_SUFF="${STATIC_LIB_SUFF}"
|
USE_LIB_SUFF="${STATIC_LIB_SUFF}"
|
||||||
DEL_LIB_SUFF="${SHARED_LIB_SUFF}"
|
DEL_LIB_SUFF="${SHARED_LIB_SUFF}"
|
||||||
@@ -899,7 +927,6 @@ build_libx264() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_libmp3lame() {
|
build_libmp3lame() {
|
||||||
autoreconf -i || return 1
|
|
||||||
# https://sourceforge.net/p/lame/mailman/message/36081038/
|
# https://sourceforge.net/p/lame/mailman/message/36081038/
|
||||||
if is_darwin; then
|
if is_darwin; then
|
||||||
remove_line \
|
remove_line \
|
||||||
|
|||||||
Reference in New Issue
Block a user