Build entire toolchain as PIC for proper static linking
This commit is contained in:
parent
a0384b8b70
commit
654a6d765e
5 changed files with 27 additions and 18 deletions
4
build.sh
4
build.sh
|
@ -29,6 +29,7 @@ for script in scripts.d/**/*.sh; do
|
|||
FF_CFLAGS+=" $(get_output $script cflags)"
|
||||
FF_CXXFLAGS+=" $(get_output $script cxxflags)"
|
||||
FF_LDFLAGS+=" $(get_output $script ldflags)"
|
||||
FF_LDEXEFLAGS+=" $(get_output $script ldexeflags)"
|
||||
FF_LIBS+=" $(get_output $script libs)"
|
||||
done
|
||||
|
||||
|
@ -36,6 +37,7 @@ FF_CONFIGURE="$(xargs <<< "$FF_CONFIGURE")"
|
|||
FF_CFLAGS="$(xargs <<< "$FF_CFLAGS")"
|
||||
FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
|
||||
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
|
||||
FF_LDEXEFLAGS="$(xargs <<< "$FF_LDEXEFLAGS")"
|
||||
FF_LIBS="$(xargs <<< "$FF_LIBS")"
|
||||
|
||||
TESTFILE="uidtestfile"
|
||||
|
@ -57,7 +59,7 @@ docker run --rm -i "${UIDARGS[@]}" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<E
|
|||
cd ffmpeg
|
||||
git checkout $GIT_BRANCH
|
||||
|
||||
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $FF_CONFIGURE --extra-cflags='$FF_CFLAGS' --extra-cxxflags='$FF_CXXFLAGS' --extra-ldflags='$FF_LDFLAGS' --extra-libs='$FF_LIBS'
|
||||
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $FF_CONFIGURE --extra-cflags='$FF_CFLAGS' --extra-cxxflags='$FF_CXXFLAGS' --extra-ldflags='$FF_LDFLAGS' --extra-ldexeflags='$FF_LDEXEFLAGS' --extra-libs='$FF_LIBS'
|
||||
make -j\$(nproc) V=1
|
||||
make install install-doc
|
||||
EOF
|
||||
|
|
|
@ -20,13 +20,11 @@ RUN \
|
|||
-and -not -name 'libdl.*' \
|
||||
-and -not -name 'libc.*' \
|
||||
-and -not -name 'libm.*' \
|
||||
-and -not -name 'libgomp.*' \
|
||||
-delete && \
|
||||
find /opt/ct-ng \
|
||||
-name 'libdl.a' \
|
||||
-or -name 'libc.a' \
|
||||
-or -name 'libm.a' \
|
||||
-or -name 'libgomp.a' \
|
||||
-delete
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
|
|
|
@ -59,7 +59,7 @@ CT_PREFIX_DIR="/opt/ct-ng"
|
|||
CT_RM_RF_PREFIX_DIR=y
|
||||
CT_REMOVE_DOCS=y
|
||||
# CT_INSTALL_LICENSES is not set
|
||||
CT_PREFIX_DIR_RO=y
|
||||
# CT_PREFIX_DIR_RO is not set
|
||||
CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
|
||||
CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES=y
|
||||
|
||||
|
@ -102,9 +102,9 @@ CT_PATCH_ORDER="bundled"
|
|||
CT_PARALLEL_JOBS=0
|
||||
CT_LOAD=""
|
||||
CT_USE_PIPES=y
|
||||
CT_EXTRA_CFLAGS_FOR_BUILD=""
|
||||
CT_EXTRA_CFLAGS_FOR_BUILD="-fPIC -DPIC"
|
||||
CT_EXTRA_LDFLAGS_FOR_BUILD=""
|
||||
CT_EXTRA_CFLAGS_FOR_HOST=""
|
||||
CT_EXTRA_CFLAGS_FOR_HOST="-fPIC -DPIC"
|
||||
CT_EXTRA_LDFLAGS_FOR_HOST=""
|
||||
# CT_CONFIG_SHELL_SH is not set
|
||||
# CT_CONFIG_SHELL_ASH is not set
|
||||
|
@ -184,7 +184,7 @@ CT_ARCH_SUPPORTS_WITH_ARCH=y
|
|||
CT_ARCH_SUPPORTS_WITH_CPU=y
|
||||
CT_ARCH_SUPPORTS_WITH_TUNE=y
|
||||
CT_ARCH_ARCH=""
|
||||
CT_TARGET_CFLAGS=""
|
||||
CT_TARGET_CFLAGS="-fPIC -DPIC"
|
||||
CT_TARGET_LDFLAGS=""
|
||||
# end of Target options
|
||||
|
||||
|
@ -198,8 +198,6 @@ CT_TARGET_LDFLAGS=""
|
|||
CT_USE_SYSROOT=y
|
||||
CT_SYSROOT_NAME="sysroot"
|
||||
CT_SYSROOT_DIR_PREFIX=""
|
||||
CT_WANTS_STATIC_LINK=y
|
||||
CT_WANTS_STATIC_LINK_CXX=y
|
||||
# CT_STATIC_TOOLCHAIN is not set
|
||||
CT_SHOW_CT_VERSION=y
|
||||
CT_TOOLCHAIN_PKGVERSION=""
|
||||
|
@ -523,9 +521,9 @@ CT_GLIBC_HAS_LIBIDN_ADDON=y
|
|||
# CT_GLIBC_USE_LIBIDN_ADDON is not set
|
||||
CT_GLIBC_NO_SPARC_V8=y
|
||||
CT_GLIBC_HAS_OBSOLETE_RPC=y
|
||||
CT_GLIBC_EXTRA_CONFIG_ARRAY="--with-pic --enable-static-pie"
|
||||
CT_GLIBC_EXTRA_CONFIG_ARRAY="--with-pic"
|
||||
CT_GLIBC_CONFIGPARMS=""
|
||||
CT_GLIBC_EXTRA_CFLAGS=""
|
||||
CT_GLIBC_EXTRA_CFLAGS="-fPIC -DPIC"
|
||||
CT_GLIBC_ENABLE_OBSOLETE_RPC=y
|
||||
# CT_GLIBC_ENABLE_FORTIFIED_BUILD is not set
|
||||
# CT_GLIBC_DISABLE_VERSIONING is not set
|
||||
|
@ -617,9 +615,9 @@ CT_GCC_4_8_or_later=y
|
|||
CT_CC_GCC_ENABLE_PLUGINS=y
|
||||
CT_CC_GCC_HAS_LIBMPX=y
|
||||
CT_CC_GCC_ENABLE_CXX_FLAGS=""
|
||||
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--enable-host-shared --enable-default-pie --enable-default-ssp"
|
||||
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--enable-host-shared --enable-default-pie --enable-default-ssp"
|
||||
CT_CC_GCC_STATIC_LIBSTDCXX=y
|
||||
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--enable-host-shared --enable-default-ssp"
|
||||
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--enable-host-shared --enable-default-ssp"
|
||||
# CT_CC_GCC_STATIC_LIBSTDCXX is not set
|
||||
# CT_CC_GCC_SYSTEM_ZLIB is not set
|
||||
CT_CC_GCC_CONFIG_TLS=m
|
||||
|
||||
|
@ -632,13 +630,13 @@ CT_CC_GCC_USE_LTO=y
|
|||
#
|
||||
# Settings for libraries running on target
|
||||
#
|
||||
CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
|
||||
# CT_CC_GCC_ENABLE_TARGET_OPTSPACE is not set
|
||||
# CT_CC_GCC_LIBMUDFLAP is not set
|
||||
CT_CC_GCC_LIBGOMP=y
|
||||
CT_CC_GCC_LIBSSP=m
|
||||
# CT_CC_GCC_LIBQUADMATH is not set
|
||||
# CT_CC_GCC_LIBSANITIZER is not set
|
||||
CT_CC_GCC_LIBMPX=y
|
||||
# CT_CC_GCC_LIBMPX is not set
|
||||
|
||||
#
|
||||
# Misc. obscure options.
|
||||
|
|
|
@ -20,9 +20,12 @@ ffbuild_dockerbuild() {
|
|||
return 0
|
||||
}
|
||||
|
||||
ffbuild_configure() {
|
||||
ffbuild_ldexeflags() {
|
||||
echo '-pie'
|
||||
|
||||
if [[ $VARIANT == *shared* ]]; then
|
||||
# Can't escape escape hell
|
||||
echo --extra-ldexeflags=\'-Wl,-rpath='\\\\\\\$\\\$ORIGIN'\\ -Wl,-rpath='\\\\\\\$\\\$ORIGIN/../lib'\'
|
||||
echo -Wl,-rpath='\\\\\\\$\\\$ORIGIN'
|
||||
echo -Wl,-rpath='\\\\\\\$\\\$ORIGIN/../lib'
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -71,6 +71,14 @@ ffbuild_uncxxflags() {
|
|||
return 0
|
||||
}
|
||||
|
||||
ffbuild_ldexeflags() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ffbuild_unldexeflags() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ffbuild_ldflags() {
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue