Skip to content

Commit

Permalink
Merge pull request #353 from bhundven/glibc_cleanup
Browse files Browse the repository at this point in the history
Glibc cleanup
  • Loading branch information
bhundven committed Feb 26, 2016
2 parents 4d7e6fb + ec9af46 commit 6430ff5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 197 deletions.
88 changes: 2 additions & 86 deletions config/libc/glibc.in
Expand Up @@ -100,90 +100,19 @@ config LIBC_GLIBC_V_2_20
config LIBC_GLIBC_V_2_19
bool
prompt "2.19"
select LIBC_GLIBC_2_17_or_later

config LIBC_GLIBC_V_2_18
bool
prompt "2.18"
select LIBC_GLIBC_2_17_or_later

config LIBC_GLIBC_V_2_17
bool
prompt "2.17"
select LIBC_GLIBC_2_17_or_later

config LIBC_GLIBC_V_2_16_0
bool
prompt "2.16.0"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_15
bool
prompt "2.15"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_14_1
bool
prompt "2.14.1"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_14
bool
prompt "2.14"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_13
bool
prompt "2.13"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_12_2
bool
prompt "2.12.2"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_12_1
bool
prompt "2.12.1"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_11_1
bool
prompt "2.11.1"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_11
bool
prompt "2.11"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_10_1
bool
prompt "2.10.1"
select LIBC_GLIBC_PORTS_EXTERNAL
select LIBC_GLIBC_USE_PORTS

config LIBC_GLIBC_V_2_9
bool
prompt "2.9"
select LIBC_GLIBC_PORTS_EXTERNAL

config LIBC_GLIBC_V_2_8
bool
prompt "2.8"
select LIBC_GLIBC_PORTS_EXTERNAL

endchoice

endif # ! LIBC_GLIBC_CUSTOM

# DeMark 2.20 as no longer needs to set NPTL as an addon.
# It is no longer possible to build glibc without pthread!
config LIBC_GLIBC_2_20_or_later
bool
select LIBC_GLIBC_2_17_or_later

# DeMark no more ports
config LIBC_GLIBC_2_17_or_later
bool

if ! LIBC_GLIBC_CUSTOM

Expand All @@ -198,18 +127,5 @@ config LIBC_VERSION
default "2.20" if LIBC_GLIBC_V_2_20
default "2.19" if LIBC_GLIBC_V_2_19
default "2.18" if LIBC_GLIBC_V_2_18
default "2.17" if LIBC_GLIBC_V_2_17
default "2.16.0" if LIBC_GLIBC_V_2_16_0
default "2.15" if LIBC_GLIBC_V_2_15
default "2.14.1" if LIBC_GLIBC_V_2_14_1
default "2.14" if LIBC_GLIBC_V_2_14
default "2.13" if LIBC_GLIBC_V_2_13
default "2.12.2" if LIBC_GLIBC_V_2_12_2
default "2.12.1" if LIBC_GLIBC_V_2_12_1
default "2.11.1" if LIBC_GLIBC_V_2_11_1
default "2.11" if LIBC_GLIBC_V_2_11
default "2.10.1" if LIBC_GLIBC_V_2_10_1
default "2.9" if LIBC_GLIBC_V_2_9
default "2.8" if LIBC_GLIBC_V_2_8

endif # ! LIBC_GLIBC_CUSTOM
144 changes: 33 additions & 111 deletions scripts/build/libc/glibc.sh
Expand Up @@ -2,59 +2,47 @@
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package

# Extract the C library tarball(s)
do_libc_extract() {
local addon
do_libc_get() {
local date
local version

# Main source
if [ "${CT_LIBC_GLIBC_CUSTOM}" = "y" ]; then
CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
else
if echo ${CT_LIBC_VERSION} |${grep} -q linaro; then
# Linaro glibc releases come from regular downloads...
YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'`
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
https://releases.linaro.org/${YYMM}/components/toolchain/glibc-linaro \
http://cbuild.validation.linaro.org/snapshots
else
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
{http,ftp,https}://ftp.gnu.org/gnu/glibc \
ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
fi
fi

return 0
}

do_libc_extract() {
CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
# Attempt CT_PATCH only if NOT custom
CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"

# Extract the add-opns if => 2.17
if [ "${CT_LIBC_GLIBC_2_17_or_later}" != "y" ]; then
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
fi

# 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
}

if [ "${CT_LIBC_LOCALES}" = "y" ]; then
do_libc_locales_extract
fi
do_libc_check_config() {
:
}

# Build and install headers and start files
Expand All @@ -69,6 +57,10 @@ do_libc() {
do_libc_backend libc_mode=final
}

do_libc_post_cc() {
:
}

# This backend builds the C library once for each multilib
# variant the compiler gives us
# Usage: do_libc_backend param=value [...]
Expand Down Expand Up @@ -539,74 +531,6 @@ do_libc_min_kernel_config() {
esac
}

# Download glibc
do_libc_get() {
local date
local version
local -a addons_list

addons_list=($(do_libc_add_ons_list " "))

# Main source
if [ "${CT_LIBC_GLIBC_CUSTOM}" = "y" ]; then
CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
else
if echo ${CT_LIBC_VERSION} |${grep} -q linaro; then
# Linaro glibc releases come from regular downloads...
YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'`
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
https://releases.linaro.org/${YYMM}/components/toolchain/glibc-linaro \
http://cbuild.validation.linaro.org/snapshots
else
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
{http,ftp,https}://ftp.gnu.org/gnu/glibc \
ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
fi
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_LIBC_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
}

# There is nothing to do for glibc check config
do_libc_check_config() {
:
}

# Extract the files required for the libc locales
# Nothing to do
do_libc_locales_extract() {
:
}

# Build and install the libc locales
do_libc_locales() {
local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
Expand Down Expand Up @@ -660,6 +584,7 @@ do_libc_locales() {
--disable-profile \
--without-gd \
--disable-debug \
--disable-sanity-checks \
"${extra_config[@]}"

CT_DoLog EXTRA "Building C library localedef"
Expand All @@ -676,6 +601,3 @@ do_libc_locales() {
localedata/install-locales
}

do_libc_post_cc() {
:
}

0 comments on commit 6430ff5

Please sign in to comment.