Sanitise using glibc cvs exports:
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Mar 15 20:50:40 2009 +0000 (2009-03-15)
changeset 1260777153645ab8
parent 1259 9a567f354599
child 1261 4e1562059404
Sanitise using glibc cvs exports:
- recently, tarballs for glibc 2.8 and 2.9 have appeared on the GNU ftp site
- always use a dot in version strings (eg. 2.9, not 2_9)

/trunk/scripts/build/libc/glibc.sh | 135 76 59 0 +++++++++++++++++++++++++-------------------
/trunk/config/libc/glibc.in | 71 45 26 0 +++++++++++++++--------
2 files changed, 121 insertions(+), 85 deletions(-)
config/libc/glibc.in
scripts/build/libc/glibc.sh
     1.1 --- a/config/libc/glibc.in	Sun Mar 15 20:08:06 2009 +0000
     1.2 +++ b/config/libc/glibc.in	Sun Mar 15 20:50:40 2009 +0000
     1.3 @@ -38,13 +38,11 @@
     1.4  
     1.5  config LIBC_V_2_8
     1.6      bool
     1.7 -    prompt "2_8"
     1.8 -    select LIBC_GLIBC_2_8_or_later
     1.9 +    prompt "2.8"
    1.10  
    1.11  config LIBC_V_2_9
    1.12      bool
    1.13 -    prompt "2_9"
    1.14 -    select LIBC_GLIBC_2_8_or_later
    1.15 +    prompt "2.9"
    1.16  
    1.17  # CT_INSERT_VERSION_ABOVE
    1.18  # Don't remove above line!
    1.19 @@ -72,28 +70,48 @@
    1.20      default "2.6" if LIBC_V_2_6
    1.21      default "2.6.1" if LIBC_V_2_6_1
    1.22      default "2.7" if LIBC_V_2_7
    1.23 -    default "2_8" if LIBC_V_2_8
    1.24 -    default "2_9" if LIBC_V_2_9
    1.25 +    default "2.8" if LIBC_V_2_8
    1.26 +    default "2.9" if LIBC_V_2_9
    1.27  # CT_INSERT_VERSION_STRING_ABOVE
    1.28  # Don't remove above line!
    1.29  
    1.30 -config LIBC_GLIBC_2_8_or_later
    1.31 +choice
    1.32      bool
    1.33 -    default n
    1.34 +    prompt "Retrieval method"
    1.35 +    default LIBC_GLIBC_TARBALL
    1.36  
    1.37 -if LIBC_GLIBC_2_8_or_later
    1.38 +config LIBC_GLIBC_TARBALL
    1.39 +    bool
    1.40 +    prompt "Released tarball"
    1.41 +    help
    1.42 +      Until end of Februrary 2009, there was no tarball for glibc releases
    1.43 +      2.8 and later. This was intentional.
    1.44 +      
    1.45 +      Then, all of a sudden, tarballs for those releases have appeared at the
    1.46 +      traditional download place (ftp.gnu.org).
    1.47 +      
    1.48 +      Some of the glibc people argue that fixes are committed to the maintenance
    1.49 +      branch, and thus it is the best plac e to retrieve the glibc from.
    1.50 +      On the other hand, it might be preferable to always generate a toolchain
    1.51 +      using a known code-base, so the toolchain can be reproducible.
    1.52 +      
    1.53 +      For version prior to 2.8, tarballs were readily available.
    1.54 +      
    1.55 +      If you want your toolchain to really be reproducible, say 'Y' here.
    1.56 +      If you can live with a moving code-base, look at the other choice
    1.57 +      entries, below.
    1.58  
    1.59 -config LIBC_GLIBC_latest_snapshot
    1.60 +config LIBC_GLIBC_CVS
    1.61      bool
    1.62 -    prompt "Use latest nightly snapshot"
    1.63 -    default n
    1.64 +    prompt "CVS checkout"
    1.65      help
    1.66 -      Say 'y' to use the latest nightly snapshot.
    1.67 -      Not recommended, as the toolchain will not be reproducible.
    1.68 +      See the help for the entry "Released tarball", above.
    1.69 +      
    1.70 +      If you can live with a moving code-base, say 'Y' here.
    1.71 +      If you want your toolchain to really be reproducible, look at the
    1.72 +      choice entry "Released tarball from FTP", above.
    1.73  
    1.74 -if ! LIBC_GLIBC_latest_snapshot
    1.75 -
    1.76 -comment "Using CVS checkout"
    1.77 +if LIBC_GLIBC_CVS
    1.78  
    1.79  config LIBC_GLIBC_CVS_date
    1.80      string
    1.81 @@ -102,15 +120,16 @@
    1.82      help
    1.83        The date, in ISO-8601 format, at which to check out the repository.
    1.84  
    1.85 -#config LIBC_GLIBC_CVS_CHECKOUT
    1.86 +endif #  LIBC_GLIBC_CVS
    1.87 +
    1.88 +#config LIBC_GLIBC_SNAPSHOT
    1.89  #    bool
    1.90 -#    prompt "checkout instead of export"
    1.91 -#    default n
    1.92 +#    prompt "Use latest nightly snapshot"
    1.93  #    help
    1.94 -#      Use checkout rather than export, so that you can later update
    1.95 -#      the sources.
    1.96 -#      Not recommended, as the toolchain could be non-reproducible.
    1.97 +#      See the help for the entry "Released tarball", above.
    1.98 +#      
    1.99 +#      If you can live with a moving code-base, say 'Y' here.
   1.100 +#      If you want your toolchain to really be reproducible, look at the
   1.101 +#      choice entry "Released tarball from FTP", above.
   1.102  
   1.103 -endif # ! LIBC_GLIBC_latest_snapshot
   1.104 -
   1.105 -endif # LIBC_GLIBC_2_8_or_later
   1.106 +endchoice
     2.1 --- a/scripts/build/libc/glibc.sh	Sun Mar 15 20:08:06 2009 +0000
     2.2 +++ b/scripts/build/libc/glibc.sh	Sun Mar 15 20:50:40 2009 +0000
     2.3 @@ -4,36 +4,11 @@
     2.4  
     2.5  # Download glibc
     2.6  do_libc_get() {
     2.7 -   local date
     2.8 +    local date
     2.9 +    local version
    2.10  
    2.11 -    # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
    2.12 -    # directory. Good. Alas, there is no snapshot there. I'll deal with them
    2.13 -    # later on... :-/
    2.14 -    # Update: sadly, glibc folks do be stupid: they no longer build
    2.15 -    # release tarballs as of glibc-2.8, hence forcing us to fetch
    2.16 -    # from CVS (CVS! Don't those guys know the world of SCM has
    2.17 -    # evolved since the dawn ages of CVS?) Sigh...
    2.18 -    if [ "${CT_LIBC_GLIBC_2_8_or_later}" = "y" ]; then
    2.19 -        # No release tarball available...
    2.20 -        date="${CT_LIBC_GLIBC_CVS_date}"
    2.21 -        CT_GetCVS "glibc-${CT_LIBC_VERSION}"                            \
    2.22 -                  ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"      \
    2.23 -                  "libc"                                                \
    2.24 -                  "glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}"    \
    2.25 -                  "glibc-${CT_LIBC_VERSION}"
    2.26 -
    2.27 -        # C library addons
    2.28 -        for addon in $(do_libc_add_ons_list " "); do
    2.29 -            # NPTL addon is not to be downloaded, in any case
    2.30 -            [ "${addon}" = "nptl" ] && continue || true
    2.31 -            CT_GetCVS "glibc-${addon}-${CT_LIBC_VERSION}"                   \
    2.32 -                      ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"      \
    2.33 -                      "${addon}"                                            \
    2.34 -                      "glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}"    \
    2.35 -                      "glibc-${addon}-${CT_LIBC_VERSION}"
    2.36 -        done
    2.37 -    else
    2.38 -        # Release tarballs are available
    2.39 +    if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
    2.40 +        # Use release tarballs
    2.41          CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
    2.42                     {ftp,http}://ftp.gnu.org/gnu/glibc       \
    2.43                     ftp://gcc.gnu.org/pub/glibc/releases     \
    2.44 @@ -48,6 +23,29 @@
    2.45                         ftp://gcc.gnu.org/pub/glibc/releases     \
    2.46                         ftp://gcc.gnu.org/pub/glibc/snapshots
    2.47          done
    2.48 +    elif [ "${CT_LIBC_GLIBC_CVS}" = "y" ]; then
    2.49 +        # Use CVS checkout
    2.50 +        version="${CT_LIBC_VERSION//./_}"
    2.51 +        date="${CT_LIBC_GLIBC_CVS_date}"
    2.52 +
    2.53 +        CT_GetCVS "glibc-cvs-${CT_LIBC_VERSION}"                    \
    2.54 +                  ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"  \
    2.55 +                  "libc"                                            \
    2.56 +                  "glibc-${version}-branch${date:+:}${date}"        \
    2.57 +                  "glibc-cvs-${CT_LIBC_VERSION}"
    2.58 +
    2.59 +        # C library addons
    2.60 +        for addon in $(do_libc_add_ons_list " "); do
    2.61 +            # NPTL addon is not to be downloaded, in any case
    2.62 +            [ "${addon}" = "nptl" ] && continue || true
    2.63 +            CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}"           \
    2.64 +                      ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"  \
    2.65 +                      "${addon}"                                        \
    2.66 +                      "glibc-${version}-branch${date:+:}${date}"        \
    2.67 +                      "glibc-${addon}-cvs-${CT_LIBC_VERSION}"
    2.68 +        done
    2.69 +#    elif [ "${CT_LIBC_GLIBC_SNAPSHOT}" = "y" ]; then
    2.70 +#        : # Not yet handled...
    2.71      fi
    2.72  
    2.73      return 0
    2.74 @@ -55,31 +53,38 @@
    2.75  
    2.76  # Extract glibc
    2.77  do_libc_extract() {
    2.78 -    CT_Extract "glibc-${CT_LIBC_VERSION}"
    2.79 -    CT_Patch "glibc-${CT_LIBC_VERSION}"
    2.80 +    local cvs
    2.81 +
    2.82 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
    2.83 +
    2.84 +    CT_Extract "glibc-${cvs}${CT_LIBC_VERSION}"
    2.85 +
    2.86 +    CT_Pushd "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}"
    2.87 +    CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
    2.88  
    2.89      # C library addons
    2.90      for addon in $(do_libc_add_ons_list " "); do
    2.91          # NPTL addon is not to be extracted, in any case
    2.92          [ "${addon}" = "nptl" ] && continue || true
    2.93 -        CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    2.94 -        CT_Extract "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
    2.95 +        CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
    2.96 +
    2.97          # Some addons have the 'long' name, while others have the
    2.98          # 'short' name, but patches are non-uniformly built with
    2.99          # either the 'long' or 'short' name, whatever the addons name
   2.100          # so we have to make symlinks from the existing to the missing
   2.101          # Fortunately for us, [ -d foo ], when foo is a symlink to a
   2.102          # directory, returns true!
   2.103 -        [ -d "${addon}" ] || ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
   2.104 -        [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
   2.105 +        [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" "${addon}"
   2.106 +        [ -d "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${cvs}${CT_LIBC_VERSION}"
   2.107          CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
   2.108 -        CT_Popd
   2.109      done
   2.110  
   2.111      # The configure files may be older than the configure.in files
   2.112      # if using a snapshot (or even some tarballs). Fake them being
   2.113      # up to date.
   2.114 -    find "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
   2.115 +    find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
   2.116 +
   2.117 +    CT_Popd
   2.118  
   2.119      return 0
   2.120  }
   2.121 @@ -91,8 +96,12 @@
   2.122  
   2.123  # This function installs the glibc headers needed to build the core compiler
   2.124  do_libc_headers() {
   2.125 +    local cvs
   2.126 +
   2.127      CT_DoStep INFO "Installing C library headers"
   2.128  
   2.129 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   2.130 +
   2.131      mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   2.132      cd "${CT_BUILD_DIR}/build-libc-headers"
   2.133  
   2.134 @@ -130,23 +139,23 @@
   2.135      CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
   2.136      CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
   2.137  
   2.138 -    libc_cv_ppc_machine=yes                             \
   2.139 -    CC=${cross_cc}                                      \
   2.140 -    CT_DoExecLog ALL                                    \
   2.141 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"  \
   2.142 -        --build="${CT_BUILD}"                           \
   2.143 -        --host="${CT_TARGET}"                           \
   2.144 -        --prefix=/usr                                   \
   2.145 -        --with-headers="${CT_HEADERS_DIR}"              \
   2.146 -        --without-cvs                                   \
   2.147 -        --disable-sanity-checks                         \
   2.148 -        --enable-hacker-mode                            \
   2.149 -        ${extra_config}                                 \
   2.150 +    libc_cv_ppc_machine=yes                                     \
   2.151 +    CC=${cross_cc}                                              \
   2.152 +    CT_DoExecLog ALL                                            \
   2.153 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"    \
   2.154 +        --build="${CT_BUILD}"                                   \
   2.155 +        --host="${CT_TARGET}"                                   \
   2.156 +        --prefix=/usr                                           \
   2.157 +        --with-headers="${CT_HEADERS_DIR}"                      \
   2.158 +        --without-cvs                                           \
   2.159 +        --disable-sanity-checks                                 \
   2.160 +        --enable-hacker-mode                                    \
   2.161 +        ${extra_config}                                         \
   2.162          --without-nptl
   2.163  
   2.164      CT_DoLog EXTRA "Installing C library headers"
   2.165  
   2.166 -    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ChangeLog"; then
   2.167 +    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ChangeLog"; then
   2.168          # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
   2.169          # which fails without a real cross-compiler.
   2.170          # Fortunately, we don't need errlist-compat.c, since we just need .h
   2.171 @@ -187,7 +196,7 @@
   2.172      # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
   2.173      mkdir -p "${CT_HEADERS_DIR}/gnu"
   2.174      CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
   2.175 -    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h"  \
   2.176 +    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/include/features.h"  \
   2.177                             "${CT_HEADERS_DIR}/features.h"
   2.178  
   2.179      # Building the bootstrap gcc requires either setting inhibit_libc, or
   2.180 @@ -202,20 +211,20 @@
   2.181      [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
   2.182  
   2.183      # Those headers are to be manually copied so gcc can build properly
   2.184 -    pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   2.185 +    pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   2.186      pthreadtypes_h=
   2.187      case "${CT_THREADS}" in
   2.188          nptl)
   2.189              # NOTE: for some archs, the pathes are different, but they are not
   2.190              # supported by crosstool-NG right now. See original crosstool when they are.
   2.191 -            pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   2.192 -            pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
   2.193 +            pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   2.194 +            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
   2.195              if [ ! -f "${pthreadtypes_h}" ]; then
   2.196 -                pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
   2.197 +                pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
   2.198              fi
   2.199              ;;
   2.200          linuxthreads)
   2.201 -            pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
   2.202 +            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
   2.203              ;;
   2.204          *)
   2.205              pthread_h=
   2.206 @@ -234,11 +243,15 @@
   2.207  
   2.208  # Build and install start files
   2.209  do_libc_start_files() {
   2.210 +    local cvs
   2.211 +
   2.212      # Needed only in the NPTL case. Otherwise, return.
   2.213      [ "${CT_THREADS}" = "nptl" ] || return 0
   2.214  
   2.215      CT_DoStep INFO "Installing C library start files"
   2.216  
   2.217 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   2.218 +
   2.219      mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
   2.220      cd "${CT_BUILD_DIR}/build-libc-startfiles"
   2.221  
   2.222 @@ -305,7 +318,7 @@
   2.223      AR=${CT_TARGET}-ar                                              \
   2.224      RANLIB=${CT_TARGET}-ranlib                                      \
   2.225      CT_DoExecLog ALL                                                \
   2.226 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"              \
   2.227 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"        \
   2.228          --prefix=/usr                                               \
   2.229          --build="${CT_BUILD}"                                       \
   2.230          --host=${CT_TARGET}                                         \
   2.231 @@ -336,8 +349,12 @@
   2.232  
   2.233  # This function builds and install the full glibc
   2.234  do_libc() {
   2.235 +    local cvs
   2.236 +
   2.237      CT_DoStep INFO "Installing C library"
   2.238  
   2.239 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   2.240 +
   2.241      mkdir -p "${CT_BUILD_DIR}/build-libc"
   2.242      cd "${CT_BUILD_DIR}/build-libc"
   2.243  
   2.244 @@ -432,7 +449,7 @@
   2.245      AR=${CT_TARGET}-ar                                              \
   2.246      RANLIB=${CT_TARGET}-ranlib                                      \
   2.247      CT_DoExecLog ALL                                                \
   2.248 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"              \
   2.249 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"        \
   2.250          --prefix=/usr                                               \
   2.251          --build=${CT_BUILD}                                         \
   2.252          --host=${CT_TARGET}                                         \
   2.253 @@ -446,7 +463,7 @@
   2.254          ${extra_config}                                             \
   2.255          ${CT_LIBC_GLIBC_EXTRA_CONFIG}
   2.256  
   2.257 -    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/Makerules" > /dev/null; then
   2.258 +    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then
   2.259          # nptl-era glibc.
   2.260          # If the install-lib-all target (which is added by our make-install-lib-all.patch)
   2.261          # is present, it means we're building glibc-2.3.3 or later, and we can't