scripts/build/libc/glibc.sh
changeset 1260 777153645ab8
parent 1232 80c5723e06fc
child 1395 da3d13b0880a
     1.1 --- a/scripts/build/libc/glibc.sh	Thu Mar 05 17:50:42 2009 +0000
     1.2 +++ b/scripts/build/libc/glibc.sh	Sun Mar 15 20:50:40 2009 +0000
     1.3 @@ -4,36 +4,11 @@
     1.4  
     1.5  # Download glibc
     1.6  do_libc_get() {
     1.7 -   local date
     1.8 +    local date
     1.9 +    local version
    1.10  
    1.11 -    # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
    1.12 -    # directory. Good. Alas, there is no snapshot there. I'll deal with them
    1.13 -    # later on... :-/
    1.14 -    # Update: sadly, glibc folks do be stupid: they no longer build
    1.15 -    # release tarballs as of glibc-2.8, hence forcing us to fetch
    1.16 -    # from CVS (CVS! Don't those guys know the world of SCM has
    1.17 -    # evolved since the dawn ages of CVS?) Sigh...
    1.18 -    if [ "${CT_LIBC_GLIBC_2_8_or_later}" = "y" ]; then
    1.19 -        # No release tarball available...
    1.20 -        date="${CT_LIBC_GLIBC_CVS_date}"
    1.21 -        CT_GetCVS "glibc-${CT_LIBC_VERSION}"                            \
    1.22 -                  ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"      \
    1.23 -                  "libc"                                                \
    1.24 -                  "glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}"    \
    1.25 -                  "glibc-${CT_LIBC_VERSION}"
    1.26 -
    1.27 -        # C library addons
    1.28 -        for addon in $(do_libc_add_ons_list " "); do
    1.29 -            # NPTL addon is not to be downloaded, in any case
    1.30 -            [ "${addon}" = "nptl" ] && continue || true
    1.31 -            CT_GetCVS "glibc-${addon}-${CT_LIBC_VERSION}"                   \
    1.32 -                      ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"      \
    1.33 -                      "${addon}"                                            \
    1.34 -                      "glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}"    \
    1.35 -                      "glibc-${addon}-${CT_LIBC_VERSION}"
    1.36 -        done
    1.37 -    else
    1.38 -        # Release tarballs are available
    1.39 +    if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
    1.40 +        # Use release tarballs
    1.41          CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
    1.42                     {ftp,http}://ftp.gnu.org/gnu/glibc       \
    1.43                     ftp://gcc.gnu.org/pub/glibc/releases     \
    1.44 @@ -48,6 +23,29 @@
    1.45                         ftp://gcc.gnu.org/pub/glibc/releases     \
    1.46                         ftp://gcc.gnu.org/pub/glibc/snapshots
    1.47          done
    1.48 +    elif [ "${CT_LIBC_GLIBC_CVS}" = "y" ]; then
    1.49 +        # Use CVS checkout
    1.50 +        version="${CT_LIBC_VERSION//./_}"
    1.51 +        date="${CT_LIBC_GLIBC_CVS_date}"
    1.52 +
    1.53 +        CT_GetCVS "glibc-cvs-${CT_LIBC_VERSION}"                    \
    1.54 +                  ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"  \
    1.55 +                  "libc"                                            \
    1.56 +                  "glibc-${version}-branch${date:+:}${date}"        \
    1.57 +                  "glibc-cvs-${CT_LIBC_VERSION}"
    1.58 +
    1.59 +        # C library addons
    1.60 +        for addon in $(do_libc_add_ons_list " "); do
    1.61 +            # NPTL addon is not to be downloaded, in any case
    1.62 +            [ "${addon}" = "nptl" ] && continue || true
    1.63 +            CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}"           \
    1.64 +                      ":pserver:anoncvs@sources.redhat.com:/cvs/glibc"  \
    1.65 +                      "${addon}"                                        \
    1.66 +                      "glibc-${version}-branch${date:+:}${date}"        \
    1.67 +                      "glibc-${addon}-cvs-${CT_LIBC_VERSION}"
    1.68 +        done
    1.69 +#    elif [ "${CT_LIBC_GLIBC_SNAPSHOT}" = "y" ]; then
    1.70 +#        : # Not yet handled...
    1.71      fi
    1.72  
    1.73      return 0
    1.74 @@ -55,31 +53,38 @@
    1.75  
    1.76  # Extract glibc
    1.77  do_libc_extract() {
    1.78 -    CT_Extract "glibc-${CT_LIBC_VERSION}"
    1.79 -    CT_Patch "glibc-${CT_LIBC_VERSION}"
    1.80 +    local cvs
    1.81 +
    1.82 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
    1.83 +
    1.84 +    CT_Extract "glibc-${cvs}${CT_LIBC_VERSION}"
    1.85 +
    1.86 +    CT_Pushd "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}"
    1.87 +    CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
    1.88  
    1.89      # C library addons
    1.90      for addon in $(do_libc_add_ons_list " "); do
    1.91          # NPTL addon is not to be extracted, in any case
    1.92          [ "${addon}" = "nptl" ] && continue || true
    1.93 -        CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    1.94 -        CT_Extract "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
    1.95 +        CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
    1.96 +
    1.97          # Some addons have the 'long' name, while others have the
    1.98          # 'short' name, but patches are non-uniformly built with
    1.99          # either the 'long' or 'short' name, whatever the addons name
   1.100          # so we have to make symlinks from the existing to the missing
   1.101          # Fortunately for us, [ -d foo ], when foo is a symlink to a
   1.102          # directory, returns true!
   1.103 -        [ -d "${addon}" ] || ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
   1.104 -        [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
   1.105 +        [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" "${addon}"
   1.106 +        [ -d "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${cvs}${CT_LIBC_VERSION}"
   1.107          CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
   1.108 -        CT_Popd
   1.109      done
   1.110  
   1.111      # The configure files may be older than the configure.in files
   1.112      # if using a snapshot (or even some tarballs). Fake them being
   1.113      # up to date.
   1.114 -    find "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
   1.115 +    find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
   1.116 +
   1.117 +    CT_Popd
   1.118  
   1.119      return 0
   1.120  }
   1.121 @@ -91,8 +96,12 @@
   1.122  
   1.123  # This function installs the glibc headers needed to build the core compiler
   1.124  do_libc_headers() {
   1.125 +    local cvs
   1.126 +
   1.127      CT_DoStep INFO "Installing C library headers"
   1.128  
   1.129 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   1.130 +
   1.131      mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   1.132      cd "${CT_BUILD_DIR}/build-libc-headers"
   1.133  
   1.134 @@ -130,23 +139,23 @@
   1.135      CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
   1.136      CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
   1.137  
   1.138 -    libc_cv_ppc_machine=yes                             \
   1.139 -    CC=${cross_cc}                                      \
   1.140 -    CT_DoExecLog ALL                                    \
   1.141 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"  \
   1.142 -        --build="${CT_BUILD}"                           \
   1.143 -        --host="${CT_TARGET}"                           \
   1.144 -        --prefix=/usr                                   \
   1.145 -        --with-headers="${CT_HEADERS_DIR}"              \
   1.146 -        --without-cvs                                   \
   1.147 -        --disable-sanity-checks                         \
   1.148 -        --enable-hacker-mode                            \
   1.149 -        ${extra_config}                                 \
   1.150 +    libc_cv_ppc_machine=yes                                     \
   1.151 +    CC=${cross_cc}                                              \
   1.152 +    CT_DoExecLog ALL                                            \
   1.153 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"    \
   1.154 +        --build="${CT_BUILD}"                                   \
   1.155 +        --host="${CT_TARGET}"                                   \
   1.156 +        --prefix=/usr                                           \
   1.157 +        --with-headers="${CT_HEADERS_DIR}"                      \
   1.158 +        --without-cvs                                           \
   1.159 +        --disable-sanity-checks                                 \
   1.160 +        --enable-hacker-mode                                    \
   1.161 +        ${extra_config}                                         \
   1.162          --without-nptl
   1.163  
   1.164      CT_DoLog EXTRA "Installing C library headers"
   1.165  
   1.166 -    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ChangeLog"; then
   1.167 +    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ChangeLog"; then
   1.168          # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
   1.169          # which fails without a real cross-compiler.
   1.170          # Fortunately, we don't need errlist-compat.c, since we just need .h
   1.171 @@ -187,7 +196,7 @@
   1.172      # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
   1.173      mkdir -p "${CT_HEADERS_DIR}/gnu"
   1.174      CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
   1.175 -    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h"  \
   1.176 +    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/include/features.h"  \
   1.177                             "${CT_HEADERS_DIR}/features.h"
   1.178  
   1.179      # Building the bootstrap gcc requires either setting inhibit_libc, or
   1.180 @@ -202,20 +211,20 @@
   1.181      [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
   1.182  
   1.183      # Those headers are to be manually copied so gcc can build properly
   1.184 -    pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   1.185 +    pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   1.186      pthreadtypes_h=
   1.187      case "${CT_THREADS}" in
   1.188          nptl)
   1.189              # NOTE: for some archs, the pathes are different, but they are not
   1.190              # supported by crosstool-NG right now. See original crosstool when they are.
   1.191 -            pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   1.192 -            pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
   1.193 +            pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
   1.194 +            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
   1.195              if [ ! -f "${pthreadtypes_h}" ]; then
   1.196 -                pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
   1.197 +                pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
   1.198              fi
   1.199              ;;
   1.200          linuxthreads)
   1.201 -            pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
   1.202 +            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
   1.203              ;;
   1.204          *)
   1.205              pthread_h=
   1.206 @@ -234,11 +243,15 @@
   1.207  
   1.208  # Build and install start files
   1.209  do_libc_start_files() {
   1.210 +    local cvs
   1.211 +
   1.212      # Needed only in the NPTL case. Otherwise, return.
   1.213      [ "${CT_THREADS}" = "nptl" ] || return 0
   1.214  
   1.215      CT_DoStep INFO "Installing C library start files"
   1.216  
   1.217 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   1.218 +
   1.219      mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
   1.220      cd "${CT_BUILD_DIR}/build-libc-startfiles"
   1.221  
   1.222 @@ -305,7 +318,7 @@
   1.223      AR=${CT_TARGET}-ar                                              \
   1.224      RANLIB=${CT_TARGET}-ranlib                                      \
   1.225      CT_DoExecLog ALL                                                \
   1.226 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"              \
   1.227 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"        \
   1.228          --prefix=/usr                                               \
   1.229          --build="${CT_BUILD}"                                       \
   1.230          --host=${CT_TARGET}                                         \
   1.231 @@ -336,8 +349,12 @@
   1.232  
   1.233  # This function builds and install the full glibc
   1.234  do_libc() {
   1.235 +    local cvs
   1.236 +
   1.237      CT_DoStep INFO "Installing C library"
   1.238  
   1.239 +    [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
   1.240 +
   1.241      mkdir -p "${CT_BUILD_DIR}/build-libc"
   1.242      cd "${CT_BUILD_DIR}/build-libc"
   1.243  
   1.244 @@ -432,7 +449,7 @@
   1.245      AR=${CT_TARGET}-ar                                              \
   1.246      RANLIB=${CT_TARGET}-ranlib                                      \
   1.247      CT_DoExecLog ALL                                                \
   1.248 -    "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure"              \
   1.249 +    "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure"        \
   1.250          --prefix=/usr                                               \
   1.251          --build=${CT_BUILD}                                         \
   1.252          --host=${CT_TARGET}                                         \
   1.253 @@ -446,7 +463,7 @@
   1.254          ${extra_config}                                             \
   1.255          ${CT_LIBC_GLIBC_EXTRA_CONFIG}
   1.256  
   1.257 -    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/Makerules" > /dev/null; then
   1.258 +    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then
   1.259          # nptl-era glibc.
   1.260          # If the install-lib-all target (which is added by our make-install-lib-all.patch)
   1.261          # is present, it means we're building glibc-2.3.3 or later, and we can't