mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-20 21:33:08 +00:00
Fold libc_start_files into libc
After557b9d4
, libc_start_files and libc_main steps are performed one after another. It doesn't make sense, especially since some of the libcs (glibc, uClibc-ng) go to great lengths to first install start files in the first step, libc_start_files, only to remove them immediately in the second step, libc_main. Current build steps also break in the xtensa newlib configurations, as it needs to install the custom xtensa headers before building the libgcc and after557b9d4
, the headers are not installed before libgcc is built in pass-1. Therefore, finish what557b9d4
mentioned but did not do: move header installation into a new step, libc_headers, and combine libc_start_files and libc_main into a single step. This also allows to combine the core pass-1/pass-2 steps, to be done in a subsequent commit. Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
c320d220d6
commit
93be629f2b
3
ct-ng.in
3
ct-ng.in
@ -268,6 +268,7 @@ build.%:
|
||||
# but are actual steps for canadian and cross-native.
|
||||
# Please keep the last line with a '\' and keep the following empty line:
|
||||
# it helps when diffing and merging.
|
||||
# TBD move kernel headers and unify pass_1/pass_2?
|
||||
CT_STEPS := \
|
||||
companion_tools_for_build \
|
||||
companion_libs_for_build \
|
||||
@ -275,9 +276,9 @@ CT_STEPS := \
|
||||
companion_tools_for_host \
|
||||
companion_libs_for_host \
|
||||
binutils_for_host \
|
||||
libc_headers \
|
||||
cc_core_pass_1 \
|
||||
kernel_headers \
|
||||
libc_start_files \
|
||||
cc_core_pass_2 \
|
||||
libc_main \
|
||||
cc_for_build \
|
||||
|
@ -6,7 +6,7 @@
|
||||
# The actual implementation can override just what it needs then.
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_get() { CT_Fetch \"\${CT_LIBC_${CT_LIBC_CHOICE_KSYM}_PKG_KSYM}\"; }"
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract() { CT_ExtractPatch \"\${CT_LIBC_${CT_LIBC_CHOICE_KSYM}_PKG_KSYM}\"; }"
|
||||
for _m in start_files main post_cc; do
|
||||
for _m in headers main post_cc; do
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_${_m}() { :; }"
|
||||
done
|
||||
|
||||
@ -23,9 +23,9 @@ do_libc_extract()
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract"
|
||||
}
|
||||
|
||||
do_libc_start_files()
|
||||
do_libc_headers()
|
||||
{
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_start_files"
|
||||
eval "${CT_LIBC//[^A-Za-z0-9]/_}_headers"
|
||||
}
|
||||
|
||||
do_libc_main()
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
# Install Unified headers
|
||||
bionic_start_files()
|
||||
bionic_headers()
|
||||
{
|
||||
CT_DoStep INFO "Installing C library headers"
|
||||
CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/sysroot/usr" "${CT_SYSROOT_DIR}"
|
||||
|
@ -30,48 +30,14 @@ glibc_extract()
|
||||
fi
|
||||
}
|
||||
|
||||
# Build and install headers and start files
|
||||
glibc_start_files()
|
||||
{
|
||||
# Start files and Headers should be configured the same way as the
|
||||
# final libc, but built and installed differently.
|
||||
glibc_backend libc_mode=startfiles
|
||||
}
|
||||
|
||||
# This function builds and install the full C library
|
||||
glibc_main()
|
||||
{
|
||||
glibc_backend libc_mode=final
|
||||
}
|
||||
|
||||
# This backend builds the C library once for each multilib
|
||||
# variant the compiler gives us
|
||||
# Usage: glibc_backend param=value [...]
|
||||
# Parameter : Definition : Type : Default
|
||||
# libc_mode : 'startfiles' or 'final' : string : (none)
|
||||
glibc_backend()
|
||||
{
|
||||
local libc_mode
|
||||
local arg
|
||||
|
||||
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
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
||||
CT_IterateMultilibs glibc_backend_once multilib libc_mode="${libc_mode}"
|
||||
CT_DoStep INFO "Installing C library"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc"
|
||||
CT_IterateMultilibs glibc_backend_once multilib
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
@ -79,13 +45,14 @@ glibc_backend()
|
||||
# This backend builds the C library once
|
||||
# Usage: glibc_backend_once param=value [...]
|
||||
# Parameter : Definition : Type
|
||||
# libc_mode : 'startfiles' or 'final' : string : (empty)
|
||||
# multi_* : as defined in CT_IterateMultilibs : (varies) :
|
||||
glibc_backend_once()
|
||||
{
|
||||
# Glibc seems to be smart enough to know about the cases that can coexist
|
||||
# in the same root and installs them into proper multilib-os directory; all
|
||||
# we need is to point to the right root.
|
||||
local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target
|
||||
local build_cflags build_cppflags build_ldflags
|
||||
local startfiles_dir
|
||||
local src_dir="${CT_SRC_DIR}/glibc"
|
||||
local -a extra_config
|
||||
local -a extra_make_args
|
||||
@ -104,29 +71,9 @@ glibc_backend_once()
|
||||
# Adjust target tuple according GLIBC quirks
|
||||
CT_DoArchGlibcAdjustTuple multi_target
|
||||
|
||||
# Glibc seems to be smart enough to know about the cases that can coexist
|
||||
# in the same root and installs them into proper multilib-os directory; all
|
||||
# we need is to point to the right root. We do need to handle multilib-os
|
||||
# here, though, for the first pass where we install crt*.o and a dummy
|
||||
# libc.so; we therefore install it to the most specific location of
|
||||
# <sysroot>/<suffix>/usr/lib/<multilib-os> where it is least likely to clash
|
||||
# with other multilib variants. We then remove these temporary files at
|
||||
# the beginning of the libc-final step and allow glibc to install them
|
||||
# where it thinks is proper.
|
||||
startfiles_dir="${multi_root}/usr/lib/${multi_os_dir}"
|
||||
CT_SanitizeVarDir startfiles_dir
|
||||
|
||||
if [ "${libc_mode}" = "final" ]; then
|
||||
CT_DoLog EXTRA "Cleaning up start files"
|
||||
CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
|
||||
"${startfiles_dir}/crti.o" \
|
||||
"${startfiles_dir}/crtn.o" \
|
||||
"${startfiles_dir}/libc.so"
|
||||
fi
|
||||
|
||||
CT_DoLog EXTRA "Configuring C library"
|
||||
|
||||
# Also, if those two are missing, iconv build breaks
|
||||
# If those two are missing, iconv build breaks
|
||||
extra_config+=( --disable-debug --disable-sanity-checks )
|
||||
|
||||
if [ "${CT_GLIBC_ENABLE_OBSOLETE_RPC}" = "y" ]; then
|
||||
@ -259,7 +206,6 @@ glibc_backend_once()
|
||||
CT_DoLog DEBUG "Configuring with addons : '$(glibc_add_ons_list ,)'"
|
||||
CT_DoLog DEBUG "Extra config args passed : '${extra_config[*]}'"
|
||||
CT_DoLog DEBUG "Extra CFLAGS passed : '${glibc_cflags}'"
|
||||
CT_DoLog DEBUG "Placing startfiles into : '${startfiles_dir}'"
|
||||
CT_DoLog DEBUG "Configuring with --host : '${multi_target}'"
|
||||
|
||||
# CFLAGS are only applied when compiling .c files. .S files are compiled with ASFLAGS,
|
||||
@ -324,111 +270,34 @@ glibc_backend_once()
|
||||
extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" )
|
||||
extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" )
|
||||
|
||||
if [ "${libc_mode}" = "startfiles" -a ! -r "${multi_root}/.libc_headers_installed" ]; then
|
||||
CT_DoLog EXTRA "Installing C library headers"
|
||||
CT_DoExecLog ALL touch "${multi_root}/.libc_headers_installed"
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
"${extra_make_args[@]}" \
|
||||
all
|
||||
|
||||
# use the 'install-headers' makefile target to install the
|
||||
# headers
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
install_root=${multi_root} \
|
||||
install-bootstrap-headers=yes \
|
||||
"${extra_make_args[@]}" \
|
||||
install-headers
|
||||
CT_DoLog EXTRA "Installing C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
"${extra_make_args[@]}" \
|
||||
install_root="${multi_root}" \
|
||||
install
|
||||
|
||||
# Two headers -- stubs.h and features.h -- aren't installed by install-headers,
|
||||
# so do them by hand. We can tolerate an empty stubs.h for the moment.
|
||||
# See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
|
||||
mkdir -p "${CT_HEADERS_DIR}/gnu"
|
||||
CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
|
||||
CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \
|
||||
"${CT_HEADERS_DIR}/features.h"
|
||||
if [ "${CT_BUILD_MANUALS}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
|
||||
# We only need to build the manuals once. Only build them on the
|
||||
# last multilib target. If it's not multilib, it will happen on the
|
||||
# only target.
|
||||
CT_DoLog EXTRA "Building and installing the C library manual"
|
||||
# Omit CT_JOBSFLAGS as GLIBC has problems building the
|
||||
# manuals in parallel
|
||||
CT_DoExecLog ALL make pdf html
|
||||
CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc
|
||||
CT_DoExecLog ALL cp -av manual/*.pdf \
|
||||
manual/libc \
|
||||
${CT_PREFIX_DIR}/share/doc
|
||||
fi
|
||||
|
||||
# Building the bootstrap gcc requires either setting inhibit_libc, or
|
||||
# having a copy of stdio_lim.h... see
|
||||
# http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
|
||||
CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
|
||||
|
||||
# Following error building gcc-4.0.0's gcj:
|
||||
# error: bits/syscall.h: No such file or directory
|
||||
# solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
|
||||
# but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
|
||||
# Of course, only copy it if it does not already exist
|
||||
case "${CT_ARCH}" in
|
||||
arm) ;;
|
||||
*) if [ -f "${CT_HEADERS_DIR}/bits/syscall.h" ]; then
|
||||
CT_DoLog ALL "Not over-writing existing bits/syscall.h"
|
||||
elif [ -f "misc/bits/syscall.h" ]; then
|
||||
CT_DoExecLog ALL cp -v "misc/bits/syscall.h" \
|
||||
"${CT_HEADERS_DIR}/bits/syscall.h"
|
||||
else
|
||||
# "Old" glibces do not have the above file,
|
||||
# but provide this one:
|
||||
CT_DoExecLog ALL cp -v "misc/syscall-list.h" \
|
||||
"${CT_HEADERS_DIR}/bits/syscall.h"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
elif [ "${libc_mode}" = "final" -a -r "${multi_root}/.libc_headers_installed" ]; then
|
||||
CT_DoExecLog ALL rm -f "${multi_root}/.libc_headers_installed"
|
||||
fi # installing headers
|
||||
|
||||
if [ "${libc_mode}" = "startfiles" ]; then
|
||||
if [ "${CT_THREADS}" = "nptl" ]; then
|
||||
CT_DoLog EXTRA "Installing C library start files"
|
||||
|
||||
# there are a few object files needed to link shared libraries,
|
||||
# which we build and install by hand
|
||||
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
"${extra_make_args[@]}" \
|
||||
csu/subdir_lib
|
||||
CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
|
||||
"${startfiles_dir}"
|
||||
|
||||
# Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
|
||||
# However, since we will never actually execute its code,
|
||||
# it doesn't matter what it contains. So, treating '/dev/null'
|
||||
# as a C source file, we produce a dummy 'libc.so' in one step
|
||||
CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" ${multi_flags} \
|
||||
-nostdlib \
|
||||
-nostartfiles \
|
||||
-shared \
|
||||
-x c /dev/null \
|
||||
-o "${startfiles_dir}/libc.so"
|
||||
fi # threads == nptl
|
||||
fi # libc_mode = startfiles
|
||||
|
||||
if [ "${libc_mode}" = "final" ]; then
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
"${extra_make_args[@]}" \
|
||||
all
|
||||
|
||||
CT_DoLog EXTRA "Installing C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} \
|
||||
"${extra_make_args[@]}" \
|
||||
install_root="${multi_root}" \
|
||||
install
|
||||
|
||||
if [ "${CT_BUILD_MANUALS}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
|
||||
# We only need to build the manuals once. Only build them on the
|
||||
# last multilib target. If it's not multilib, it will happen on the
|
||||
# only target.
|
||||
CT_DoLog EXTRA "Building and installing the C library manual"
|
||||
# Omit CT_JOBSFLAGS as GLIBC has problems building the
|
||||
# manuals in parallel
|
||||
CT_DoExecLog ALL make pdf html
|
||||
CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc
|
||||
CT_DoExecLog ALL cp -av manual/*.pdf \
|
||||
manual/libc \
|
||||
${CT_PREFIX_DIR}/share/doc
|
||||
fi
|
||||
|
||||
if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
|
||||
glibc_locales
|
||||
fi
|
||||
fi # libc_mode = final
|
||||
if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
|
||||
glibc_locales
|
||||
fi
|
||||
|
||||
CT_EndStep
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ mingw_w64_set_install_prefix()
|
||||
fi
|
||||
}
|
||||
|
||||
mingw_w64_start_files() {
|
||||
mingw_w64_headers() {
|
||||
local -a sdk_opts
|
||||
|
||||
CT_DoStep INFO "Installing C library headers"
|
||||
|
@ -14,9 +14,9 @@ moxiebox_extract()
|
||||
CT_ExtractPatch MOXIEBOX
|
||||
}
|
||||
|
||||
moxiebox_start_files()
|
||||
moxiebox_headers()
|
||||
{
|
||||
newlib_start_files
|
||||
newlib_headers
|
||||
}
|
||||
|
||||
moxiebox_main()
|
||||
|
@ -2,42 +2,18 @@
|
||||
# Copyright 2013 Timo Teräs
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
# Build and install headers and start files
|
||||
musl_start_files()
|
||||
musl_post_cc()
|
||||
{
|
||||
# Start files and Headers should be configured the same way as the
|
||||
# final libc, but built and installed differently.
|
||||
musl_backend libc_mode=startfiles
|
||||
}
|
||||
|
||||
# This function builds and install the full C library
|
||||
musl_main()
|
||||
{
|
||||
musl_backend libc_mode=final
|
||||
}
|
||||
|
||||
musl_post_cc() {
|
||||
# MUSL creates dynamic linker symlink with absolute path - which works on the
|
||||
# target but not on the host. We want our cross-ldd tool to work.
|
||||
CT_MultilibFixupLDSO
|
||||
}
|
||||
|
||||
musl_backend() {
|
||||
local libc_mode
|
||||
local arg
|
||||
|
||||
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
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
||||
CT_IterateMultilibs musl_backend_once multilib libc_mode="${libc_mode}"
|
||||
musl_main()
|
||||
{
|
||||
CT_DoStep INFO "Installing C library"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc"
|
||||
CT_IterateMultilibs musl_backend_once multilib
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
@ -45,9 +21,9 @@ musl_backend() {
|
||||
# This backend builds the C library
|
||||
# Usage: musl_backend param=value [...]
|
||||
# Parameter : Definition : Type : Default
|
||||
# libc_mode : 'startfiles' or 'final' : string : (none)
|
||||
musl_backend_once() {
|
||||
local libc_mode
|
||||
# multi_* : as defined in CT_IterateMultilibs : (varies) :
|
||||
musl_backend_once()
|
||||
{
|
||||
local -a extra_cflags
|
||||
local -a extra_config
|
||||
local src_dir="${CT_SRC_DIR}/musl"
|
||||
@ -110,45 +86,26 @@ musl_backend_once() {
|
||||
--disable-gcc-wrapper \
|
||||
"${extra_config[@]}"
|
||||
|
||||
if [ "${libc_mode}" = "startfiles" ]; then
|
||||
CT_DoLog EXTRA "Installing C library headers"
|
||||
CT_DoExecLog ALL make DESTDIR="${multi_root}" install-headers
|
||||
CT_DoLog EXTRA "Building C library start files"
|
||||
CT_DoExecLog ALL make DESTDIR="${multi_root}" \
|
||||
obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o
|
||||
CT_DoLog EXTRA "Installing C library start files"
|
||||
CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}"
|
||||
CT_DoExecLog ALL ${CT_TARGET}-${CT_CC} -nostdlib \
|
||||
-nostartfiles -shared -x c /dev/null -o "${multi_root}${multilib_dir}/libc.so"
|
||||
fi
|
||||
if [ "${libc_mode}" = "final" ]; then
|
||||
CT_DoLog EXTRA "Cleaning up start files"
|
||||
CT_DoExecLog ALL rm -f "${multi_root}${multilib_dir}/crt1.o" \
|
||||
"${multi_root}${multilib_dir}/crti.o" \
|
||||
"${multi_root}${multilib_dir}/crtn.o" \
|
||||
"${multi_root}${multilib_dir}/libc.so"
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
|
||||
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
|
||||
CT_DoLog EXTRA "Installing C library"
|
||||
CT_DoExecLog ALL make DESTDIR="${multi_root}" install
|
||||
|
||||
CT_DoLog EXTRA "Installing C library"
|
||||
CT_DoExecLog ALL make DESTDIR="${multi_root}" install
|
||||
# Convert /lib/ld-* symlinks to relative paths so that they are valid
|
||||
# both on the host and on the target.
|
||||
for f in ${multi_root}/ld-musl-*; do
|
||||
[ -L "${f}" ] || continue
|
||||
l=$( readlink ${f} )
|
||||
case "${l}" in
|
||||
${multilib_dir}/*)
|
||||
CT_DoExecLog ALL ln -sf "../${l}" "${f}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Convert /lib/ld-* symlinks to relative paths so that they are valid
|
||||
# both on the host and on the target.
|
||||
for f in ${multi_root}/ld-musl-*; do
|
||||
[ -L "${f}" ] || continue
|
||||
l=$( readlink ${f} )
|
||||
case "${l}" in
|
||||
${multilib_dir}/*)
|
||||
CT_DoExecLog ALL ln -sf "../${l}" "${f}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Any additional actions for this architecture
|
||||
CT_DoArchMUSLPostInstall
|
||||
fi
|
||||
# Any additional actions for this architecture
|
||||
CT_DoArchMUSLPostInstall
|
||||
|
||||
CT_EndStep
|
||||
}
|
||||
|
@ -5,11 +5,10 @@
|
||||
# Edited by Martin Lund <mgl@doredevelopment.dk>
|
||||
#
|
||||
|
||||
newlib_start_files()
|
||||
newlib_headers()
|
||||
{
|
||||
CT_DoStep INFO "Installing C library headers & start files"
|
||||
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." \
|
||||
"${CT_HEADERS_DIR}"
|
||||
CT_DoStep INFO "Installing C library headers"
|
||||
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." "${CT_HEADERS_DIR}"
|
||||
if [ "${CT_ARCH_XTENSA}" = "y" ]; then
|
||||
CT_DoLog EXTRA "Installing Xtensa headers"
|
||||
CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib/newlib/libc/sys/xtensa/include/." \
|
||||
|
@ -2,38 +2,12 @@
|
||||
# Copyright 2007 Yann E. MORIN
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
# Build and install headers and start files
|
||||
uClibc_ng_start_files()
|
||||
{
|
||||
# Start files and Headers should be configured the same way as the
|
||||
# final libc, but built and installed differently.
|
||||
uClibc_ng_backend libc_mode=startfiles
|
||||
}
|
||||
|
||||
# This function builds and install the full C library
|
||||
uClibc_ng_main()
|
||||
{
|
||||
uClibc_ng_backend libc_mode=final
|
||||
}
|
||||
|
||||
# Common backend for 1st and 2nd passes.
|
||||
uClibc_ng_backend()
|
||||
{
|
||||
local libc_mode
|
||||
local arg
|
||||
|
||||
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
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
|
||||
CT_IterateMultilibs uClibc_ng_backend_once multilib libc_mode="${libc_mode}"
|
||||
CT_DoStep INFO "Installing C library"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc"
|
||||
CT_IterateMultilibs uClibc_ng_backend_once multilib
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
@ -41,7 +15,6 @@ uClibc_ng_backend()
|
||||
# Common backend for 1st and 2nd passes, once per multilib.
|
||||
uClibc_ng_backend_once()
|
||||
{
|
||||
local libc_mode
|
||||
local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
|
||||
local multilib_dir startfiles_dir
|
||||
local jflag=${CT_JOBSFLAGS}
|
||||
@ -129,65 +102,11 @@ uClibc_ng_backend_once()
|
||||
CT_DoExecLog ALL cp -a "${multi_root}/usr/include" "${multi_root}/usr/include.saved"
|
||||
fi
|
||||
|
||||
if [ "${libc_mode}" = "startfiles" ]; then
|
||||
CT_DoLog EXTRA "Building headers"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" headers
|
||||
|
||||
# Ensure the directory for installing multilib-specific binaries exists.
|
||||
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
|
||||
|
||||
CT_DoLog EXTRA "Installing headers"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" install_headers
|
||||
|
||||
# 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"
|
||||
CT_DoExecLog ALL make ${jflag} "${make_args[@]}" \
|
||||
lib/crt1.o lib/crti.o lib/crtn.o
|
||||
|
||||
if [ "${CT_SHARED_LIBS}" = "y" ]; then
|
||||
# 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"
|
||||
CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -nostdlib -nostartfiles \
|
||||
-shared ${multi_flags} -x c /dev/null -o libdummy.so
|
||||
|
||||
CT_DoLog EXTRA "Installing start files"
|
||||
CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
|
||||
"${startfiles_dir}"
|
||||
|
||||
CT_DoLog EXTRA "Installing dummy shared libs"
|
||||
CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libc.so"
|
||||
CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libm.so"
|
||||
fi # CT_SHARED_LIBS == y
|
||||
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"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" pregen
|
||||
CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all
|
||||
|
||||
# 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"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" install install_utils
|
||||
fi # libc_mode == final
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" pregen
|
||||
CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all
|
||||
CT_DoLog EXTRA "Installing C library"
|
||||
CT_DoExecLog ALL make "${make_args[@]}" install install_utils
|
||||
|
||||
# Now, if installing headers into a subdirectory, put everything in its place.
|
||||
# Remove the header subdirectory if it existed already.
|
||||
|
Loading…
Reference in New Issue
Block a user