crosstool-ng/scripts/build/libc.sh
Alexey Neyman 93be629f2b Fold libc_start_files into libc
After 557b9d4, 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 after 557b9d4, the headers are not installed before libgcc is built
in pass-1.

Therefore, finish what 557b9d4 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>
2022-02-11 00:47:51 -08:00

40 lines
1.0 KiB
Bash

# C library build routines. We don't invoke the corresponding functions directly
# because some of them build on top of another. E.g. moxiebox runtime requires
# newlib as a prerequisite.
# Define default hooks - download/unpack just the main package; no-op build hooks.
# 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 headers main post_cc; do
eval "${CT_LIBC//[^A-Za-z0-9]/_}_${_m}() { :; }"
done
# Source the selected libc.
. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
do_libc_get()
{
eval "${CT_LIBC//[^A-Za-z0-9]/_}_get"
}
do_libc_extract()
{
eval "${CT_LIBC//[^A-Za-z0-9]/_}_extract"
}
do_libc_headers()
{
eval "${CT_LIBC//[^A-Za-z0-9]/_}_headers"
}
do_libc_main()
{
eval "${CT_LIBC//[^A-Za-z0-9]/_}_main"
}
do_libc_post_cc()
{
eval "${CT_LIBC//[^A-Za-z0-9]/_}_post_cc"
}