libc/*.sh: Deprecate libc_check_config step.

This step was only used in uClibc. However, with upcoming multilib, the
config management will have to be done for each variant differently,
anyway.

uClibc was the only user of libc_check_config step, as well as
CT_CONFIG_DIR directory. Retire these.

Two other clean-ups in uClibc.sh:
- KERNEL_HEADERS check seems to be bogus, this config option is not
  present even in 0.9.30 - which is not supported already.
- SHARED_LIB_LOADER_PREFIX was renamed to MULTILIB_DIR in 0.9.31,
  according to ChangeLog - and MULTILIB_DIR is passed from command line
  instead.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2016-04-02 00:12:41 -07:00
parent 4ee22d66a8
commit 3ebc5d0c1e
21 changed files with 96 additions and 149 deletions

24
scripts/build/arch.sh Normal file
View File

@ -0,0 +1,24 @@
# This file provides the default implementations of arch-specific functions.
# Set up the target tuple
CT_DoArchTupleValues() {
:;
}
# Multilib: change the target triplet according to CFLAGS
CT_DoArchMultilibTarget() {
local multi_flags="${1}"
local target="${2}"
echo "${target}"
}
# Multilib: Adjust target tuple for GLIBC
CT_DoArchGlibcAdjustTuple() {
local target="${1}"
echo "${target}"
}
# Override from the actual arch implementation as needed.
. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"

View File

@ -4,14 +4,3 @@ CT_DoArchTupleValues () {
# The architecture part of the tuple:
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${CT_ARCH_ALPHA_VARIANT}}"
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -39,14 +39,3 @@ CT_DoArchTupleValues() {
CT_TARGET_SYS="${CT_TARGET_SYS}hf"
fi
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -1,16 +1 @@
# Compute M68k-specific values
CT_DoArchTupleValues() {
:
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -19,14 +19,3 @@ CT_DoArchTupleValues () {
esac
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -14,14 +14,3 @@ CT_DoArchTupleValues() {
CT_ARCH_ABI_CFLAG="-mabi=${CT_ARCH_mips_ABI}"
CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_mips_ABI}"
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -9,5 +9,4 @@ CT_DoArchTupleValues() {
CT_ARCH_WITH_FPU=
CT_ARCH_WITH_FLOAT=
CT_TARGET_SYS=elf
}

View File

@ -26,6 +26,7 @@ CT_DoArchTupleValues () {
CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double"
fi
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"

View File

@ -35,14 +35,3 @@ CT_DoArchTupleValues () {
esac
CT_ARCH_FLOAT_CFLAG=
}
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
CT_DoArchMultilibTarget ()
{
local target="${1}"; shift
local -a multi_flags=( "$@" )
echo "${target}"
}

View File

@ -25,5 +25,39 @@ CT_DoArchMultilibTarget ()
local target="${1}"; shift
local -a multi_flags=( "$@" )
local m32=false
local m64=false
for m in "${multi_flags[@]}"; do
case "$m" in
-m32) m32=true ;;
-m64) m64=true ;;
esac
done
# Fix up bitness
case "${target}" in
sparc-*) $m64 && target=${target/#sparc-/sparc64-} ;;
sparc64-*) $m32 && target=${target/#sparc64-/sparc-} ;;
esac
echo "${target}"
}
# Special tuple adjustment for glibc.
CT_DoArchGlibcAdjustTuple() {
local target="${1}"
case "${target}" in
# SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
# earlier (corresponding pthread barrier code is missing). Until this
# support is reintroduced, configure as sparcv9.
sparc-*)
if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
target=${target/#sparc-/sparcv9-}
fi
;;
esac
echo "${target}"
}

View File

@ -68,3 +68,27 @@ CT_DoArchMultilibTarget ()
echo "${target}"
}
# Adjust target tuple for GLIBC
CT_DoArchGlibcAdjustTuple() {
local target="${1}"
case "${target}" in
# x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
# indicate the desired optimization. If it was a multilib variant of x86_64,
# then it targets at least NetBurst a.k.a. i786, but we'll follow the model
# above # and set the optimization to i686. Otherwise, replace with the most
# conservative choice, i486.
i386-*)
if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
target=${target/#i386-/i686-}
elif [ "${CT_TARGET_ARCH}" != "i386" ]; then
target=${target/#i386-/${CT_TARGET_ARCH}-}
else
target=${target/#i386-/i486-}
fi
;;
esac
echo "${target}"
}

View File

@ -18,10 +18,6 @@ do_libc_extract() {
CT_Patch "avr-libc" "${CT_LIBC_VERSION}"
}
do_libc_check_config() {
:
}
do_libc_configure() {
CT_DoLog EXTRA "Configuring C library"

View File

@ -41,10 +41,6 @@ do_libc_extract() {
CT_Popd
}
do_libc_check_config() {
:
}
# Build and install headers and start files
do_libc_start_files() {
# Start files and Headers should be configured the same way as the
@ -123,30 +119,9 @@ do_libc_backend() {
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
# Adjust target tuple according to CFLAGS + any GLIBC quirks
target=$( CT_DoMultilibTarget "${CT_TARGET}" ${extra_flags} )
case "${target}" in
# SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
# earlier (corresponding pthread barrier code is missing). Until this
# support is reintroduced, configure as sparcv9.
sparc-*)
if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
target=${target/#sparc-/sparcv9-}
fi
;;
# x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
# indicate the desired optimization. If it was a multilib variant of x86_64,
# then it targets at least NetBurst a.k.a. i786, but we'll follow arch/x86.sh
# and set the optimization to i686. Otherwise, replace with the most
# conservative choice, i486.
i386-*)
if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
target=${target/#i386-/i686-}
else
target=${target/#i386-/i486-}
fi
;;
esac
target=$( CT_DoArchGlibcAdjustTuple "${target}" )
CT_DoStep INFO "Building for multilib '${multi_flags}'"
# Ensure sysroot (with suffix, if applicable) exists

View File

@ -23,10 +23,6 @@ do_libc_extract() {
CT_Popd
}
do_libc_check_config() {
:
}
do_set_mingw_install_prefix(){
MINGW_INSTALL_PREFIX=/usr/${CT_TARGET}
if [[ ${CT_WINAPI_VERSION} == 2* ]]; then

View File

@ -16,10 +16,6 @@ do_libc_extract() {
CT_Patch "musl" "${CT_LIBC_VERSION}"
}
do_libc_check_config() {
:
}
# Build and install headers and start files
do_libc_start_files() {
# Start files and Headers should be configured the same way as the

View File

@ -38,10 +38,6 @@ do_libc_extract() {
fi
}
do_libc_check_config() {
:
}
do_libc_start_files() {
CT_DoStep INFO "Installing C library headers & start files"
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/." \

View File

@ -10,10 +10,6 @@ do_libc_extract() {
:
}
do_libc_check_config() {
:
}
do_libc_start_files() {
:
}

View File

@ -51,26 +51,6 @@ do_libc_extract() {
return 0
}
# Check that uClibc has been previously configured
do_libc_check_config() {
CT_DoStep INFO "Checking C library configuration"
# Use the default config if the user did not provide one.
if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/contrib/uClibc-defconfigs/${uclibc_name}.config"
fi
if ${grep} -E '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
fi
CT_DoLog EXTRA "Manage uClibc configuration"
manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_CONFIG_DIR}/uClibc.config"
CT_EndStep
}
# Build and install headers and start files
do_libc_start_files() {
# Start files and Headers should be configured the same way as the
@ -131,12 +111,17 @@ do_libc_backend() {
${CT_LIBC_UCLIBC_VERBOSITY} \
)
# Retrieve the config file
CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
# Force the date of the pregen locale data, as the
# newer ones that are referenced are not available
CT_DoLog EXTRA "Applying configuration"
# Use the default config if the user did not provide one.
if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/contrib/uClibc-defconfigs/${uclibc_name}.config"
fi
manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" .config
CT_DoYes | CT_DoExecLog ALL ${make} "${make_args[@]}" oldconfig
if [ "${libc_mode}" = "startfiles" ]; then
@ -347,7 +332,6 @@ manage_uClibc_config() {
# which is the correct value of ${PREFIX}/${TARGET}.
CT_KconfigSetOption "DEVEL_PREFIX" "\"/usr/\"" "${dst}"
CT_KconfigSetOption "RUNTIME_PREFIX" "\"/\"" "${dst}"
CT_KconfigSetOption "SHARED_LIB_LOADER_PREFIX" "\"/lib/\"" "${dst}"
CT_KconfigSetOption "KERNEL_HEADERS" "\"${CT_HEADERS_DIR}\"" "${dst}"
# Locales support

View File

@ -141,7 +141,7 @@ CT_DoLog INFO "Building environment variables"
# Include sub-scripts instead of calling them: that way, we do not have to
# export any variable, nor re-parse the configuration and functions files.
. "${CT_LIB_DIR}/scripts/build/internals.sh"
. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
. "${CT_LIB_DIR}/scripts/build/arch.sh"
. "${CT_LIB_DIR}/scripts/build/companion_tools.sh"
. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
. "${CT_LIB_DIR}/scripts/build/companion_libs.sh"
@ -181,7 +181,6 @@ CT_SRC_DIR="${CT_WORK_DIR}/src"
CT_BUILD_DIR="${CT_WORK_DIR}/${CT_TARGET}/build"
CT_BUILDTOOLS_PREFIX_DIR="${CT_WORK_DIR}/${CT_TARGET}/buildtools"
CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
CT_CONFIG_DIR="${CT_BUILD_DIR}/configs"
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
# sub-dir. So we won't have to save/restore it, not even create it.
# In case of cross or native, host-complibs are used for build-complibs;
@ -266,7 +265,6 @@ CT_DoExecLog ALL mkdir -p "${CT_TARBALLS_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_SRC_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILD_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
CT_DoExecLog ALL mkdir -p "${CT_CONFIG_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_INSTALL_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}"

View File

@ -1474,7 +1474,6 @@ CT_DoSaveState() {
/^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
CT_DoTarballIfExists "${CT_BUILDTOOLS_PREFIX_DIR}" "${state_dir}/buildtools_dir"
CT_DoTarballIfExists "${CT_CONFIG_DIR}" "${state_dir}/config_dir"
CT_DoTarballIfExists "${CT_PREFIX_DIR}" "${state_dir}/prefix_dir" --exclude '*.log'
CT_DoLog STATE " Saving log file"
@ -1504,7 +1503,6 @@ CT_DoLoadState(){
CT_DoLog INFO "Restoring state at step '${state_name}', as requested."
CT_DoExtractTarballIfExists "${state_dir}/prefix_dir" "${CT_PREFIX_DIR}"
CT_DoExtractTarballIfExists "${state_dir}/config_dir" "${CT_CONFIG_DIR}"
CT_DoExtractTarballIfExists "${state_dir}/buildtools_dir" "${CT_BUILDTOOLS_PREFIX_DIR}"
# Restore the environment, discarding any error message

View File

@ -16,9 +16,9 @@ help-env::
# The _for_build steps are noop for native and cross,
# but are actual steps for canadian and cross-native.
# Please keep the last line with a '\' and keep the following empy line:
# Please keep the last line with a '\' and keep the following empty line:
# it helps when diffing and merging.
CT_STEPS := libc_check_config \
CT_STEPS := \
companion_libs_for_build \
binutils_for_build \
companion_libs_for_host \