summaryrefslogtreecommitdiff
path: root/scripts/build/libc/glibc.sh
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-05-30 05:32:38 (GMT)
committerAlexey Neyman <stilor@att.net>2017-07-08 17:57:56 (GMT)
commit567277099a487508fd228a4c56f3583db3fa96c9 (patch)
tree19b7f40c0f6e4e6284e799dbac1098bd8805dc2d /scripts/build/libc/glibc.sh
parent57426168ad2c7e8367786ed466c86f6aeb49b3c3 (diff)
Fix the references to old config variables
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/build/libc/glibc.sh')
-rw-r--r--scripts/build/libc/glibc.sh127
1 files changed, 24 insertions, 103 deletions
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index e8f0445..5862759 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -7,102 +7,22 @@ do_libc_get() {
local version
local -a addons_list
- addons_list=($(do_libc_add_ons_list " "))
-
- # Main source
- if [ "${CT_GLIBC_CUSTOM}" = "y" ]; then
- CT_GetCustom "glibc" "${CT_GLIBC_CUSTOM_VERSION}" \
- "${CT_GLIBC_CUSTOM_LOCATION}"
- else
- case "${CT_LIBC_VERSION}" in
- linaro-*)
- CT_GetLinaro "glibc" "${CT_LIBC_VERSION}"
- ;;
- *)
- CT_GetFile "glibc-${CT_LIBC_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/glibc \
- ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
- ;;
- esac
+ CT_Fetch GLIBC
+ if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then
+ CT_Fetch GLIBC_PORTS
fi
-
- # C library addons
- for addon in "${addons_list[@]}"; do
- # Never ever try to download these add-ons,
- # they've always been internal
- case "${addon}" in
- nptl) continue;;
- esac
-
- case "${addon}:${CT_GLIBC_PORTS_EXTERNAL}" in
- ports:y) ;;
- ports:*) continue;;
- esac
-
- if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
- http://mirrors.kernel.org/sourceware/glibc \
- {http,ftp,https}://ftp.gnu.org/gnu/glibc \
- ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
- then
- # Some add-ons are bundled with glibc, others are
- # bundled in their own tarball. Eg. NPTL is internal,
- # while LinuxThreads was external. Also, for old
- # versions of glibc, the libidn add-on was external,
- # but with version >=2.10, it is internal.
- CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
- CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
- fi
- done
-
return 0
}
do_libc_extract() {
local addon
- CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
- CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
- # Custom glibc won't get patched, because CT_GetCustom
- # marks custom glibc as patched.
- CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
-
- for addon in $(do_libc_add_ons_list " "); do
- # If the addon was bundled with the main archive, we do not
- # need to extract it. Worse, if we were to try to extract
- # it, we'd get an error.
- if [ -d "${addon}" ]; then
- CT_DoLog DEBUG "Add-on '${addon}' already present, skipping extraction"
- continue
- fi
-
- CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
- -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- # Some addons have the 'long' name, while others have the
- # 'short' name, but patches are non-uniformly built with
- # either the 'long' or 'short' name, whatever the addons name
- # but we prefer the 'short' name and avoid duplicates.
- if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then
- CT_DoExecLog FILE mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}"
- fi
-
- CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}"
-
- # Remove the long name since it can confuse configure scripts to run
- # the same source twice.
- rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
- done
-
- # The configure files may be older than the configure.in files
- # if using a snapshot (or even some tarballs). Fake them being
- # up to date.
- find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
-
- CT_Popd
+ CT_ExtrachPatch GLIBC
+ if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then
+ CT_Fetch GLIBC_PORTS
+ fi
+ # TBD make patches for addons (ports? anything else?) uniformly using short names
+ # TBD make the configure timestamp fix in all patched packages (e.g. part of CT_ExtractPatch)
}
# Build and install headers and start files
@@ -161,7 +81,7 @@ do_libc_backend_once() {
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}/${CT_LIBC}-${CT_LIBC_VERSION}"
+ local src_dir="${CT_SRC_DIR}/glibc"
local -a extra_config
local -a extra_make_args
local glibc_cflags
@@ -390,7 +310,7 @@ do_libc_backend_once() {
# 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-${CT_LIBC_VERSION}/include/features.h" \
+ CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \
"${CT_HEADERS_DIR}/features.h"
# Building the bootstrap gcc requires either setting inhibit_libc, or
@@ -486,18 +406,18 @@ do_libc_backend_once() {
# Build up the addons list, separated with $1
do_libc_add_ons_list() {
local sep="$1"
- local addons_list="$( echo "${CT_GLIBC_ADDONS_LIST}" \
- |sed -r -e "s/[[:space:],]/${sep}/g;" \
- )"
- if [ "${GLIBC_HAS_NPTL_ADDON}" = "y" ]; then
- case "${CT_THREADS}" in
- none) ;;
- *) addons_list="${addons_list}${sep}${CT_THREADS}";;
- esac
+ local addons_list
+
+ if [ "${CT_GLIBC_USE_PORTS_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}ports"
+ fi
+ if [ "${CT_GLIBC_USE_NPTL_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}nptl"
+ fi
+ if [ "${CT_GLIBC_USE_LIBIDN_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}libidn"
fi
- [ "${CT_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
- # Remove duplicate, leading and trailing separators
- echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
+ echo "${addons_list#${sep}}" # Remove leading separator if any
}
# Compute up the minimum supported Linux kernel version
@@ -507,6 +427,7 @@ do_libc_min_kernel_config() {
case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in
*--enable-kernel*) ;;
*) if [ "${CT_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
+ # TBD do we support that currently? We always seem to install kernel headers
# We can't rely on the kernel version from the configuration,
# because it might not be available if the user uses pre-installed
# headers. On the other hand, both method will have the kernel
@@ -536,7 +457,7 @@ do_libc_min_kernel_config() {
# Build and install the libc locales
do_libc_locales() {
- local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
+ local src_dir="${CT_SRC_DIR}/glibc"
local -a extra_config
local glibc_cflags