libc/eglibc: move generic code to a common file
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Jan 17 23:04:37 2011 +0100 (2011-01-17)
changeset 2270287e1e00dea4
parent 2269 8a8dd36b1087
child 2271 42ebee266fe5
libc/eglibc: move generic code to a common file

The build procedure for eglibc is generic enough to
be shared between glibc and eglibc. This includes:
- headers install (empty!)
- start files build
- complete libc build
- libc finish (empty!)
- add-ons list

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc-eglibc.sh-common
     1.1 --- a/scripts/build/libc/eglibc.sh	Sat Jan 22 22:32:44 2011 +0100
     1.2 +++ b/scripts/build/libc/eglibc.sh	Mon Jan 17 23:04:37 2011 +0100
     1.3 @@ -1,5 +1,13 @@
     1.4  # eglibc build functions (initially by Thomas JOURDAN).
     1.5  
     1.6 +# Add the definitions common to glibc and eglibc
     1.7 +#   do_libc_headers
     1.8 +#   do_libc_start_files
     1.9 +#   do_libc
    1.10 +#   do_libc_finish
    1.11 +#   do_libc_add_ons_list
    1.12 +. "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
    1.13 +
    1.14  # Download eglibc repository
    1.15  do_eglibc_get() {
    1.16      CT_HasOrAbort svn
    1.17 @@ -167,218 +175,3 @@
    1.18  
    1.19      CT_EndStep
    1.20  }
    1.21 -
    1.22 -# This function installs the eglibc headers needed to build the core compiler
    1.23 -do_libc_headers() {
    1.24 -    # Instead of doing two time the same actions, headers will
    1.25 -    # be installed with start files
    1.26 -    :
    1.27 -}
    1.28 -
    1.29 -# Build and install start files
    1.30 -do_libc_start_files() {
    1.31 -    CT_DoStep INFO "Installing C library headers / start files"
    1.32 -
    1.33 -    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
    1.34 -    cd "${CT_BUILD_DIR}/build-libc-startfiles"
    1.35 -
    1.36 -    CT_DoLog EXTRA "Configuring C library"
    1.37 -
    1.38 -    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
    1.39 -        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
    1.40 -    fi
    1.41 -
    1.42 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
    1.43 -    cross_cxx=$(CT_Which "${CT_TARGET}-g++")
    1.44 -    cross_ar=$(CT_Which "${CT_TARGET}-ar")
    1.45 -    cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
    1.46 -    
    1.47 -    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
    1.48 -    CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
    1.49 -    CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
    1.50 -    CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
    1.51 -
    1.52 -    BUILD_CC="${CT_BUILD}-gcc"                          \
    1.53 -    CC=${cross_cc}                                      \
    1.54 -    CXX=${cross_cxx}                                    \
    1.55 -    AR=${cross_ar}                                      \
    1.56 -    RANLIB=${cross_ranlib}                              \
    1.57 -    CT_DoExecLog CFG                                    \
    1.58 -    "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
    1.59 -        --prefix=/usr                                   \
    1.60 -        --with-headers="${CT_HEADERS_DIR}"              \
    1.61 -        --build="${CT_BUILD}"                           \
    1.62 -        --host="${CT_TARGET}"                           \
    1.63 -        --disable-profile                               \
    1.64 -        --without-gd                                    \
    1.65 -        --without-cvs                                   \
    1.66 -        --enable-add-ons
    1.67 -
    1.68 -    CT_DoLog EXTRA "Installing C library headers"
    1.69 -
    1.70 -    # use the 'install-headers' makefile target to install the
    1.71 -    # headers
    1.72 -
    1.73 -    CT_DoExecLog ALL                    \
    1.74 -    make install-headers                \
    1.75 -         install_root=${CT_SYSROOT_DIR} \
    1.76 -         install-bootstrap-headers=yes
    1.77 -
    1.78 -    CT_DoLog EXTRA "Installing C library start files"
    1.79 -
    1.80 -    # there are a few object files needed to link shared libraries,
    1.81 -    # which we build and install by hand
    1.82 -
    1.83 -    CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
    1.84 -    CT_DoExecLog ALL make csu/subdir_lib
    1.85 -    CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
    1.86 -        ${CT_SYSROOT_DIR}/usr/lib
    1.87 -
    1.88 -    # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.  
    1.89 -    # However, since we will never actually execute its code, 
    1.90 -    # it doesn't matter what it contains.  So, treating '/dev/null' 
    1.91 -    # as a C source file, we produce a dummy 'libc.so' in one step
    1.92 -
    1.93 -    CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
    1.94 -
    1.95 -    CT_EndStep
    1.96 -}
    1.97 -
    1.98 -# This function builds and install the full glibc
    1.99 -do_libc() {
   1.100 -    local -a extra_config
   1.101 -
   1.102 -    CT_DoStep INFO "Installing C library"
   1.103 -
   1.104 -    mkdir -p "${CT_BUILD_DIR}/build-libc"
   1.105 -    cd "${CT_BUILD_DIR}/build-libc"
   1.106 -
   1.107 -    CT_DoLog EXTRA "Configuring C library"
   1.108 -
   1.109 -    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
   1.110 -        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
   1.111 -    fi
   1.112 -
   1.113 -    if [ "${CT_EGLIBC_OPT_SIZE}" = "y" ]; then
   1.114 -        OPTIMIZE=-Os
   1.115 -    else
   1.116 -        OPTIMIZE=-O2
   1.117 -    fi
   1.118 -
   1.119 -    # Add some default glibc config options if not given by user.
   1.120 -    # We don't need to be conditional on wether the user did set different
   1.121 -    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
   1.122 -
   1.123 -    extra_config+=("--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')")
   1.124 -
   1.125 -    case "${CT_THREADS}" in
   1.126 -        nptl)           extra_config+=("--with-__thread" "--with-tls");;
   1.127 -        linuxthreads)   extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
   1.128 -        none)           extra_config+=("--without-__thread" "--without-nptl")
   1.129 -                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
   1.130 -                            *-tls*) ;;
   1.131 -                            *) extra_config+=("--without-tls");;
   1.132 -                        esac
   1.133 -                        ;;
   1.134 -    esac
   1.135 -
   1.136 -    case "${CT_SHARED_LIBS}" in
   1.137 -        y) extra_config+=("--enable-shared");;
   1.138 -        *) extra_config+=("--disable-shared");;
   1.139 -    esac
   1.140 -
   1.141 -    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
   1.142 -        y,) extra_config+=("--with-fp");;
   1.143 -        ,y) extra_config+=("--without-fp");;
   1.144 -    esac
   1.145 -
   1.146 -    if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then
   1.147 -        extra_config+=("--disable-versioning")
   1.148 -    fi
   1.149 -
   1.150 -    if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then
   1.151 -        extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}")
   1.152 -    fi
   1.153 -
   1.154 -    case "$(do_libc_add_ons_list ,)" in
   1.155 -        "") ;;
   1.156 -        *)  extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
   1.157 -    esac
   1.158 -
   1.159 -    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
   1.160 -
   1.161 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")    
   1.162 -
   1.163 -    CT_DoLog DEBUG "Using gcc for target:     '${cross_cc}'"
   1.164 -    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
   1.165 -    CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
   1.166 -    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
   1.167 -
   1.168 -    # ./configure is mislead by our tools override wrapper for bash
   1.169 -    # so just tell it where the real bash is _on_the_target_!
   1.170 -    # Notes:
   1.171 -    # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
   1.172 -    # - ${BASH_SHELL}            is only used to set BASH
   1.173 -    # - ${BASH}                  is only used to set the shebang
   1.174 -    #                            in two scripts to run on the target
   1.175 -    # So we can safely bypass bash detection at compile time.
   1.176 -    # Should this change in a future eglibc release, we'd better
   1.177 -    # directly mangle the generated scripts _after_ they get built,
   1.178 -    # or even after they get installed... eglibc is such a sucker...
   1.179 -    echo "ac_cv_path_BASH_SHELL=/bin/bash" >config.cache
   1.180 -
   1.181 -    BUILD_CC="${CT_BUILD}-gcc"                                      \
   1.182 -    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} ${OPTIMIZE}"  \
   1.183 -    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
   1.184 -    AR=${CT_TARGET}-ar                                              \
   1.185 -    RANLIB=${CT_TARGET}-ranlib                                      \
   1.186 -    CT_DoExecLog CFG                                                \
   1.187 -    "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure"             \
   1.188 -        --prefix=/usr                                               \
   1.189 -        --with-headers="${CT_HEADERS_DIR}"                          \
   1.190 -        --build=${CT_BUILD}                                         \
   1.191 -        --host=${CT_TARGET}                                         \
   1.192 -        --disable-profile                                           \
   1.193 -        --without-gd                                                \
   1.194 -        --without-cvs                                               \
   1.195 -        --cache-file=config.cache                                   \
   1.196 -        "${extra_config[@]}"                                        \
   1.197 -        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
   1.198 -    
   1.199 -    CT_DoLog EXTRA "Building C library"
   1.200 -
   1.201 -    # eglibc build hacks
   1.202 -    # http://sourceware.org/ml/crossgcc/2008-10/msg00068.html
   1.203 -    case "${CT_ARCH},${CT_ARCH_CPU}" in
   1.204 -        powerpc,8??)
   1.205 -            CT_DoLog DEBUG "Activating support for memset on broken ppc-8xx (CPU15 erratum)"
   1.206 -            EGLIBC_BUILD_ASFLAGS="-DBROKEN_PPC_8xx_CPU15";;
   1.207 -    esac
   1.208 -
   1.209 -    CT_DoExecLog ALL make ASFLAGS="${EGLIBC_BUILD_ASFLAGS}"
   1.210 -
   1.211 -    CT_DoLog EXTRA "Installing C library"
   1.212 -
   1.213 -    CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
   1.214 -
   1.215 -    CT_EndStep
   1.216 -}
   1.217 -
   1.218 -# This function finishes the glibc install
   1.219 -do_libc_finish() {
   1.220 -    # Nothing to be done for eglibc
   1.221 -    :
   1.222 -}
   1.223 -
   1.224 -# Build up the addons list, separated with $1
   1.225 -do_libc_add_ons_list() {
   1.226 -    local sep="$1"
   1.227 -    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
   1.228 -    case "${CT_THREADS}" in
   1.229 -        none)   ;;
   1.230 -        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
   1.231 -    esac
   1.232 -    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
   1.233 -    addons_list="${addons_list%%${sep}}"
   1.234 -    echo "${addons_list##${sep}}"
   1.235 -}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Mon Jan 17 23:04:37 2011 +0100
     2.3 @@ -0,0 +1,215 @@
     2.4 +# This file contains the functions common to glibc and eglibc
     2.5 +
     2.6 +# Build and install headers file
     2.7 +# This is a no-op
     2.8 +do_libc_headers() {
     2.9 +    :
    2.10 +}
    2.11 +
    2.12 +# Build and install headers and start files
    2.13 +do_libc_start_files() {
    2.14 +    CT_DoStep INFO "Installing C library headers / start files"
    2.15 +
    2.16 +    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
    2.17 +    cd "${CT_BUILD_DIR}/build-libc-startfiles"
    2.18 +
    2.19 +    CT_DoLog EXTRA "Configuring C library"
    2.20 +
    2.21 +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
    2.22 +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
    2.23 +    fi
    2.24 +
    2.25 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
    2.26 +    cross_cxx=$(CT_Which "${CT_TARGET}-g++")
    2.27 +    cross_ar=$(CT_Which "${CT_TARGET}-ar")
    2.28 +    cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
    2.29 +    
    2.30 +    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
    2.31 +    CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
    2.32 +    CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
    2.33 +    CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
    2.34 +
    2.35 +    BUILD_CC="${CT_BUILD}-gcc"                          \
    2.36 +    CC=${cross_cc}                                      \
    2.37 +    CXX=${cross_cxx}                                    \
    2.38 +    AR=${cross_ar}                                      \
    2.39 +    RANLIB=${cross_ranlib}                              \
    2.40 +    CT_DoExecLog CFG                                    \
    2.41 +    "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
    2.42 +        --prefix=/usr                                   \
    2.43 +        --with-headers="${CT_HEADERS_DIR}"              \
    2.44 +        --build="${CT_BUILD}"                           \
    2.45 +        --host="${CT_TARGET}"                           \
    2.46 +        --disable-profile                               \
    2.47 +        --without-gd                                    \
    2.48 +        --without-cvs                                   \
    2.49 +        --enable-add-ons
    2.50 +
    2.51 +    CT_DoLog EXTRA "Installing C library headers"
    2.52 +
    2.53 +    # use the 'install-headers' makefile target to install the
    2.54 +    # headers
    2.55 +
    2.56 +    CT_DoExecLog ALL                    \
    2.57 +    make install-headers                \
    2.58 +         install_root=${CT_SYSROOT_DIR} \
    2.59 +         install-bootstrap-headers=yes
    2.60 +
    2.61 +    CT_DoLog EXTRA "Installing C library start files"
    2.62 +
    2.63 +    # there are a few object files needed to link shared libraries,
    2.64 +    # which we build and install by hand
    2.65 +
    2.66 +    CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
    2.67 +    CT_DoExecLog ALL make csu/subdir_lib
    2.68 +    CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
    2.69 +        ${CT_SYSROOT_DIR}/usr/lib
    2.70 +
    2.71 +    # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.  
    2.72 +    # However, since we will never actually execute its code, 
    2.73 +    # it doesn't matter what it contains.  So, treating '/dev/null' 
    2.74 +    # as a C source file, we produce a dummy 'libc.so' in one step
    2.75 +
    2.76 +    CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
    2.77 +
    2.78 +    CT_EndStep
    2.79 +}
    2.80 +
    2.81 +# This function builds and install the full C library
    2.82 +do_libc() {
    2.83 +    local -a extra_config
    2.84 +
    2.85 +    CT_DoStep INFO "Installing C library"
    2.86 +
    2.87 +    mkdir -p "${CT_BUILD_DIR}/build-libc"
    2.88 +    cd "${CT_BUILD_DIR}/build-libc"
    2.89 +
    2.90 +    CT_DoLog EXTRA "Configuring C library"
    2.91 +
    2.92 +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
    2.93 +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
    2.94 +    fi
    2.95 +
    2.96 +    if [ "${CT_EGLIBC_OPT_SIZE}" = "y" ]; then
    2.97 +        OPTIMIZE=-Os
    2.98 +    else
    2.99 +        OPTIMIZE=-O2
   2.100 +    fi
   2.101 +
   2.102 +    # Add some default glibc config options if not given by user.
   2.103 +    # We don't need to be conditional on wether the user did set different
   2.104 +    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
   2.105 +
   2.106 +    extra_config+=("--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')")
   2.107 +
   2.108 +    case "${CT_THREADS}" in
   2.109 +        nptl)           extra_config+=("--with-__thread" "--with-tls");;
   2.110 +        linuxthreads)   extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
   2.111 +        none)           extra_config+=("--without-__thread" "--without-nptl")
   2.112 +                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
   2.113 +                            *-tls*) ;;
   2.114 +                            *) extra_config+=("--without-tls");;
   2.115 +                        esac
   2.116 +                        ;;
   2.117 +    esac
   2.118 +
   2.119 +    case "${CT_SHARED_LIBS}" in
   2.120 +        y) extra_config+=("--enable-shared");;
   2.121 +        *) extra_config+=("--disable-shared");;
   2.122 +    esac
   2.123 +
   2.124 +    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
   2.125 +        y,) extra_config+=("--with-fp");;
   2.126 +        ,y) extra_config+=("--without-fp");;
   2.127 +    esac
   2.128 +
   2.129 +    if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then
   2.130 +        extra_config+=("--disable-versioning")
   2.131 +    fi
   2.132 +
   2.133 +    if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then
   2.134 +        extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}")
   2.135 +    fi
   2.136 +
   2.137 +    case "$(do_libc_add_ons_list ,)" in
   2.138 +        "") ;;
   2.139 +        *)  extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
   2.140 +    esac
   2.141 +
   2.142 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
   2.143 +
   2.144 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")    
   2.145 +
   2.146 +    CT_DoLog DEBUG "Using gcc for target:     '${cross_cc}'"
   2.147 +    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
   2.148 +    CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
   2.149 +    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
   2.150 +
   2.151 +    # ./configure is mislead by our tools override wrapper for bash
   2.152 +    # so just tell it where the real bash is _on_the_target_!
   2.153 +    # Notes:
   2.154 +    # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
   2.155 +    # - ${BASH_SHELL}            is only used to set BASH
   2.156 +    # - ${BASH}                  is only used to set the shebang
   2.157 +    #                            in two scripts to run on the target
   2.158 +    # So we can safely bypass bash detection at compile time.
   2.159 +    # Should this change in a future eglibc release, we'd better
   2.160 +    # directly mangle the generated scripts _after_ they get built,
   2.161 +    # or even after they get installed... eglibc is such a sucker...
   2.162 +    echo "ac_cv_path_BASH_SHELL=/bin/bash" >config.cache
   2.163 +
   2.164 +    BUILD_CC="${CT_BUILD}-gcc"                                      \
   2.165 +    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} ${OPTIMIZE}"  \
   2.166 +    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
   2.167 +    AR=${CT_TARGET}-ar                                              \
   2.168 +    RANLIB=${CT_TARGET}-ranlib                                      \
   2.169 +    CT_DoExecLog CFG                                                \
   2.170 +    "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure"             \
   2.171 +        --prefix=/usr                                               \
   2.172 +        --with-headers="${CT_HEADERS_DIR}"                          \
   2.173 +        --build=${CT_BUILD}                                         \
   2.174 +        --host=${CT_TARGET}                                         \
   2.175 +        --disable-profile                                           \
   2.176 +        --without-gd                                                \
   2.177 +        --without-cvs                                               \
   2.178 +        --cache-file=config.cache                                   \
   2.179 +        "${extra_config[@]}"                                        \
   2.180 +        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
   2.181 +    
   2.182 +    CT_DoLog EXTRA "Building C library"
   2.183 +
   2.184 +    # eglibc build hacks
   2.185 +    # http://sourceware.org/ml/crossgcc/2008-10/msg00068.html
   2.186 +    case "${CT_ARCH},${CT_ARCH_CPU}" in
   2.187 +        powerpc,8??)
   2.188 +            CT_DoLog DEBUG "Activating support for memset on broken ppc-8xx (CPU15 erratum)"
   2.189 +            EGLIBC_BUILD_ASFLAGS="-DBROKEN_PPC_8xx_CPU15";;
   2.190 +    esac
   2.191 +
   2.192 +    CT_DoExecLog ALL make ASFLAGS="${EGLIBC_BUILD_ASFLAGS}"
   2.193 +
   2.194 +    CT_DoLog EXTRA "Installing C library"
   2.195 +
   2.196 +    CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
   2.197 +
   2.198 +    CT_EndStep
   2.199 +}
   2.200 +
   2.201 +# This function finishes the C library install
   2.202 +# This is a no-op
   2.203 +do_libc_finish() {
   2.204 +    :
   2.205 +}
   2.206 +
   2.207 +# Build up the addons list, separated with $1
   2.208 +do_libc_add_ons_list() {
   2.209 +    local sep="$1"
   2.210 +    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
   2.211 +    case "${CT_THREADS}" in
   2.212 +        none)   ;;
   2.213 +        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
   2.214 +    esac
   2.215 +    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
   2.216 +    addons_list="${addons_list%%${sep}}"
   2.217 +    echo "${addons_list##${sep}}"
   2.218 +}