mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-30 17:46:57 +00:00
uclibc: merge startfiles/final into single backend.
In preparation for multilib support, use the same "backend" model that is already employed by glibc and musl. Also, the verbosity setting descriptions were swapped. V=2 is actually less verbose than V=1: V=1 prints full commands, while V=2 prints 'CC <file> <defines>'. Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
28c24f5034
commit
4ee22d66a8
@ -129,13 +129,13 @@ config LIBC_UCLIBC_VERBOSITY_0
|
|||||||
|
|
||||||
config LIBC_UCLIBC_VERBOSITY_1
|
config LIBC_UCLIBC_VERBOSITY_1
|
||||||
bool
|
bool
|
||||||
prompt "Brief build (show defines, ld flags)"
|
prompt "Very verbose build"
|
||||||
help
|
help
|
||||||
Print simplified command lines.
|
Print simplified command lines.
|
||||||
|
|
||||||
config LIBC_UCLIBC_VERBOSITY_2
|
config LIBC_UCLIBC_VERBOSITY_2
|
||||||
bool
|
bool
|
||||||
prompt "Very verbose build"
|
prompt "Brief build (show defines, ld flags)"
|
||||||
help
|
help
|
||||||
Print full command lines.
|
Print full command lines.
|
||||||
|
|
||||||
|
@ -73,76 +73,95 @@ do_libc_check_config() {
|
|||||||
|
|
||||||
# Build and install headers and start files
|
# Build and install headers and start files
|
||||||
do_libc_start_files() {
|
do_libc_start_files() {
|
||||||
local multi_os_dir multi_root startfiles_dir
|
# Start files and Headers should be configured the same way as the
|
||||||
|
# final libc, but built and installed differently.
|
||||||
|
do_libc_backend libc_mode=startfiles
|
||||||
|
}
|
||||||
|
|
||||||
CT_DoStep INFO "Installing C library headers"
|
# This function builds and install the full C library
|
||||||
|
do_libc() {
|
||||||
|
do_libc_backend libc_mode=final
|
||||||
|
}
|
||||||
|
|
||||||
|
# Common backend for 1st and 2nd passes
|
||||||
|
do_libc_backend() {
|
||||||
|
local libc_mode
|
||||||
|
local multi_os_dir multi_root multilib_dir startfiles_dir
|
||||||
|
local jflag=${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}}
|
||||||
|
local -a make_args
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
# Simply copy files until uClibc has the ability to build out-of-tree
|
# Simply copy files until uClibc has the ability to build out-of-tree
|
||||||
CT_DoLog EXTRA "Copying sources to build dir"
|
CT_DoLog EXTRA "Copying sources to build dir"
|
||||||
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" \
|
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" \
|
||||||
"${CT_BUILD_DIR}/build-libc-headers"
|
"${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
||||||
cd "${CT_BUILD_DIR}/build-libc-headers"
|
cd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
||||||
|
|
||||||
|
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory )
|
||||||
|
multi_root=$( "${CT_TARGET}-gcc" -print-sysroot )
|
||||||
|
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}-" \
|
||||||
|
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
||||||
|
PREFIX="${multi_root}/" \
|
||||||
|
MULTILIB_DIR="${multilib_dir}" \
|
||||||
|
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
||||||
|
STRIPTOOL=true \
|
||||||
|
${CT_LIBC_UCLIBC_VERBOSITY} \
|
||||||
|
)
|
||||||
|
|
||||||
# Retrieve the config file
|
# Retrieve the config file
|
||||||
CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
|
CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
|
||||||
|
|
||||||
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory )
|
|
||||||
multi_root=$( "${CT_TARGET}-gcc" -print-sysroot )
|
|
||||||
startfiles_dir="${multi_root}/usr/lib/${multi_os_dir}"
|
|
||||||
CT_SanitizeVarDir startfiles_dir
|
|
||||||
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
|
|
||||||
|
|
||||||
# Force the date of the pregen locale data, as the
|
# Force the date of the pregen locale data, as the
|
||||||
# newer ones that are referenced are not available
|
# newer ones that are referenced are not available
|
||||||
CT_DoLog EXTRA "Applying configuration"
|
CT_DoLog EXTRA "Applying configuration"
|
||||||
CT_DoYes "" |CT_DoExecLog ALL \
|
CT_DoYes | CT_DoExecLog ALL ${make} "${make_args[@]}" oldconfig
|
||||||
${make} CROSS_COMPILE="${CT_TARGET}-" \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
oldconfig
|
|
||||||
|
|
||||||
|
if [ "${libc_mode}" = "startfiles" ]; then
|
||||||
CT_DoLog EXTRA "Building headers"
|
CT_DoLog EXTRA "Building headers"
|
||||||
CT_DoExecLog ALL \
|
CT_DoExecLog ALL ${make} "${make_args[@]}" headers
|
||||||
${make} ${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
CROSS_COMPILE="${CT_TARGET}-" \
|
# Ensure the directory for installing multilib-specific binaries exists.
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
headers
|
|
||||||
|
|
||||||
CT_DoLog EXTRA "Installing headers"
|
CT_DoLog EXTRA "Installing headers"
|
||||||
CT_DoExecLog ALL \
|
CT_DoExecLog ALL ${make} "${make_args[@]}" install_headers
|
||||||
${make} ${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
CROSS_COMPILE="${CT_TARGET}-" \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
install_headers
|
|
||||||
|
|
||||||
# The check might look bogus, but it is the same condition as is used
|
# The check might look bogus, but it is the same condition as is used
|
||||||
# by GCC build script to enable/disable shared library support.
|
# by GCC build script to enable/disable shared library support.
|
||||||
if [ "${CT_THREADS}" = "nptl" ]; then
|
if [ "${CT_THREADS}" = "nptl" ]; then
|
||||||
CT_DoLog EXTRA "Building start files"
|
CT_DoLog EXTRA "Building start files"
|
||||||
CT_DoExecLog ALL \
|
CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" \
|
||||||
${make} ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}} \
|
|
||||||
CROSS_COMPILE="${CT_TARGET}-" \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
STRIPTOOL=true \
|
|
||||||
${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
lib/crt1.o lib/crti.o lib/crtn.o
|
lib/crt1.o lib/crti.o lib/crtn.o
|
||||||
|
|
||||||
# From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
|
# From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
|
||||||
# libm.so is needed for ppc, as libgcc is linked against libm.so
|
# libm.so is needed for ppc, as libgcc is linked against libm.so
|
||||||
# No problem to create it for other archs.
|
# No problem to create it for other archs.
|
||||||
CT_DoLog EXTRA "Building dummy shared libs"
|
CT_DoLog EXTRA "Building dummy shared libs"
|
||||||
CT_DoExecLog ALL "${CT_TARGET}-gcc" -nostdlib \
|
CT_DoExecLog ALL "${CT_TARGET}-gcc" -nostdlib -nostartfiles \
|
||||||
-nostartfiles \
|
-shared -x c /dev/null -o libdummy.so
|
||||||
-shared \
|
|
||||||
-x c /dev/null \
|
|
||||||
-o libdummy.so
|
|
||||||
|
|
||||||
CT_DoLog EXTRA "Installing start files"
|
CT_DoLog EXTRA "Installing start files"
|
||||||
CT_DoExecLog ALL ${install} -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
|
CT_DoExecLog ALL ${install} -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
|
||||||
@ -152,29 +171,9 @@ do_libc_start_files() {
|
|||||||
CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libc.so"
|
CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libc.so"
|
||||||
CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libm.so"
|
CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libm.so"
|
||||||
fi # CT_THREADS == nptl
|
fi # CT_THREADS == nptl
|
||||||
|
fi # libc_mode == startfiles
|
||||||
|
|
||||||
CT_EndStep
|
if [ "${libc_mode}" = "final" ]; then
|
||||||
}
|
|
||||||
|
|
||||||
# This function build and install the full uClibc
|
|
||||||
do_libc() {
|
|
||||||
local multi_os_dir multi_root multilib_dir startfiles_dir
|
|
||||||
|
|
||||||
CT_DoStep INFO "Installing C library"
|
|
||||||
|
|
||||||
# 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_name}-${CT_LIBC_VERSION}" \
|
|
||||||
"${CT_BUILD_DIR}/build-libc"
|
|
||||||
cd "${CT_BUILD_DIR}/build-libc"
|
|
||||||
|
|
||||||
# Retrieve the config file
|
|
||||||
CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
|
|
||||||
|
|
||||||
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory )
|
|
||||||
multi_root=$( "${CT_TARGET}-gcc" -print-sysroot )
|
|
||||||
startfiles_dir="${multi_root}/usr/lib/${multi_os_dir}"
|
|
||||||
|
|
||||||
CT_DoLog EXTRA "Cleaning up startfiles"
|
CT_DoLog EXTRA "Cleaning up startfiles"
|
||||||
CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
|
CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
|
||||||
"${startfiles_dir}/crti.o" \
|
"${startfiles_dir}/crti.o" \
|
||||||
@ -182,46 +181,9 @@ do_libc() {
|
|||||||
"${startfiles_dir}/libc.so" \
|
"${startfiles_dir}/libc.so" \
|
||||||
"${startfiles_dir}/libm.so"
|
"${startfiles_dir}/libm.so"
|
||||||
|
|
||||||
multilib_dir="lib/${multi_os_dir}"
|
|
||||||
CT_SanitizeVarDir multilib_dir
|
|
||||||
|
|
||||||
# uClibc uses the CROSS environment variable as a prefix to the compiler
|
|
||||||
# tools to use. The newly built tools should be in our path, so we need
|
|
||||||
# only give the correct name for them.
|
|
||||||
# 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.
|
|
||||||
CT_DoLog EXTRA "Applying configuration"
|
|
||||||
CT_DoYes "" |CT_DoExecLog CFG \
|
|
||||||
${make} CROSS_COMPILE=${CT_TARGET}- \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
oldconfig
|
|
||||||
|
|
||||||
# We do _not_ want to strip anything for now, in case we specifically
|
|
||||||
# asked for a debug toolchain, thus the STRIPTOOL= assignment
|
|
||||||
# /Old/ versions can not build in //
|
|
||||||
CT_DoLog EXTRA "Building C library"
|
CT_DoLog EXTRA "Building C library"
|
||||||
CT_DoExecLog ALL \
|
CT_DoExecLog ALL ${make} "${make_args[@]}" pregen
|
||||||
${make} -j1 \
|
CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" all
|
||||||
CROSS_COMPILE=${CT_TARGET}- \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
STRIPTOOL=true \
|
|
||||||
${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
pregen
|
|
||||||
CT_DoExecLog ALL \
|
|
||||||
${make} ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}} \
|
|
||||||
CROSS_COMPILE=${CT_TARGET}- \
|
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
STRIPTOOL=true \
|
|
||||||
${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
all
|
|
||||||
|
|
||||||
# YEM-FIXME:
|
# YEM-FIXME:
|
||||||
# - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
|
# - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
|
||||||
@ -231,22 +193,9 @@ do_libc() {
|
|||||||
# - "make install_runtime" installs the dynamic libs only
|
# - "make install_runtime" installs the dynamic libs only
|
||||||
# - "make install" calls install_runtime and install_dev
|
# - "make install" calls install_runtime and install_dev
|
||||||
# - so we're left with re-installing the headers... Sigh...
|
# - so we're left with re-installing the headers... Sigh...
|
||||||
#
|
|
||||||
# We do _not_ want to strip anything for now, in case we specifically
|
|
||||||
# asked for a debug toolchain, hence the STRIPTOOL= assignment
|
|
||||||
#
|
|
||||||
# Note: JOBSFLAGS is not useful for installation.
|
|
||||||
#
|
|
||||||
CT_DoLog EXTRA "Installing C library"
|
CT_DoLog EXTRA "Installing C library"
|
||||||
CT_DoExecLog ALL \
|
CT_DoExecLog ALL ${make} "${make_args[@]}" install
|
||||||
${make} CROSS_COMPILE=${CT_TARGET}- \
|
fi # libc_mode == final
|
||||||
UCLIBC_EXTRA_CFLAGS="-pipe" \
|
|
||||||
PREFIX="${multi_root}/" \
|
|
||||||
STRIPTOOL=true \
|
|
||||||
${CT_LIBC_UCLIBC_VERBOSITY} \
|
|
||||||
LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
|
|
||||||
MULTILIB_DIR="${multilib_dir}" \
|
|
||||||
install
|
|
||||||
|
|
||||||
CT_EndStep
|
CT_EndStep
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user