scripts/build/libc_glibc.sh
changeset 78 c3868084d81a
parent 73 b8924cbdca26
child 136 22b5ef41df97
     1.1 --- a/scripts/build/libc_glibc.sh	Tue May 08 10:52:39 2007 +0000
     1.2 +++ b/scripts/build/libc_glibc.sh	Tue May 08 17:48:32 2007 +0000
     1.3 @@ -10,7 +10,7 @@
     1.4      CT_GetFile "${CT_LIBC_FILE}" ftp://ftp.gnu.org/gnu/glibc
     1.5  
     1.6      # C library addons
     1.7 -    addons_list=`echo "${CT_LIBC_ADDONS}" |sed -r -e 's/,/ /g; s/ $//g;'`
     1.8 +    addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'`
     1.9      for addon in ${addons_list}; do
    1.10          CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc
    1.11      done
    1.12 @@ -24,7 +24,7 @@
    1.13      CT_ExtractAndPatch "${CT_LIBC_FILE}"
    1.14  
    1.15      # C library addons
    1.16 -    addons_list=`echo "${CT_LIBC_ADDONS}" |sed -r -e 's/,/ /g; s/ $//g;'`
    1.17 +    addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'`
    1.18      for addon in ${addons_list}; do
    1.19          CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    1.20      done
    1.21 @@ -66,6 +66,11 @@
    1.22      # is ok here, since all we want are the basic headers at this point.
    1.23      # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
    1.24      # 'a version of binutils that supports .machine "altivec" is needed'.
    1.25 +
    1.26 +    # We also need to use the ports addon if specified
    1.27 +    addons=
    1.28 +    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons="${CT_LIBC}-ports-${CT_LIBC_VERSION}"
    1.29 +
    1.30      libc_cv_ppc_machine=yes                     \
    1.31      CC=${CT_CC_NATIVE}                          \
    1.32      "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"   \
    1.33 @@ -76,8 +81,8 @@
    1.34          --without-cvs                           \
    1.35          --disable-sanity-checks                 \
    1.36          --enable-hacker-mode                    \
    1.37 -        --enable-add-ons=""                     \
    1.38 -        --without-nptl                          2>&1 |CT_DoLog DEBUG
    1.39 +        --enable-add-ons="${addons}"            \
    1.40 +        --without-nptl                          2>&1 |CT_DoLog ALL
    1.41  
    1.42      CT_DoLog EXTRA "Installing C library headers"
    1.43  
    1.44 @@ -93,9 +98,11 @@
    1.45          # errlist-compat.c.
    1.46          # Note: BOOTSTRAP_GCC is used by:
    1.47          # patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
    1.48 -        libc_cv_ppc_machine=yes                             \
    1.49 -        make CFLAGS=-DBOOTSTRAP_GCC sysdeps/gnu/errlist.c   2>&1 |CT_DoLog DEBUG
    1.50 +
    1.51 +        libc_cv_ppc_machine=yes                                 \
    1.52 +        make CFLAGS="-O -DBOOTSTRAP_GCC" sysdeps/gnu/errlist.c  2>&1 |CT_DoLog ALL
    1.53          mkdir -p stdio-common
    1.54 +
    1.55          # sleep for 2 seconds for benefit of filesystems with lousy time
    1.56          # resolution, like FAT, so make knows for sure errlist-compat.c doesn't
    1.57          # need generating
    1.58 @@ -105,8 +112,8 @@
    1.59      # Note: BOOTSTRAP_GCC (see above)
    1.60      libc_cv_ppc_machine=yes                                 \
    1.61      make cross-compiling=yes install_root=${CT_SYSROOT_DIR} \
    1.62 -        CFLAGS=-DBOOTSTRAP_GCC ${LIBC_SYSROOT_ARG}          \
    1.63 -        install-headers                                     2>&1 |CT_DoLog DEBUG
    1.64 +         CFLAGS="-O -DBOOTSTRAP_GCC" ${LIBC_SYSROOT_ARG}    \
    1.65 +         install-headers                                    2>&1 |CT_DoLog ALL
    1.66  
    1.67      # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
    1.68      # so do them by hand.  We can tolerate an empty stubs.h for the moment.
    1.69 @@ -142,7 +149,7 @@
    1.70      extra_config=""
    1.71      case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    1.72          *enable-kernel*) ;;
    1.73 -        *) extra_config="${extra_config} --enable-kernel=${CT_KERNEL_VERSION}"
    1.74 +        *) extra_config="${extra_config} --enable-kernel=`echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;'`"
    1.75      esac
    1.76      case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    1.77          *-tls*) ;;
    1.78 @@ -164,13 +171,14 @@
    1.79                  ,y) extra_config="${extra_config} --without-fp";;
    1.80              esac;;
    1.81      esac
    1.82 -    case "${CT_LIBC_ADDONS},${CT_LIBC_ADDONS_LIST}" in
    1.83 -        y,) extra_config="${extra_config} --enable-add-ons";;
    1.84 -        y,*) extra_config="${extra_config} --enable-add-ons=${CT_LIBC_ADDONS_LIST}";;
    1.85 +
    1.86 +    case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in
    1.87 +        y,y)    addons_config="--enable-add-ons=${CT_LIBC_ADDONS_LIST},${CT_LIBC}-ports-${CT_LIBC_VERSION}";;
    1.88 +        y,)     addons_config="--enable-add-ons=${CT_LIBC_ADDONS_LIST}";;
    1.89 +        ,y)     addons_config="--enable-add-ons=${CT_LIBC}-ports-${CT_LIBC_VERSION}";;
    1.90 +        *)      addons_config="";;
    1.91      esac
    1.92  
    1.93 -    CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
    1.94 -
    1.95      # Add some default CC args
    1.96      extra_cc_args="${CT_CFLAGS_FOR_HOST}"
    1.97      case "${CT_LIBC_EXTRA_CC_ARGS}" in
    1.98 @@ -182,6 +190,8 @@
    1.99              esac;;
   1.100      esac
   1.101  
   1.102 +    CT_DoLog DEBUG "Configuring with addons : \"${addons_config}\""
   1.103 +    CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
   1.104      CT_DoLog DEBUG "Extra CC args passed: \"${extra_cc_args}\""
   1.105  
   1.106      # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
   1.107 @@ -214,13 +224,15 @@
   1.108      "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
   1.109          --prefix=/usr                                               \
   1.110          --build=${CT_BUILD} --host=${CT_TARGET}                     \
   1.111 -        ${CT_LIBC_GLIBC_EXTRA_CONFIG}                               \
   1.112 -        ${extra_config}                                             \
   1.113          --without-cvs                                               \
   1.114 +        --without-nptl                                              \
   1.115          --disable-profile                                           \
   1.116          --disable-debug                                             \
   1.117          --without-gd                                                \
   1.118 -        --with-headers="${CT_HEADERS_DIR}"                          2>&1 |CT_DoLog DEBUG
   1.119 +        --with-headers="${CT_HEADERS_DIR}"                          \
   1.120 +        ${addons_config}                                            \
   1.121 +        ${extra_config}                                             \
   1.122 +        ${CT_LIBC_GLIBC_EXTRA_CONFIG}                               2>&1 |CT_DoLog ALL
   1.123  
   1.124      if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
   1.125          # nptl-era glibc.
   1.126 @@ -248,17 +260,17 @@
   1.127      CT_DoLog EXTRA "Building C library"
   1.128      make LD=${CT_TARGET}-ld             \
   1.129           RANLIB=${CT_TARGET}-ranlib     \
   1.130 -         ${GLIBC_INITIAL_BUILD_RULE}    2>&1 |CT_DoLog DEBUG
   1.131 +         ${GLIBC_INITIAL_BUILD_RULE}    2>&1 |CT_DoLog ALL
   1.132  
   1.133      CT_DoLog EXTRA "Installing C library"
   1.134      make install_root="${CT_SYSROOT_DIR}"   \
   1.135           ${LIBC_SYSROOT_ARG}                \
   1.136 -         ${GLIBC_INITIAL_INSTALL_RULE}      2>&1 |CT_DoLog DEBUG
   1.137 +         ${GLIBC_INITIAL_INSTALL_RULE}      2>&1 |CT_DoLog ALL
   1.138  
   1.139      # This doesn't seem to work when building a crosscompiler,
   1.140      # as it tries to execute localedef using the just-built ld.so!?
   1.141      #CT_DoLog EXTRA "Installing locales"
   1.142 -    #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog DEBUG
   1.143 +    #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
   1.144  
   1.145      # Fix problems in linker scripts.
   1.146      #
   1.147 @@ -276,13 +288,13 @@
   1.148      for file in libc.so libpthread.so libgcc_s.so; do
   1.149          for dir in lib lib64 usr/lib usr/lib64; do
   1.150              if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
   1.151 -                mv "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
   1.152 +                cp "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
   1.153                  CT_DoLog DEBUG "Fixing \"${CT_SYS_ROOT_DIR}/${dir}/${file}\""
   1.154                  sed -i -r -e 's,/usr/lib/,,g;
   1.155                                s,/usr/lib64/,,g;
   1.156                                s,/lib/,,g;
   1.157                                s,/lib64/,,g;
   1.158 -                              /BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
   1.159 +                              /BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
   1.160              fi
   1.161          done
   1.162      done
   1.163 @@ -303,13 +315,15 @@
   1.164      cd "${CT_BUILD_DIR}/build-libc"
   1.165  
   1.166      CT_DoLog EXTRA "Re-building C library"
   1.167 -    make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib 2>&1 |CT_DoLog DEBUG
   1.168 +    make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib 2>&1 |CT_DoLog ALL
   1.169  
   1.170      CT_DoLog EXTRA "Installing missing C library components"
   1.171      # note: should do full install and then fix linker scripts, but this is faster
   1.172      for t in bin rootsbin sbin data others; do
   1.173          make install_root="${CT_SYSROOT_DIR}"   \
   1.174               ${LIBC_SYSROOT_ARG}                \
   1.175 -             install-${t}                       2>&1 |CT_DoLog DEBUG
   1.176 +             install-${t}                       2>&1 |CT_DoLog ALL
   1.177      done
   1.178 +
   1.179 +    CT_EndStep
   1.180  }