2007-02-24 11:00:05 +00:00
|
|
|
# This file declares functions to install the uClibc C library
|
|
|
|
# Copyright 2007 Yann E. MORIN
|
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
|
2011-01-22 21:32:25 +00:00
|
|
|
# Build and install headers and start files
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_start_files()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
2016-04-02 06:28:43 +00:00
|
|
|
# Start files and Headers should be configured the same way as the
|
|
|
|
# final libc, but built and installed differently.
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_backend libc_mode=startfiles
|
2007-02-24 11:00:05 +00:00
|
|
|
}
|
|
|
|
|
2016-04-02 06:28:43 +00:00
|
|
|
# This function builds and install the full C library
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_main()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_backend libc_mode=final
|
2016-04-02 06:28:43 +00:00
|
|
|
}
|
|
|
|
|
2016-04-05 21:47:20 +00:00
|
|
|
# Common backend for 1st and 2nd passes.
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_backend()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
2016-04-02 06:28:43 +00:00
|
|
|
local libc_mode
|
2016-04-11 20:59:16 +00:00
|
|
|
local arg
|
2016-03-21 18:18:53 +00:00
|
|
|
|
2016-04-02 06:28:43 +00:00
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${libc_mode}" in
|
|
|
|
startfiles) CT_DoStep INFO "Installing C library headers & start files";;
|
|
|
|
final) CT_DoStep INFO "Installing C library";;
|
|
|
|
*) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
|
|
|
|
esac
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2016-04-12 06:11:22 +00:00
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
2018-12-03 21:04:44 +00:00
|
|
|
CT_IterateMultilibs uClibc_backend_once multilib libc_mode="${libc_mode}"
|
2016-04-12 06:11:22 +00:00
|
|
|
CT_Popd
|
2016-04-05 21:47:20 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Common backend for 1st and 2nd passes, once per multilib.
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_backend_once()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
2016-04-05 21:47:20 +00:00
|
|
|
local libc_mode
|
2016-04-11 20:59:16 +00:00
|
|
|
local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
|
|
|
|
local multilib_dir startfiles_dir
|
2016-04-05 21:47:20 +00:00
|
|
|
local jflag=${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}}
|
|
|
|
local -a make_args
|
|
|
|
local extra_cflags f cfg_cflags cf
|
|
|
|
local hdr_install_subdir
|
2018-12-03 21:04:44 +00:00
|
|
|
local uClibc_name
|
2016-04-05 21:47:20 +00:00
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
|
|
|
|
2017-07-03 21:49:54 +00:00
|
|
|
if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = "y" ]; then
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_name="uClibc-ng"
|
2017-07-03 21:49:54 +00:00
|
|
|
elif [ "${CT_UCLIBC_USE_UCLIBC_ORG}" = "y" ]; then
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_name="uClibc"
|
2017-07-03 21:49:54 +00:00
|
|
|
fi
|
2016-04-11 20:59:16 +00:00
|
|
|
|
2017-07-03 21:49:54 +00:00
|
|
|
CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2016-04-02 06:28:43 +00:00
|
|
|
multilib_dir="lib/${multi_os_dir}"
|
|
|
|
startfiles_dir="${multi_root}/usr/${multilib_dir}"
|
|
|
|
CT_SanitizeVarDir multilib_dir startfiles_dir
|
|
|
|
|
|
|
|
# Construct make arguments:
|
|
|
|
# - uClibc uses the CROSS environment variable as a prefix to the compiler
|
|
|
|
# tools to use. Since it requires core pass-1, thusly named compiler is
|
|
|
|
# already available.
|
|
|
|
# - Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
|
|
|
|
# depending on the configuration of the library. That is, they are tailored
|
|
|
|
# to best fit the target. So it is useless and seems to be a bad thing to
|
|
|
|
# use LIBC_EXTRA_CFLAGS here.
|
|
|
|
# - We do _not_ want to strip anything for now, in case we specifically
|
|
|
|
# asked for a debug toolchain, thus the STRIPTOOL= assignment.
|
|
|
|
make_args=( CROSS_COMPILE="${CT_TARGET}-" \
|
2017-04-02 20:25:41 +00:00
|
|
|
HOSTCC="${CT_BUILD}-gcc" \
|
2016-04-02 06:28:43 +00:00
|
|
|
PREFIX="${multi_root}/" \
|
|
|
|
MULTILIB_DIR="${multilib_dir}" \
|
|
|
|
STRIPTOOL=true \
|
|
|
|
${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
|
|
)
|
2016-03-21 18:18:53 +00:00
|
|
|
|
2017-07-03 21:49:54 +00:00
|
|
|
# Simply copy files until uClibc has the ability to build out-of-tree
|
|
|
|
CT_DoLog EXTRA "Copying sources to build dir"
|
|
|
|
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc/." .
|
|
|
|
|
2016-04-02 06:28:43 +00:00
|
|
|
# Force the date of the pregen locale data, as the
|
|
|
|
# newer ones that are referenced are not available
|
2007-02-24 11:00:05 +00:00
|
|
|
CT_DoLog EXTRA "Applying configuration"
|
2016-04-02 07:12:41 +00:00
|
|
|
|
|
|
|
# Use the default config if the user did not provide one.
|
|
|
|
if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
|
2018-12-05 00:15:37 +00:00
|
|
|
CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/packages/${uClibc_name}/config"
|
2016-04-02 07:12:41 +00:00
|
|
|
fi
|
|
|
|
|
2016-04-05 21:47:20 +00:00
|
|
|
manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" .config "${multi_flags}"
|
2017-02-05 05:16:10 +00:00
|
|
|
CT_DoExecLog ALL make "${make_args[@]}" olddefconfig
|
2016-04-02 06:28:43 +00:00
|
|
|
|
2016-04-05 21:47:20 +00:00
|
|
|
# Now filter the multilib flags. manage_uClibc_config did the opposite of
|
|
|
|
# what Rules.mak in uClibc would do: by the multilib's CFLAGS, it determined
|
|
|
|
# the applicable configuration options. We don't want to pass the same options
|
|
|
|
# in the UCLIBC_EXTRA_CFLAGS again (on some targets, the options do not correctly
|
|
|
|
# override each other). On the other hand, we do not want to lose the options
|
|
|
|
# that are not reflected in the .config.
|
|
|
|
extra_cflags="-pipe"
|
|
|
|
{ echo "include Rules.mak"; echo "show-cpu-flags:"; printf '\t@echo $(CPU_CFLAGS)\n'; } \
|
|
|
|
> .show-cpu-cflags.mk
|
2016-11-21 07:50:17 +00:00
|
|
|
cfg_cflags=$( make "${make_args[@]}" \
|
2016-04-05 21:47:20 +00:00
|
|
|
--no-print-directory -f .show-cpu-cflags.mk show-cpu-flags )
|
|
|
|
CT_DoExecLog ALL rm -f .show-cpu-cflags.mk
|
|
|
|
CT_DoLog DEBUG "CPU_CFLAGS detected by uClibc: ${cfg_cflags[@]}"
|
|
|
|
for f in ${multi_flags}; do
|
|
|
|
for cf in ${cfg_cflags}; do
|
|
|
|
if [ "${f}" = "${cf}" ]; then
|
|
|
|
f=
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "${f}" ]; then
|
|
|
|
extra_cflags+=" ${f}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
CT_DoLog DEBUG "Filtered multilib CFLAGS: ${extra_cflags}"
|
|
|
|
make_args+=( UCLIBC_EXTRA_CFLAGS="${extra_cflags}" )
|
|
|
|
|
|
|
|
# uClibc does not have a way to select the installation subdirectory for headers,
|
|
|
|
# it is always $(DEVEL_PREFIX)/include. Also, we're reinstalling the headers
|
|
|
|
# at the final stage (see the note below), we may already have the subdirectory
|
|
|
|
# in /usr/include.
|
|
|
|
CT_DoArchUClibcHeaderDir hdr_install_subdir "${multi_flags}"
|
2016-04-14 07:30:34 +00:00
|
|
|
if [ -n "${hdr_install_subdir}" ]; then
|
2016-04-05 21:47:20 +00:00
|
|
|
CT_DoExecLog ALL cp -a "${multi_root}/usr/include" "${multi_root}/usr/include.saved"
|
|
|
|
fi
|
|
|
|
|
2016-04-02 06:28:43 +00:00
|
|
|
if [ "${libc_mode}" = "startfiles" ]; then
|
|
|
|
CT_DoLog EXTRA "Building headers"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make "${make_args[@]}" headers
|
2016-04-02 06:28:43 +00:00
|
|
|
|
|
|
|
# Ensure the directory for installing multilib-specific binaries exists.
|
|
|
|
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing headers"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make "${make_args[@]}" install_headers
|
2016-04-02 06:28:43 +00:00
|
|
|
|
|
|
|
# The check might look bogus, but it is the same condition as is used
|
|
|
|
# by GCC build script to enable/disable shared library support.
|
|
|
|
if [ "${CT_THREADS}" = "nptl" ]; then
|
|
|
|
CT_DoLog EXTRA "Building start files"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${jflag} "${make_args[@]}" \
|
2016-04-02 06:28:43 +00:00
|
|
|
lib/crt1.o lib/crti.o lib/crtn.o
|
|
|
|
|
|
|
|
# From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
|
|
|
|
# libm.so is needed for ppc, as libgcc is linked against libm.so
|
|
|
|
# No problem to create it for other archs.
|
|
|
|
CT_DoLog EXTRA "Building dummy shared libs"
|
2017-01-14 05:24:16 +00:00
|
|
|
CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -nostdlib -nostartfiles \
|
2016-04-05 21:47:20 +00:00
|
|
|
-shared ${multi_flags} -x c /dev/null -o libdummy.so
|
2016-04-02 06:28:43 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing start files"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
|
2016-04-02 06:28:43 +00:00
|
|
|
"${startfiles_dir}"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing dummy shared libs"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libc.so"
|
|
|
|
CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libm.so"
|
2016-04-02 06:28:43 +00:00
|
|
|
fi # CT_THREADS == nptl
|
|
|
|
fi # libc_mode == startfiles
|
|
|
|
|
|
|
|
if [ "${libc_mode}" = "final" ]; then
|
|
|
|
CT_DoLog EXTRA "Cleaning up startfiles"
|
|
|
|
CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
|
|
|
|
"${startfiles_dir}/crti.o" \
|
|
|
|
"${startfiles_dir}/crtn.o" \
|
|
|
|
"${startfiles_dir}/libc.so" \
|
|
|
|
"${startfiles_dir}/libm.so"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building C library"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make "${make_args[@]}" pregen
|
|
|
|
CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all
|
2016-04-02 06:28:43 +00:00
|
|
|
|
|
|
|
# YEM-FIXME:
|
|
|
|
# - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
|
|
|
|
# such files, except the headers as they already are installed
|
|
|
|
# - "make install_dev" installs the headers, the crti.o... and the
|
|
|
|
# static libs, but not the dynamic libs
|
|
|
|
# - "make install_runtime" installs the dynamic libs only
|
|
|
|
# - "make install" calls install_runtime and install_dev
|
|
|
|
# - so we're left with re-installing the headers... Sigh...
|
|
|
|
CT_DoLog EXTRA "Installing C library"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make "${make_args[@]}" install install_utils
|
2016-04-02 06:28:43 +00:00
|
|
|
fi # libc_mode == final
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2016-04-05 21:47:20 +00:00
|
|
|
# Now, if installing headers into a subdirectory, put everything in its place.
|
|
|
|
# Remove the header subdirectory if it existed already.
|
2016-04-14 07:30:34 +00:00
|
|
|
if [ -n "${hdr_install_subdir}" ]; then
|
2016-04-05 21:47:20 +00:00
|
|
|
CT_DoExecLog ALL mv "${multi_root}/usr/include" "${multi_root}/usr/include.new"
|
|
|
|
CT_DoExecLog ALL mv "${multi_root}/usr/include.saved" "${multi_root}/usr/include"
|
|
|
|
CT_DoExecLog ALL rm -rf "${multi_root}/usr/include/${hdr_install_subdir}"
|
|
|
|
CT_DoExecLog ALL mv "${multi_root}/usr/include.new" "${multi_root}/usr/include/${hdr_install_subdir}"
|
|
|
|
fi
|
2016-04-12 06:11:22 +00:00
|
|
|
|
2016-04-11 20:59:16 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
# Initialises the .config file to sensible values
|
2007-07-28 11:59:37 +00:00
|
|
|
# $1: original file
|
2015-11-10 07:50:13 +00:00
|
|
|
# $2: modified file
|
2018-11-24 06:14:07 +00:00
|
|
|
manage_uClibc_config()
|
|
|
|
{
|
2015-11-10 07:50:13 +00:00
|
|
|
src="$1"
|
|
|
|
dst="$2"
|
2016-04-05 21:47:20 +00:00
|
|
|
flags="$3"
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2015-11-10 07:50:13 +00:00
|
|
|
# Start with fresh files
|
|
|
|
CT_DoExecLog ALL cp "${src}" "${dst}"
|
2010-01-01 17:47:20 +00:00
|
|
|
|
2011-11-20 20:08:27 +00:00
|
|
|
case "${CT_ARCH_ENDIAN}" in
|
2017-08-29 22:36:52 +00:00
|
|
|
big|big,little)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
|
|
|
;;
|
2017-08-29 22:36:52 +00:00
|
|
|
little|little,big)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
|
|
|
CT_KconfigEnableOption "ARCH_WANTS_LITTLE_ENDIAN" "${dst}"
|
|
|
|
;;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
|
|
|
|
2011-04-24 16:57:01 +00:00
|
|
|
if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "ARCH_USE_MMU" "${dst}"
|
2011-04-24 16:57:01 +00:00
|
|
|
else
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "ARCH_USE_MMU" "${dst}"
|
2019-02-20 08:43:39 +00:00
|
|
|
CT_KconfigDisableOption "UCLIBC_FORMAT_FDPIC" "${dst}"
|
|
|
|
CT_KconfigDisableOption "UCLIBC_FORMAT_FLAT" "${dst}"
|
|
|
|
CT_KconfigDisableOption "UCLIBC_FORMAT_SHARED_FLAT" "${dst}"
|
|
|
|
case "${CT_ARCH_BINFMT_FLAT},${CT_ARCH_BINFMT_FDPIC},${CT_SHARED_LIBS}" in
|
|
|
|
y,,y) CT_KconfigEnableOption "UCLIBC_FORMAT_SHARED_FLAT" "${dst}";;
|
|
|
|
y,,) CT_KconfigEnableOption "UCLIBC_FORMAT_FLAT" "${dst}";;
|
|
|
|
,y,*) CT_KconfigEnableOption "UCLIBC_FORMAT_FDPIC" "${dst}";;
|
|
|
|
*) CT_Abort "Unsupported binary format";;
|
|
|
|
esac
|
2011-04-24 16:57:01 +00:00
|
|
|
fi
|
|
|
|
|
2016-08-29 17:46:02 +00:00
|
|
|
if [ "${CT_SHARED_LIBS}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "HAVE_SHARED" "${dst}"
|
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "HAVE_SHARED" "${dst}"
|
|
|
|
fi
|
|
|
|
|
2007-05-19 22:52:47 +00:00
|
|
|
# Accomodate for old and new uClibc version, where the
|
|
|
|
# way to select between hard/soft float has changed
|
2011-11-14 17:54:37 +00:00
|
|
|
case "${CT_ARCH_FLOAT}" in
|
|
|
|
hard|softfp)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_FLOATS" "${dst}"
|
2007-02-24 11:00:05 +00:00
|
|
|
;;
|
2011-11-14 17:54:37 +00:00
|
|
|
soft)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_FLOATS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "DO_C99_MATH" "${dst}"
|
2007-02-24 11:00:05 +00:00
|
|
|
;;
|
|
|
|
esac
|
2014-01-04 15:19:18 +00:00
|
|
|
if [ "${CT_LIBC_UCLIBC_FENV}" = "y" ]; then
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_FENV" "${dst}"
|
2017-01-23 22:37:18 +00:00
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_FENV" "${dst}"
|
|
|
|
fi
|
|
|
|
if [ "${CT_LIBC_UCLIBC_RPC}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_RPC" "${dst}"
|
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_RPC" "${dst}"
|
2014-01-04 15:19:18 +00:00
|
|
|
fi
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2011-08-12 22:05:51 +00:00
|
|
|
# We always want ctor/dtor
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_CTOR_DTOR" "${dst}"
|
2011-08-12 22:05:51 +00:00
|
|
|
|
2007-09-16 17:59:18 +00:00
|
|
|
# Change paths to work with crosstool-NG
|
2015-11-10 07:50:13 +00:00
|
|
|
#
|
|
|
|
# DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX,
|
|
|
|
# which is the correct value of ${PREFIX}/${TARGET}.
|
|
|
|
CT_KconfigSetOption "DEVEL_PREFIX" "\"/usr/\"" "${dst}"
|
|
|
|
CT_KconfigSetOption "RUNTIME_PREFIX" "\"/\"" "${dst}"
|
|
|
|
CT_KconfigSetOption "KERNEL_HEADERS" "\"${CT_HEADERS_DIR}\"" "${dst}"
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-11-01 17:13:54 +00:00
|
|
|
# Locales support
|
2007-02-24 11:00:05 +00:00
|
|
|
# Note that the two PREGEN_LOCALE and the XLOCALE lines may be missing
|
|
|
|
# entirely if LOCALE is not set. If LOCALE was already set, we'll
|
|
|
|
# assume the user has already made all the appropriate generation
|
|
|
|
# arrangements. Note that having the uClibc Makefile download the
|
2017-07-03 21:49:54 +00:00
|
|
|
# pregenerated locales is not compatible with crosstool.
|
2017-07-04 00:45:37 +00:00
|
|
|
if [ -z "${CT_LIBC_UCLIBC_LOCALES}" ]; then
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_LOCALE" "${dst}"
|
|
|
|
else
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}"
|
|
|
|
CT_KconfigDeleteOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}"
|
2017-07-03 21:49:54 +00:00
|
|
|
CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" "${dst}"
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}"
|
2017-07-04 00:45:37 +00:00
|
|
|
fi
|
2008-11-01 17:13:54 +00:00
|
|
|
|
2009-11-06 19:17:30 +00:00
|
|
|
# WCHAR support
|
2015-11-10 07:50:13 +00:00
|
|
|
if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_WCHAR" "${dst}"
|
2009-11-06 19:17:30 +00:00
|
|
|
else
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_WCHAR" "${dst}"
|
2009-11-06 19:17:30 +00:00
|
|
|
fi
|
|
|
|
|
2015-11-23 06:18:08 +00:00
|
|
|
# IPv6 support
|
|
|
|
if [ "${CT_LIBC_UCLIBC_IPV6}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_IPV6" "${dst}"
|
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_IPV6" "${dst}"
|
|
|
|
fi
|
|
|
|
|
2018-02-10 22:35:50 +00:00
|
|
|
# Iconv support
|
|
|
|
if [ "${CT_LIBC_UCLIBC_LIBICONV}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_LIBICONV" "${dst}"
|
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_LIBICONV" "${dst}"
|
|
|
|
fi
|
|
|
|
|
2008-11-01 17:13:54 +00:00
|
|
|
# Force on options needed for C++ if we'll be making a C++ compiler.
|
|
|
|
# I'm not sure locales are a requirement for doing C++... Are they?
|
2007-02-24 11:00:05 +00:00
|
|
|
if [ "${CT_CC_LANG_CXX}" = "y" ]; then
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "DO_C99_MATH" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_GNU_GETOPT" "${dst}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Stack Smash Protection (SSP)
|
2018-12-05 00:15:37 +00:00
|
|
|
if [ "${CT_LIBC_UCLIBC_HAS_SSP}" = "y" ]; then
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_SSP" "${dst}"
|
|
|
|
else
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_SSP" "${dst}"
|
2018-12-05 00:15:37 +00:00
|
|
|
fi
|
|
|
|
if [ "${CT_LIBC_UCLIBC_BUILD_SSP}" = "y" ]; then
|
|
|
|
CT_KconfigEnableOption "UCLIBC_BUILD_SSP" "${dst}"
|
|
|
|
else
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigDisableOption "UCLIBC_BUILD_SSP" "${dst}"
|
2007-02-24 11:00:05 +00:00
|
|
|
fi
|
|
|
|
|
2010-06-08 22:41:25 +00:00
|
|
|
# Push the threading model
|
2016-04-04 15:25:07 +00:00
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_THREADS" "${dst}"
|
|
|
|
CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}"
|
|
|
|
CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}"
|
|
|
|
CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
|
2010-06-08 22:41:25 +00:00
|
|
|
case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in
|
2010-07-02 23:15:28 +00:00
|
|
|
none:)
|
2010-06-08 22:41:25 +00:00
|
|
|
;;
|
2016-09-20 01:50:08 +00:00
|
|
|
linuxthreads:)
|
|
|
|
# Newer version of uClibc-ng, no old/new dichotomy
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_LINUXTHREADS" "${dst}"
|
|
|
|
;;
|
2010-07-02 20:11:45 +00:00
|
|
|
linuxthreads:old)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "LINUXTHREADS_OLD" "${dst}"
|
2010-06-08 22:41:25 +00:00
|
|
|
;;
|
2010-07-02 20:11:45 +00:00
|
|
|
linuxthreads:new)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "LINUXTHREADS_NEW" "${dst}"
|
2010-07-02 23:15:28 +00:00
|
|
|
;;
|
|
|
|
nptl:)
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
|
2010-06-08 22:41:25 +00:00
|
|
|
;;
|
2010-07-02 23:15:28 +00:00
|
|
|
*)
|
|
|
|
CT_Abort "Incorrect thread settings: CT_THREADS='${CT_THREAD}' CT_LIBC_UCLIBC_LNXTHRD='${CT_LIBC_UCLIBC_LNXTHRD}'"
|
|
|
|
;;
|
2010-06-08 22:41:25 +00:00
|
|
|
esac
|
|
|
|
|
2008-06-19 08:14:52 +00:00
|
|
|
# Always build the libpthread_db
|
2015-11-10 07:50:13 +00:00
|
|
|
CT_KconfigEnableOption "PTHREADS_DEBUG_SUPPORT" "${dst}"
|
2008-06-19 08:14:52 +00:00
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
# Force on debug options if asked for
|
2016-04-04 15:25:07 +00:00
|
|
|
CT_KconfigDisableOption "DODEBUG" "${dst}"
|
|
|
|
CT_KconfigDisableOption "DODEBUG_PT" "${dst}"
|
|
|
|
CT_KconfigDisableOption "DOASSERTS" "${dst}"
|
|
|
|
CT_KconfigDisableOption "SUPPORT_LD_DEBUG" "${dst}"
|
|
|
|
CT_KconfigDisableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
|
|
|
|
CT_KconfigDisableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
|
2007-02-24 11:00:05 +00:00
|
|
|
case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
|
2015-11-10 07:50:13 +00:00
|
|
|
0)
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
CT_KconfigEnableOption "DODEBUG" "${dst}"
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
CT_KconfigEnableOption "DODEBUG" "${dst}"
|
|
|
|
CT_KconfigEnableOption "DOASSERTS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "SUPPORT_LD_DEBUG" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
|
|
|
|
;;
|
|
|
|
3)
|
|
|
|
CT_KconfigEnableOption "DODEBUG" "${dst}"
|
|
|
|
CT_KconfigEnableOption "DODEBUG_PT" "${dst}"
|
|
|
|
CT_KconfigEnableOption "DOASSERTS" "${dst}"
|
|
|
|
CT_KconfigEnableOption "SUPPORT_LD_DEBUG" "${dst}"
|
|
|
|
CT_KconfigEnableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
|
|
|
|
CT_KconfigEnableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
|
|
|
|
;;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
2016-04-04 15:25:07 +00:00
|
|
|
|
|
|
|
# Remove stripping: its the responsibility of the
|
|
|
|
# firmware builder to strip or not.
|
|
|
|
CT_KconfigDisableOption "DOSTRIP" "${dst}"
|
|
|
|
|
|
|
|
# Now allow architecture to tweak as it wants
|
|
|
|
CT_DoArchUClibcConfig "${dst}"
|
2016-04-05 21:47:20 +00:00
|
|
|
CT_DoArchUClibcCflags "${dst}" "${flags}"
|
2019-02-20 07:39:14 +00:00
|
|
|
|
|
|
|
# Preserve the config we created (before uclibc's `make olddefconfig`
|
|
|
|
# overrides anything).
|
|
|
|
CT_DoExecLog ALL cp "${dst}" "${dst}.created-by-ct-ng"
|
2007-02-24 11:00:05 +00:00
|
|
|
}
|
2015-06-21 23:53:06 +00:00
|
|
|
|
2018-12-03 21:04:44 +00:00
|
|
|
uClibc_post_cc()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
2016-04-17 07:11:03 +00:00
|
|
|
# uClibc and GCC disagree where the dynamic linker lives. uClibc always
|
|
|
|
# places it in the MULTILIB_DIR, while gcc does that for *some* variants
|
|
|
|
# and expects it in /lib for the other. So, create a symlink from lib
|
|
|
|
# to the actual location, but only if that will not override the actual
|
|
|
|
# file in /lib. Thus, need to do this after all the variants are built.
|
|
|
|
# Moreover, need to do this after the final compiler is built: on targets
|
|
|
|
# that use elf2flt, the core compilers cannot find ld when running elf2flt.
|
2017-03-13 02:41:09 +00:00
|
|
|
CT_MultilibFixupLDSO
|
2019-01-23 07:52:04 +00:00
|
|
|
|
|
|
|
if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
|
2019-01-23 07:54:29 +00:00
|
|
|
CT_InstallConfigurationFile "${CT_LIBC_UCLIBC_CONFIG_FILE}" libc
|
2019-01-23 07:52:04 +00:00
|
|
|
fi
|
2015-06-21 23:53:06 +00:00
|
|
|
}
|