mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-21 13:47:48 +00:00
crosstool-NG.sh.in: Don't make lots of symlinks to lib folder
For 4 different folders: ${CT_PREFIX_DIR} ${CT_SYSROOT_DIR} ${CT_SYSROOT_DIR}/usr ${CT_PREFIX_DIR}/${CT_TARGET} .. symlinks from 'lib32' and 'lib64' to 'lib' were created. This was untidy and incorrect for multilib (the bitness of the libraries in 'lib32' and 'lib64' will not be the same) We can not know which folders this toolchain configuration will require at this time so let them be created on-demand instead. Changed by Alexey Neyman: original change removed too much; we still need to create the default directories because the os directories are based off them (e.g. `lib/../lib64'). Signed-off-by: Ray Donnelly <mingw.android@gmail.com> Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
098bd01f81
commit
27fed7e5f0
@ -201,6 +201,9 @@ do_gcc_core_backend() {
|
||||
local -a core_targets_install
|
||||
local -a extra_user_config
|
||||
local arg
|
||||
local dir
|
||||
local flags
|
||||
local osdir
|
||||
|
||||
for arg in "$@"; do
|
||||
eval "${arg// /\\ }"
|
||||
@ -560,23 +563,30 @@ do_gcc_core_backend() {
|
||||
CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
|
||||
fi
|
||||
|
||||
if [ "${CT_MULTILIB}" = "y" ]; then
|
||||
if [ "${CT_CANADIAN}" = "y" -a "${mode}" = "baremetal" \
|
||||
-a "${host}" = "${CT_HOST}" ]; then
|
||||
CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly"
|
||||
if [ "${CT_CANADIAN}" = "y" -a "${mode}" = "baremetal" \
|
||||
-a "${host}" = "${CT_HOST}" ]; then
|
||||
CT_DoLog EXTRA "Canadian Cross unable to confirm multilibs configured correctly"
|
||||
else
|
||||
multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib ) )
|
||||
if [ ${#multilibs[@]} -ne 0 ]; then
|
||||
CT_DoLog EXTRA "gcc configured with these multilibs (including the default):"
|
||||
for i in "${multilibs[@]}"; do
|
||||
dir="${i%%;*}"
|
||||
flags="${i#*;}"
|
||||
flags=${flags//@/ -}
|
||||
osdir=$( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-os-directory ${flags} )
|
||||
CT_DoLog EXTRA " '${flags}' --> lib/${dir}/ (gcc) lib/${osdir} (os)"
|
||||
# When building core GCC, create the necessary directories for libc & friends.
|
||||
case "${build_step}" in
|
||||
core1|core2)
|
||||
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/lib/${osdir}"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/lib/${osdir}"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib/${osdir}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \
|
||||
|tail -n +2 ) )
|
||||
if [ ${#multilibs[@]} -ne 0 ]; then
|
||||
CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):"
|
||||
for i in "${multilibs[@]}"; do
|
||||
dir="${i%%;*}"
|
||||
flags="${i#*;}"
|
||||
CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/"
|
||||
done
|
||||
else
|
||||
CT_DoLog WARN "gcc configured for multilib, but none available"
|
||||
fi
|
||||
CT_DoLog WARN "no multilib configuration: GCC unusable?"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -685,6 +695,9 @@ do_gcc_backend() {
|
||||
local -a final_LDFLAGS
|
||||
local tmp
|
||||
local arg
|
||||
local dir
|
||||
local flags
|
||||
local osdir
|
||||
|
||||
for arg in "$@"; do
|
||||
eval "${arg// /\\ }"
|
||||
@ -968,22 +981,21 @@ do_gcc_backend() {
|
||||
CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
|
||||
fi
|
||||
|
||||
if [ "${CT_MULTILIB}" = "y" ]; then
|
||||
if [ "${CT_CANADIAN}" = "y" ]; then
|
||||
CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly"
|
||||
if [ "${CT_CANADIAN}" = "y" ]; then
|
||||
CT_DoLog EXTRA "Canadian Cross unable to confirm multilibs configured correctly"
|
||||
else
|
||||
multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib ) )
|
||||
if [ ${#multilibs[@]} -ne 0 ]; then
|
||||
CT_DoLog EXTRA "gcc configured with these multilibs (including the default):"
|
||||
for i in "${multilibs[@]}"; do
|
||||
dir="${i%%;*}"
|
||||
flags="${i#*;}"
|
||||
flags=${flags//@/ -}
|
||||
osdir=$( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-os-directory $flags )
|
||||
CT_DoLog EXTRA " '${flags}' --> lib/${dir}/ (gcc) lib/${osdir} (os)"
|
||||
done
|
||||
else
|
||||
multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \
|
||||
|tail -n +2 ) )
|
||||
if [ ${#multilibs[@]} -ne 0 ]; then
|
||||
CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):"
|
||||
for i in "${multilibs[@]}"; do
|
||||
dir="${i%%;*}"
|
||||
flags="${i#*;}"
|
||||
CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/"
|
||||
done
|
||||
else
|
||||
CT_DoLog WARN "gcc configured for multilib, but none available"
|
||||
fi
|
||||
CT_DoLog WARN "no multilib configuration: GCC unusable?"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -118,12 +118,5 @@ do_finish() {
|
||||
CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
|
||||
fi
|
||||
|
||||
# Remove the lib* symlinks, now:
|
||||
# The symlinks are needed only during the build process.
|
||||
# The final gcc will still search those dirs, but will also search
|
||||
# the standard lib/ dirs, so we can get rid of the symlinks
|
||||
CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
|
||||
CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"
|
||||
|
||||
CT_EndStep
|
||||
}
|
||||
|
@ -325,40 +325,14 @@ if [ -z "${CT_RESTART}" ]; then
|
||||
fi
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_DEBUGROOT_DIR}"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_HEADERS_DIR}"
|
||||
|
||||
# Prepare the 'lib' directories in sysroot, else the ../lib64 hack used by
|
||||
# 32 -> 64 bit crosscompilers won't work, and build of final gcc will fail
|
||||
# with: "ld: cannot open crti.o: No such file or directory"
|
||||
# Also prepare the lib directory in the install dir, else some 64 bit archs
|
||||
# won't build
|
||||
# Need the non-multilib directories: GCC's multi-os-directory is based off them, so
|
||||
# even if the /lib is not used for any of the multilibs, it must be present so that
|
||||
# the paths like 'lib/../lib64' still work.
|
||||
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/lib"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/lib"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_HEADERS_DIR}"
|
||||
|
||||
if [ "${CT_USE_SYSROOT}" = "y" ]; then
|
||||
# Prevent gcc from installing its libraries outside of the sysroot
|
||||
CT_Pushd "${CT_PREFIX_DIR}/${CT_TARGET}"
|
||||
CT_DoExecLog ALL ln -sf "${CT_SYSROOT_REL_DIR}/lib" "lib"
|
||||
CT_Popd
|
||||
fi
|
||||
|
||||
# Since we're *not* multilib on the target side, we want all the
|
||||
# libraries to end up in "lib". We create "lib64" (for 64-bit
|
||||
# build or host architectures) and "lib32" (for 32-bit emulation
|
||||
# on 64-bit) as symlinks to "lib".
|
||||
#
|
||||
# Not all of these symlinks are necessary, but better safe than
|
||||
# sorry. They are summarily removed by build/internals.sh:do_finish.
|
||||
for d in \
|
||||
"${CT_PREFIX_DIR}" \
|
||||
"${CT_SYSROOT_DIR}" \
|
||||
"${CT_SYSROOT_DIR}/usr" \
|
||||
"${CT_PREFIX_DIR}/${CT_TARGET}" \
|
||||
; do
|
||||
CT_DoExecLog ALL ln -sf "lib" "${d}/lib32"
|
||||
CT_DoExecLog ALL ln -sf "lib" "${d}/lib64"
|
||||
done
|
||||
|
||||
# Determine build system if not set by the user
|
||||
if [ -z "${CT_BUILD}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user