libc/glibc: allow to selectively install headers and/or start-files
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 27 14:45:03 2011 +0100 (2011-12-27)
changeset 28264a21f0eb8b57
parent 2825 1c5ca9b0a5a0
child 2827 f8f2f75ff3fd
libc/glibc: allow to selectively install headers and/or start-files

When doing multilib, we only need the headers from the default variant,
but we need the startfiles for each variants.

Allow the frontend to specify either one, or both.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/libc/glibc-eglibc.sh-common
     1.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Wed Nov 23 00:11:36 2011 +0100
     1.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Tue Dec 27 14:45:03 2011 +0100
     1.3 @@ -77,16 +77,28 @@
     1.4      local multi_dir
     1.5      local multi_flags
     1.6      local extra_dir
     1.7 -    local arg f fn ln pre
     1.8 +    local libc_headers libc_startfiles libc_full
     1.9 +    local hdr
    1.10 +    local arg
    1.11  
    1.12      for arg in "$@"; do
    1.13          eval "${arg// /\\ }"
    1.14      done
    1.15  
    1.16      case "${libc_mode}" in
    1.17 -        startfiles) CT_DoStep INFO "Installing C library headers & start files";;
    1.18 -        final)      CT_DoStep INFO "Installing C library";;
    1.19 -        *)          CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
    1.20 +        startfiles)
    1.21 +            CT_DoStep INFO "Installing C library headers & start files"
    1.22 +            hdr=y
    1.23 +            libc_startfiles=y
    1.24 +            libc_full=
    1.25 +            ;;
    1.26 +        final)
    1.27 +            CT_DoStep INFO "Installing C library"
    1.28 +            hdr=
    1.29 +            libc_startfiles=
    1.30 +            libc_full=y
    1.31 +            ;;
    1.32 +        *)  CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
    1.33      esac
    1.34  
    1.35      # If gcc is not configured for multilib, it still prints
    1.36 @@ -119,17 +131,21 @@
    1.37                  CT_DoExecLog ALL ln -sf "../../usr/lib/${multi_dir}" "${multi_dir}/usr/lib"
    1.38                  CT_Popd
    1.39              fi
    1.40 +            libc_headers=
    1.41          else
    1.42              extra_dir=
    1.43              extra_flags=
    1.44 +            libc_headers="${hdr}"
    1.45          fi
    1.46  
    1.47          mkdir -p "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}"
    1.48          CT_Pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}"
    1.49  
    1.50 -        do_libc_backend_once extra_dir="${extra_dir}"      \
    1.51 -                             extra_flags="${extra_flags}"   \
    1.52 -                             "$@"
    1.53 +        do_libc_backend_once extra_dir="${extra_dir}"               \
    1.54 +                             extra_flags="${extra_flags}"           \
    1.55 +                             libc_headers="${libc_headers}"         \
    1.56 +                             libc_startfiles="${libc_startfiles}"   \
    1.57 +                             libc_full="${libc_full}"
    1.58  
    1.59          CT_Popd
    1.60  
    1.61 @@ -160,11 +176,15 @@
    1.62  # This backend builds the C library once
    1.63  # Usage: do_libc_backend_once param=value [...]
    1.64  #   Parameter           : Definition                            : Type      : Default
    1.65 -#   libc_mode           : 'startfiles' or 'final'               : string    : (none)
    1.66 +#   libc_headers        : Build libc headers                    : bool      : n
    1.67 +#   libc_startfiles     : Build libc start-files                : bool      : n
    1.68 +#   libc_full           : Build full libc                       : bool      : n
    1.69  #   extra_flags         : Extra CFLAGS to use (for multilib)    : string    : (empty)
    1.70  #   extra_dir           : Extra subdir for multilib             : string    : (empty)
    1.71  do_libc_backend_once() {
    1.72 -    local libc_mode
    1.73 +    local libc_headers
    1.74 +    local libc_startfiles
    1.75 +    local libc_full
    1.76      local extra_flags
    1.77      local extra_dir
    1.78      local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
    1.79 @@ -350,7 +370,7 @@
    1.80              ;;
    1.81      esac
    1.82  
    1.83 -    if [ "${libc_mode}" = "startfiles" ]; then
    1.84 +    if [ "${libc_headers}" = "y" ]; then
    1.85          CT_DoLog EXTRA "Installing C library headers"
    1.86  
    1.87          # use the 'install-headers' makefile target to install the
    1.88 @@ -387,7 +407,9 @@
    1.89                      ;;
    1.90              esac
    1.91          fi
    1.92 +    fi # libc_headers == y
    1.93  
    1.94 +    if [ "${libc_startfiles}" = "y" ]; then
    1.95          if [ "${CT_THREADS}" = "nptl" ]; then
    1.96              CT_DoLog EXTRA "Installing C library start files"
    1.97  
    1.98 @@ -410,7 +432,9 @@
    1.99                                             -x c /dev/null   \
   1.100                                             -o "${CT_SYSROOT_DIR}${extra_dir}/usr/lib/libc.so"
   1.101          fi # threads == nptl
   1.102 -    else # libc_mode = final
   1.103 +    fi # libc_headers == y
   1.104 +
   1.105 +    if [ "${libc_full}" = "y" ]; then
   1.106          CT_DoLog EXTRA "Building C library"
   1.107          CT_DoExecLog ALL make ${JOBSFLAGS}              \
   1.108                                "${extra_make_args[@]}"   \
   1.109 @@ -437,7 +461,7 @@
   1.110          if [ "${CT_LIBC_LOCALES}" = "y" ]; then
   1.111              do_libc_locales
   1.112          fi
   1.113 -    fi
   1.114 +    fi # libc_full == y
   1.115  }
   1.116  
   1.117  # This function finishes the C library install