Introduce a new EXPERIMENTAL feature: BARE_METAL.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Sep 14 16:21:07 2008 +0000 (2008-09-14)
changeset 850ef8549b58b6f
parent 849 777bf06ddd8b
child 851 6add2c0b63cd
Introduce a new EXPERIMENTAL feature: BARE_METAL.
This should ultimately llow to build bare-metal compilers, for targets that have no kernel and no C library.
Move the C library build script to their own sub-directory; introduce an empty build script for bare-metal.
Move the compiler build script to its own sub-directory.
Move the kernel build script to its own sub-directory; introduce an empty build script for bare-metal.
Update the ARM target tuples to enable bare-metal targets.
Add two ARM bare-metal samples.
Add latest Linux kernel versions.

/trunk/scripts/build/kernel/none.sh | 77 6 71 0 +----
/trunk/scripts/build/cc/gcc.sh | 58 41 17 0 ++-
/trunk/scripts/build/libc/none.sh | 513 9 504 0 +-----------------------------
/trunk/scripts/crosstool.sh | 17 9 8 0 +
/trunk/scripts/functions | 6 4 2 0 +
/trunk/scripts/showSamples.sh | 6 3 3 0
/trunk/samples/arm-unknown-elf/crosstool.config | 225 225 0 0 +++++++++++++
/trunk/samples/arm-unknown-eabi/crosstool.config | 223 223 0 0 +++++++++++++
/trunk/config/kernel/linux_headers_install.in | 64 27 37 0 ++--
/trunk/config/kernel.in | 9 8 1 0 +
/trunk/config/toolchain.in | 1 1 0 0 +
/trunk/config/cc/gcc.in | 3 3 0 0 +
/trunk/config/debug/dmalloc.in | 1 1 0 0 +
/trunk/config/debug/gdb.in | 4 3 1 0 +
/trunk/config/debug/strace.in | 1 1 0 0 +
/trunk/config/debug/duma.in | 1 1 0 0 +
/trunk/config/cc.in | 8 8 0 0 +
/trunk/config/target.in | 13 13 0 0 +
/trunk/config/binutils.in | 1 1 0 0 +
/trunk/config/gmp_mpfr.in | 1 1 0 0 +
/trunk/config/libc.in | 17 11 6 0 +
/trunk/arch/arm/functions | 3 1 2 0 -
22 files changed, 600 insertions(+), 652 deletions(-)
arch/arm/functions
config/binutils.in
config/cc.in
config/cc/gcc.in
config/debug/dmalloc.in
config/debug/duma.in
config/debug/gdb.in
config/debug/strace.in
config/gmp_mpfr.in
config/kernel.in
config/kernel/linux_headers_install.in
config/libc.in
config/target.in
config/toolchain.in
samples/arm-unknown-eabi/crosstool.config
samples/arm-unknown-elf/crosstool.config
scripts/build/cc/gcc.sh
scripts/build/cc_gcc.sh
scripts/build/kernel/none.sh
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc.sh
scripts/build/libc/none.sh
scripts/build/libc/uClibc.sh
scripts/build/libc_eglibc.sh
scripts/build/libc_glibc.sh
scripts/build/libc_uClibc.sh
scripts/crosstool.sh
scripts/functions
scripts/showSamples.sh
     1.1 --- a/arch/arm/functions	Thu Sep 11 09:02:00 2008 +0000
     1.2 +++ b/arch/arm/functions	Sun Sep 14 16:21:07 2008 +0000
     1.3 @@ -6,10 +6,9 @@
     1.4  
     1.5      # The system part of the tuple:
     1.6      case "${CT_LIBC},${CT_ARCH_ARM_EABI}" in
     1.7 -        *glibc,)    CT_TARGET_SYS=gnu;;
     1.8          *glibc,y)   CT_TARGET_SYS=gnueabi;;
     1.9 -        uClibc,)    CT_TARGET_SYS=uclibc;;
    1.10          uClibc,y)   CT_TARGET_SYS=uclibcgnueabi;;
    1.11 +        none,y)     CT_TARGET_SYS=eabi;;
    1.12      esac
    1.13  
    1.14      # In case we're EABI, do *not* specify any ABI!
     2.1 --- a/config/binutils.in	Thu Sep 11 09:02:00 2008 +0000
     2.2 +++ b/config/binutils.in	Sun Sep 14 16:21:07 2008 +0000
     2.3 @@ -79,6 +79,7 @@
     2.4  config BINUTILS_FOR_TARGET
     2.5      bool
     2.6      prompt "binutils libraries for the target"
     2.7 +    depends on ! BARE_METAL
     2.8      default n
     2.9      help
    2.10        Some utilities may need binutils libraries to be available on
     3.1 --- a/config/cc.in	Thu Sep 11 09:02:00 2008 +0000
     3.2 +++ b/config/cc.in	Sun Sep 14 16:21:07 2008 +0000
     3.3 @@ -53,6 +53,8 @@
     3.4  config CC_SUPPORT_OBJCXX
     3.5      bool
     3.6  
     3.7 +if ! BARE_METAL
     3.8 +
     3.9  comment "Additional supported languages:"
    3.10  
    3.11  config CC_LANG_CXX
    3.12 @@ -136,4 +138,10 @@
    3.13        Eg. gcc-4.1+ has a toy programming language, treelang. As it is not usefull
    3.14        in real life, it is not available in the selection above.
    3.15  
    3.16 +endif # ! BARE_METAL
    3.17 +
    3.18 +if BARE_METAL
    3.19 +comment "Only C language supported on bare metal"
    3.20 +endif # BARE_METAL
    3.21 +
    3.22  endmenu
     4.1 --- a/config/cc/gcc.in	Thu Sep 11 09:02:00 2008 +0000
     4.2 +++ b/config/cc/gcc.in	Sun Sep 14 16:21:07 2008 +0000
     4.3 @@ -130,6 +130,7 @@
     4.4      bool
     4.5      prompt "Use __cxa_atexit"
     4.6      default y
     4.7 +    depends on ! BARE_METAL
     4.8      help
     4.9        If you get the missing symbol "__cxa_atexit" when building C++ programs,
    4.10        you might want to try disabling this option.
    4.11 @@ -138,6 +139,7 @@
    4.12      bool
    4.13      prompt "Use sjlj for exceptions"
    4.14      default CC_SJLJ_EXCEPTIONS_CONFIGURE
    4.15 +    depends on ! BARE_METAL
    4.16  
    4.17  # This config option is used nowhere in the code on purpose.
    4.18  # It only serves as a choice entry to force neither using nor not using sjlj
    4.19 @@ -185,6 +187,7 @@
    4.20      string
    4.21      prompt "gcc extra config"
    4.22      default ""
    4.23 +    depends on ! BARE_METAL
    4.24      help
    4.25        Extra flags to pass onto ./configure when configuring gcc.
    4.26  
     5.1 --- a/config/debug/dmalloc.in	Thu Sep 11 09:02:00 2008 +0000
     5.2 +++ b/config/debug/dmalloc.in	Sun Sep 14 16:21:07 2008 +0000
     5.3 @@ -4,6 +4,7 @@
     5.4      bool
     5.5      prompt "dmalloc"
     5.6      default n
     5.7 +    depends on ! BARE_METAL
     5.8  
     5.9  if DMALLOC
    5.10  
     6.1 --- a/config/debug/duma.in	Thu Sep 11 09:02:00 2008 +0000
     6.2 +++ b/config/debug/duma.in	Sun Sep 14 16:21:07 2008 +0000
     6.3 @@ -4,6 +4,7 @@
     6.4      bool
     6.5      prompt "D.U.M.A."
     6.6      default n
     6.7 +    depends on ! BARE_METAL
     6.8      help
     6.9        D.U.M.A. - Detect Unintended Memory Access
    6.10        A memory bound checker, with additional features.
     7.1 --- a/config/debug/gdb.in	Thu Sep 11 09:02:00 2008 +0000
     7.2 +++ b/config/debug/gdb.in	Sun Sep 14 16:21:07 2008 +0000
     7.3 @@ -13,7 +13,7 @@
     7.4      bool
     7.5      prompt "Cross-gdb"
     7.6      default y
     7.7 -    select GDB_GDBSERVER
     7.8 +    select GDB_GDBSERVER if ! BARE_METAL
     7.9      help
    7.10        Build and install a cross-gdb for the target, to run on host.
    7.11  
    7.12 @@ -45,6 +45,7 @@
    7.13      bool
    7.14      prompt "Native gdb"
    7.15      default n
    7.16 +    depends on ! BARE_METAL
    7.17      help
    7.18        Build and install a native gdb for the target, to run on the target.
    7.19  
    7.20 @@ -78,6 +79,7 @@
    7.21      bool
    7.22      prompt "gdbserver"
    7.23      default n
    7.24 +    depends on ! BARE_METAL
    7.25      help
    7.26        Build and install a gdbserver for the target, to run on the target.
    7.27  
     8.1 --- a/config/debug/strace.in	Thu Sep 11 09:02:00 2008 +0000
     8.2 +++ b/config/debug/strace.in	Sun Sep 14 16:21:07 2008 +0000
     8.3 @@ -4,6 +4,7 @@
     8.4      bool
     8.5      prompt "strace"
     8.6      default n
     8.7 +    depends on ! BARE_METAL
     8.8  
     8.9  if STRACE
    8.10  
     9.1 --- a/config/gmp_mpfr.in	Thu Sep 11 09:02:00 2008 +0000
     9.2 +++ b/config/gmp_mpfr.in	Sun Sep 14 16:21:07 2008 +0000
     9.3 @@ -20,6 +20,7 @@
     9.4      bool
     9.5      prompt "Build libraries for the target"
     9.6      depends on GMP_MPFR
     9.7 +    depends on ! BARE_METAL
     9.8      default n
     9.9      help
    9.10        Also build libraries for the target. This can be usefull if you want
    10.1 --- a/config/kernel.in	Thu Sep 11 09:02:00 2008 +0000
    10.2 +++ b/config/kernel.in	Sun Sep 14 16:21:07 2008 +0000
    10.3 @@ -1,11 +1,16 @@
    10.4  # Kernel options
    10.5  
    10.6 -menu "Kernel"
    10.7 +
    10.8  
    10.9  config KERNEL
   10.10      string
   10.11 +    default "none"  if BARE_METAL
   10.12      default "linux" if KERNEL_LINUX
   10.13  
   10.14 +if ! BARE_METAL
   10.15 +
   10.16 +menu "Kernel"
   10.17 +
   10.18  choice
   10.19      bool
   10.20      prompt "Target OS"
   10.21 @@ -27,3 +32,5 @@
   10.22  endif
   10.23  
   10.24  endmenu
   10.25 +
   10.26 +endif # ! BARE_METAL
    11.1 --- a/config/kernel/linux_headers_install.in	Thu Sep 11 09:02:00 2008 +0000
    11.2 +++ b/config/kernel/linux_headers_install.in	Sun Sep 14 16:21:07 2008 +0000
    11.3 @@ -32,44 +32,10 @@
    11.4      prompt "2.6.23.17 (OBSOLETE)"
    11.5      depends on KERNEL_VERSION_SEE_EXTRAVERSION && OBSOLETE
    11.6  
    11.7 -config KERNEL_INSTALL_V_2_6_24
    11.8 -    bool
    11.9 -    prompt "2.6.24"
   11.10 -
   11.11 -config KERNEL_INSTALL_V_2_6_24_1
   11.12 -    bool
   11.13 -    prompt "2.6.24.1"
   11.14 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.15 -
   11.16 -config KERNEL_INSTALL_V_2_6_24_2
   11.17 -    bool
   11.18 -    prompt "2.6.24.2"
   11.19 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.20 -
   11.21 -config KERNEL_INSTALL_V_2_6_24_3
   11.22 -    bool
   11.23 -    prompt "2.6.24.3"
   11.24 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.25 -
   11.26 -config KERNEL_INSTALL_V_2_6_24_4
   11.27 -    bool
   11.28 -    prompt "2.6.24.4"
   11.29 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.30 -
   11.31 -config KERNEL_INSTALL_V_2_6_24_5
   11.32 -    bool
   11.33 -    prompt "2.6.24.5"
   11.34 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.35 -
   11.36 -config KERNEL_INSTALL_V_2_6_24_6
   11.37 -    bool
   11.38 -    prompt "2.6.24.6"
   11.39 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.40 -
   11.41  config KERNEL_INSTALL_V_2_6_24_7
   11.42      bool
   11.43 -    prompt "2.6.24.7"
   11.44 -    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.45 +    prompt "2.6.24.7 (OBSOLETE)"
   11.46 +    depends on KERNEL_VERSION_SEE_EXTRAVERSION && OBSOLETE
   11.47  
   11.48  config KERNEL_INSTALL_V_2_6_25
   11.49      bool
   11.50 @@ -150,6 +116,16 @@
   11.51      prompt "2.6.25.15"
   11.52      depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.53  
   11.54 +config KERNEL_INSTALL_V_2_6_25_16
   11.55 +    bool
   11.56 +    prompt "2.6.25.16"
   11.57 +    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.58 +
   11.59 +config KERNEL_INSTALL_V_2_6_25_17
   11.60 +    bool
   11.61 +    prompt "2.6.25.17"
   11.62 +    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.63 +
   11.64  config KERNEL_INSTALL_V_2_6_26
   11.65      bool
   11.66      prompt "2.6.26"
   11.67 @@ -169,6 +145,16 @@
   11.68      prompt "2.6.26.3"
   11.69      depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.70  
   11.71 +config KERNEL_INSTALL_V_2_6_26_4
   11.72 +    bool
   11.73 +    prompt "2.6.26.4"
   11.74 +    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.75 +
   11.76 +config KERNEL_INSTALL_V_2_6_26_5
   11.77 +    bool
   11.78 +    prompt "2.6.26.5"
   11.79 +    depends on KERNEL_VERSION_SEE_EXTRAVERSION
   11.80 +
   11.81  # CT_INSERT_VERSION_ABOVE
   11.82  # Don't remove above line!
   11.83  endchoice
   11.84 @@ -204,11 +190,15 @@
   11.85      default "2.6.25.12" if KERNEL_INSTALL_V_2_6_25_12
   11.86      default "2.6.25.13" if KERNEL_INSTALL_V_2_6_25_13
   11.87      default "2.6.25.14" if KERNEL_INSTALL_V_2_6_25_14
   11.88 -    default "2.6.25.15" if KERNEL_INSTALL_V_2_6_25_15
   11.89 +    default "2.6.25.14" if KERNEL_INSTALL_V_2_6_25_15
   11.90 +    default "2.6.25.15" if KERNEL_INSTALL_V_2_6_25_16
   11.91 +    default "2.6.25.15" if KERNEL_INSTALL_V_2_6_25_17
   11.92      default "2.6.26" if KERNEL_INSTALL_V_2_6_26
   11.93      default "2.6.26.1" if KERNEL_INSTALL_V_2_6_26_1
   11.94      default "2.6.26.2" if KERNEL_INSTALL_V_2_6_26_2
   11.95      default "2.6.26.3" if KERNEL_INSTALL_V_2_6_26_3
   11.96 +    default "2.6.26.4" if KERNEL_INSTALL_V_2_6_26_4
   11.97 +    default "2.6.26.5" if KERNEL_INSTALL_V_2_6_26_5
   11.98  # CT_INSERT_VERSION_STRING_ABOVE
   11.99  # Don't remove above line!
  11.100  
    12.1 --- a/config/libc.in	Thu Sep 11 09:02:00 2008 +0000
    12.2 +++ b/config/libc.in	Sun Sep 14 16:21:07 2008 +0000
    12.3 @@ -1,5 +1,14 @@
    12.4  # C library options
    12.5  
    12.6 +config LIBC
    12.7 +    string
    12.8 +    default "none"   if BARE_METAL
    12.9 +    default "glibc"  if LIBC_GLIBC
   12.10 +    default "eglibc" if LIBC_EGLIBC
   12.11 +    default "uClibc" if LIBC_UCLIBC
   12.12 +
   12.13 +if ! BARE_METAL
   12.14 +
   12.15  menu "C-library"
   12.16  
   12.17  choice
   12.18 @@ -49,12 +58,6 @@
   12.19  config LIBC_VERSION
   12.20      string
   12.21  
   12.22 -config LIBC
   12.23 -    string
   12.24 -    default "glibc" if LIBC_GLIBC
   12.25 -    default "eglibc" if LIBC_EGLIBC
   12.26 -    default "uClibc" if LIBC_UCLIBC
   12.27 -
   12.28  config LIBC_SUPPORT_NPTL
   12.29      bool
   12.30      default n
   12.31 @@ -106,3 +109,5 @@
   12.32        have to save your C library tarball by yourself.
   12.33  
   12.34  endmenu
   12.35 +
   12.36 +endif # ! BARE_METAL
    13.1 --- a/config/target.in	Thu Sep 11 09:02:00 2008 +0000
    13.2 +++ b/config/target.in	Sun Sep 14 16:21:07 2008 +0000
    13.3 @@ -28,6 +28,19 @@
    13.4  
    13.5  comment "General target options"
    13.6  
    13.7 +config BARE_METAL
    13.8 +    bool
    13.9 +    prompt "Bare metal (EXPERIMENTAL)"
   13.10 +    default n
   13.11 +    depends on EXPERIMENTAL
   13.12 +    help
   13.13 +      Say 'y' here if you want a simple C compiler with no C library.
   13.14 +
   13.15 +      You probably want to say 'y' here if you plan to use your compiler
   13.16 +      to build only kernels or bootloaders
   13.17 +
   13.18 +      'Bare metal' also refer to those programs that run without any kernel.
   13.19 +
   13.20  choice
   13.21      bool
   13.22      prompt "Target architecture:"
    14.1 --- a/config/toolchain.in	Thu Sep 11 09:02:00 2008 +0000
    14.2 +++ b/config/toolchain.in	Sun Sep 14 16:21:07 2008 +0000
    14.3 @@ -15,6 +15,7 @@
    14.4  config SHARED_LIBS
    14.5      bool
    14.6      prompt "Build shared libraries"
    14.7 +    depends on ! BARE_METAL
    14.8      default y
    14.9      help
   14.10        Say 'y' here, unless you don't want shared libraries.
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/samples/arm-unknown-eabi/crosstool.config	Sun Sep 14 16:21:07 2008 +0000
    15.3 @@ -0,0 +1,223 @@
    15.4 +#
    15.5 +# Automatically generated make config: don't edit
    15.6 +# crosstool-NG version: 1.2.0+svn_trunk@1001M
    15.7 +# Thu Sep 11 00:53:13 2008
    15.8 +#
    15.9 +
   15.10 +#
   15.11 +# Paths and misc options
   15.12 +#
   15.13 +
   15.14 +#
   15.15 +# crosstool-NG behavior
   15.16 +#
   15.17 +# CT_OBSOLETE is not set
   15.18 +CT_EXPERIMENTAL=y
   15.19 +# CT_BROKEN is not set
   15.20 +# CT_DEBUG_CT is not set
   15.21 +
   15.22 +#
   15.23 +# Paths
   15.24 +#
   15.25 +CT_LOCAL_TARBALLS_DIR="${HOME}/src"
   15.26 +CT_SAVE_TARBALLS=y
   15.27 +CT_WORK_DIR="${CT_TOP_DIR}/targets"
   15.28 +CT_PREFIX_DIR="${HOME}/x-tools/${CT_TARGET}"
   15.29 +CT_INSTALL_DIR="${CT_PREFIX_DIR}"
   15.30 +# CT_CUSTOM_PATCH is not set
   15.31 +CT_REMOVE_DOCS=y
   15.32 +CT_INSTALL_DIR_RO=y
   15.33 +
   15.34 +#
   15.35 +# Downloading
   15.36 +#
   15.37 +# CT_FORCE_DOWNLOAD is not set
   15.38 +# CT_USE_PROXY is not set
   15.39 +CT_PROXY_TYPE="none"
   15.40 +# CT_USE_LAN_MIRROR is not set
   15.41 +CT_CONNECT_TIMEOUT=10
   15.42 +# CT_ONLY_DOWNLOAD is not set
   15.43 +
   15.44 +#
   15.45 +# Extracting
   15.46 +#
   15.47 +# CT_FORCE_EXTRACT is not set
   15.48 +CT_OVERIDE_CONFIG_GUESS_SUB=y
   15.49 +# CT_ONLY_EXTRACT is not set
   15.50 +
   15.51 +#
   15.52 +# Build behavior
   15.53 +#
   15.54 +CT_PARALLEL_JOBS=1
   15.55 +CT_LOAD=0
   15.56 +CT_NICE=0
   15.57 +CT_USE_PIPES=y
   15.58 +CT_CONFIG_SHELL_ASH=y
   15.59 +
   15.60 +#
   15.61 +# Logging
   15.62 +#
   15.63 +# CT_LOG_ERROR is not set
   15.64 +# CT_LOG_WARN is not set
   15.65 +# CT_LOG_INFO is not set
   15.66 +CT_LOG_EXTRA=y
   15.67 +# CT_LOG_DEBUG is not set
   15.68 +# CT_LOG_ALL is not set
   15.69 +CT_LOG_LEVEL_MAX="EXTRA"
   15.70 +# CT_LOG_SEE_TOOLS_WARN is not set
   15.71 +CT_LOG_PROGRESS_BAR=y
   15.72 +CT_LOG_TO_FILE=y
   15.73 +CT_LOG_FILE_COMPRESS=y
   15.74 +
   15.75 +#
   15.76 +# Target options
   15.77 +#
   15.78 +CT_ARCH="arm"
   15.79 +CT_ARCH_SUPPORT_ARCH=y
   15.80 +# CT_ARCH_SUPPORT_ABI is not set
   15.81 +CT_ARCH_SUPPORT_CPU=y
   15.82 +CT_ARCH_SUPPORT_TUNE=y
   15.83 +CT_ARCH_SUPPORT_FPU=y
   15.84 +CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
   15.85 +# CT_ARCH_DEFAULT_BE is not set
   15.86 +CT_ARCH_DEFAULT_LE=y
   15.87 +CT_ARCH_ARCH=""
   15.88 +CT_ARCH_CPU=""
   15.89 +CT_ARCH_TUNE=""
   15.90 +CT_ARCH_FPU=""
   15.91 +# CT_ARCH_BE is not set
   15.92 +CT_ARCH_LE=y
   15.93 +CT_ARCH_FLOAT_HW=y
   15.94 +# CT_ARCH_FLOAT_SW is not set
   15.95 +CT_TARGET_CFLAGS=""
   15.96 +CT_TARGET_LDFLAGS=""
   15.97 +
   15.98 +#
   15.99 +# General target options
  15.100 +#
  15.101 +CT_BARE_METAL=y
  15.102 +# CT_ARCH_alpha is not set
  15.103 +CT_ARCH_arm=y
  15.104 +CT_ARCH_ARM_EABI=y
  15.105 +# CT_ARCH_ia64 is not set
  15.106 +# CT_ARCH_mips is not set
  15.107 +# CT_ARCH_powerpc is not set
  15.108 +# CT_ARCH_sh is not set
  15.109 +# CT_ARCH_x86 is not set
  15.110 +# CT_ARCH_x86_64 is not set
  15.111 +
  15.112 +#
  15.113 +# Target optimisations
  15.114 +#
  15.115 +
  15.116 +#
  15.117 +# Toolchain options
  15.118 +#
  15.119 +
  15.120 +#
  15.121 +# General toolchain options
  15.122 +#
  15.123 +CT_USE_SYSROOT=y
  15.124 +CT_TARGET_VENDOR="unknown"
  15.125 +CT_TARGET_ALIAS_SED_EXPR=""
  15.126 +CT_TARGET_ALIAS=""
  15.127 +
  15.128 +#
  15.129 +# Toolchain type
  15.130 +#
  15.131 +# CT_NATIVE is not set
  15.132 +CT_CROSS=y
  15.133 +# CT_CROSS_NATIVE is not set
  15.134 +# CT_CANADIAN is not set
  15.135 +CT_TOOLCHAIN_TYPE="cross"
  15.136 +CT_BUILD=""
  15.137 +CT_CC_NATIVE="gcc"
  15.138 +CT_KERNEL="none"
  15.139 +
  15.140 +#
  15.141 +# GMP and MPFR
  15.142 +#
  15.143 +CT_GMP_MPFR=y
  15.144 +CT_GMP_V_4_2_2=y
  15.145 +CT_GMP_VERSION="4.2.2"
  15.146 +CT_GMP_CHECK=y
  15.147 +CT_MPFR_V_2_3_1=y
  15.148 +CT_MPFR_VERSION="2.3.1"
  15.149 +CT_MPFR_CHECK=y
  15.150 +
  15.151 +#
  15.152 +# binutils
  15.153 +#
  15.154 +CT_BINUTILS_VERSION="2.18"
  15.155 +# CT_BINUTILS_V_2_14 is not set
  15.156 +# CT_BINUTILS_V_2_15 is not set
  15.157 +# CT_BINUTILS_V_2_16_1 is not set
  15.158 +# CT_BINUTILS_V_2_17 is not set
  15.159 +CT_BINUTILS_V_2_18=y
  15.160 +# CT_BINUTILS_V_2_18_50_0_4 is not set
  15.161 +# CT_BINUTILS_V_2_18_50_0_6 is not set
  15.162 +# CT_BINUTILS_V_2_18_50_0_7 is not set
  15.163 +# CT_BINUTILS_V_2_18_50_0_8 is not set
  15.164 +CT_BINUTILS_EXTRA_CONFIG=""
  15.165 +
  15.166 +#
  15.167 +# C compiler
  15.168 +#
  15.169 +CT_CC_GCC=y
  15.170 +CT_CC_VERSION="4.3.1"
  15.171 +CT_CC="gcc"
  15.172 +# CT_CC_V_2_95_3 is not set
  15.173 +# CT_CC_V_3_2_3 is not set
  15.174 +# CT_CC_V_3_3_6 is not set
  15.175 +# CT_CC_V_3_4_6 is not set
  15.176 +# CT_CC_V_4_0_0 is not set
  15.177 +# CT_CC_V_4_0_1 is not set
  15.178 +# CT_CC_V_4_0_2 is not set
  15.179 +# CT_CC_V_4_0_3 is not set
  15.180 +# CT_CC_V_4_0_4 is not set
  15.181 +# CT_CC_V_4_1_0 is not set
  15.182 +# CT_CC_V_4_1_1 is not set
  15.183 +# CT_CC_V_4_1_2 is not set
  15.184 +# CT_CC_V_4_2_0 is not set
  15.185 +# CT_CC_V_4_2_1 is not set
  15.186 +# CT_CC_V_4_2_2 is not set
  15.187 +# CT_CC_V_4_2_3 is not set
  15.188 +# CT_CC_V_4_2_4 is not set
  15.189 +# CT_CC_V_4_3_0 is not set
  15.190 +CT_CC_V_4_3_1=y
  15.191 +CT_CC_GCC_4_3_or_later=y
  15.192 +CT_CC_CORE_EXTRA_CONFIG=""
  15.193 +CT_CC_PKGVERSION="crosstool-NG-${CT_VERSION}"
  15.194 +CT_CC_BUGURL=""
  15.195 +CT_CC_SUPPORT_CXX=y
  15.196 +CT_CC_SUPPORT_FORTRAN=y
  15.197 +CT_CC_SUPPORT_JAVA=y
  15.198 +CT_CC_SUPPORT_ADA=y
  15.199 +CT_CC_SUPPORT_OBJC=y
  15.200 +CT_CC_SUPPORT_OBJCXX=y
  15.201 +
  15.202 +#
  15.203 +# Only C language supported on bare metal
  15.204 +#
  15.205 +CT_LIBC="none"
  15.206 +
  15.207 +#
  15.208 +# Tools facilities
  15.209 +#
  15.210 +# CT_SSTRIP is not set
  15.211 +
  15.212 +#
  15.213 +# Debug facilities
  15.214 +#
  15.215 +CT_GDB=y
  15.216 +CT_GDB_CROSS=y
  15.217 +# CT_GDB_CROSS_STATIC is not set
  15.218 +# CT_GDB_CROSS_INSIGHT is not set
  15.219 +# CT_GDB_V_snapshot is not set
  15.220 +# CT_GDB_V_6_4 is not set
  15.221 +# CT_GDB_V_6_5 is not set
  15.222 +# CT_GDB_V_6_6 is not set
  15.223 +# CT_GDB_V_6_7 is not set
  15.224 +# CT_GDB_V_6_7_1 is not set
  15.225 +CT_GDB_V_6_8=y
  15.226 +CT_GDB_VERSION="6.8"
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/samples/arm-unknown-elf/crosstool.config	Sun Sep 14 16:21:07 2008 +0000
    16.3 @@ -0,0 +1,225 @@
    16.4 +#
    16.5 +# Automatically generated make config: don't edit
    16.6 +# crosstool-NG version: 1.2.0+svn_trunk@1001M
    16.7 +# Thu Sep 11 00:48:33 2008
    16.8 +#
    16.9 +
   16.10 +#
   16.11 +# Paths and misc options
   16.12 +#
   16.13 +
   16.14 +#
   16.15 +# crosstool-NG behavior
   16.16 +#
   16.17 +# CT_OBSOLETE is not set
   16.18 +CT_EXPERIMENTAL=y
   16.19 +# CT_BROKEN is not set
   16.20 +# CT_DEBUG_CT is not set
   16.21 +
   16.22 +#
   16.23 +# Paths
   16.24 +#
   16.25 +CT_LOCAL_TARBALLS_DIR="${HOME}/src"
   16.26 +CT_SAVE_TARBALLS=y
   16.27 +CT_WORK_DIR="${CT_TOP_DIR}/targets"
   16.28 +CT_PREFIX_DIR="${HOME}/x-tools/${CT_TARGET}"
   16.29 +CT_INSTALL_DIR="${CT_PREFIX_DIR}"
   16.30 +# CT_CUSTOM_PATCH is not set
   16.31 +CT_REMOVE_DOCS=y
   16.32 +CT_INSTALL_DIR_RO=y
   16.33 +
   16.34 +#
   16.35 +# Downloading
   16.36 +#
   16.37 +# CT_FORCE_DOWNLOAD is not set
   16.38 +# CT_USE_PROXY is not set
   16.39 +CT_PROXY_TYPE="none"
   16.40 +# CT_USE_LAN_MIRROR is not set
   16.41 +CT_CONNECT_TIMEOUT=10
   16.42 +# CT_ONLY_DOWNLOAD is not set
   16.43 +
   16.44 +#
   16.45 +# Extracting
   16.46 +#
   16.47 +# CT_FORCE_EXTRACT is not set
   16.48 +CT_OVERIDE_CONFIG_GUESS_SUB=y
   16.49 +# CT_ONLY_EXTRACT is not set
   16.50 +
   16.51 +#
   16.52 +# Build behavior
   16.53 +#
   16.54 +CT_PARALLEL_JOBS=1
   16.55 +CT_LOAD=0
   16.56 +CT_NICE=0
   16.57 +CT_USE_PIPES=y
   16.58 +CT_CONFIG_SHELL_ASH=y
   16.59 +
   16.60 +#
   16.61 +# Logging
   16.62 +#
   16.63 +# CT_LOG_ERROR is not set
   16.64 +# CT_LOG_WARN is not set
   16.65 +# CT_LOG_INFO is not set
   16.66 +CT_LOG_EXTRA=y
   16.67 +# CT_LOG_DEBUG is not set
   16.68 +# CT_LOG_ALL is not set
   16.69 +CT_LOG_LEVEL_MAX="EXTRA"
   16.70 +# CT_LOG_SEE_TOOLS_WARN is not set
   16.71 +CT_LOG_PROGRESS_BAR=y
   16.72 +CT_LOG_TO_FILE=y
   16.73 +CT_LOG_FILE_COMPRESS=y
   16.74 +
   16.75 +#
   16.76 +# Target options
   16.77 +#
   16.78 +CT_ARCH="arm"
   16.79 +CT_ARCH_SUPPORT_ARCH=y
   16.80 +CT_ARCH_SUPPORT_ABI=y
   16.81 +CT_ARCH_SUPPORT_CPU=y
   16.82 +CT_ARCH_SUPPORT_TUNE=y
   16.83 +CT_ARCH_SUPPORT_FPU=y
   16.84 +CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
   16.85 +# CT_ARCH_DEFAULT_BE is not set
   16.86 +CT_ARCH_DEFAULT_LE=y
   16.87 +CT_ARCH_ARCH=""
   16.88 +CT_ARCH_ABI=""
   16.89 +CT_ARCH_CPU=""
   16.90 +CT_ARCH_TUNE=""
   16.91 +CT_ARCH_FPU=""
   16.92 +# CT_ARCH_BE is not set
   16.93 +CT_ARCH_LE=y
   16.94 +CT_ARCH_FLOAT_HW=y
   16.95 +# CT_ARCH_FLOAT_SW is not set
   16.96 +CT_TARGET_CFLAGS=""
   16.97 +CT_TARGET_LDFLAGS=""
   16.98 +
   16.99 +#
  16.100 +# General target options
  16.101 +#
  16.102 +CT_BARE_METAL=y
  16.103 +# CT_ARCH_alpha is not set
  16.104 +CT_ARCH_arm=y
  16.105 +# CT_ARCH_ARM_EABI is not set
  16.106 +CT_ARCH_ARM_ABI_OK=y
  16.107 +# CT_ARCH_ia64 is not set
  16.108 +# CT_ARCH_mips is not set
  16.109 +# CT_ARCH_powerpc is not set
  16.110 +# CT_ARCH_sh is not set
  16.111 +# CT_ARCH_x86 is not set
  16.112 +# CT_ARCH_x86_64 is not set
  16.113 +
  16.114 +#
  16.115 +# Target optimisations
  16.116 +#
  16.117 +
  16.118 +#
  16.119 +# Toolchain options
  16.120 +#
  16.121 +
  16.122 +#
  16.123 +# General toolchain options
  16.124 +#
  16.125 +CT_USE_SYSROOT=y
  16.126 +CT_TARGET_VENDOR="unknown"
  16.127 +CT_TARGET_ALIAS_SED_EXPR=""
  16.128 +CT_TARGET_ALIAS=""
  16.129 +
  16.130 +#
  16.131 +# Toolchain type
  16.132 +#
  16.133 +# CT_NATIVE is not set
  16.134 +CT_CROSS=y
  16.135 +# CT_CROSS_NATIVE is not set
  16.136 +# CT_CANADIAN is not set
  16.137 +CT_TOOLCHAIN_TYPE="cross"
  16.138 +CT_BUILD=""
  16.139 +CT_CC_NATIVE="gcc"
  16.140 +CT_KERNEL="none"
  16.141 +
  16.142 +#
  16.143 +# GMP and MPFR
  16.144 +#
  16.145 +CT_GMP_MPFR=y
  16.146 +CT_GMP_V_4_2_2=y
  16.147 +CT_GMP_VERSION="4.2.2"
  16.148 +CT_GMP_CHECK=y
  16.149 +CT_MPFR_V_2_3_1=y
  16.150 +CT_MPFR_VERSION="2.3.1"
  16.151 +CT_MPFR_CHECK=y
  16.152 +
  16.153 +#
  16.154 +# binutils
  16.155 +#
  16.156 +CT_BINUTILS_VERSION="2.18"
  16.157 +# CT_BINUTILS_V_2_14 is not set
  16.158 +# CT_BINUTILS_V_2_15 is not set
  16.159 +# CT_BINUTILS_V_2_16_1 is not set
  16.160 +# CT_BINUTILS_V_2_17 is not set
  16.161 +CT_BINUTILS_V_2_18=y
  16.162 +# CT_BINUTILS_V_2_18_50_0_4 is not set
  16.163 +# CT_BINUTILS_V_2_18_50_0_6 is not set
  16.164 +# CT_BINUTILS_V_2_18_50_0_7 is not set
  16.165 +# CT_BINUTILS_V_2_18_50_0_8 is not set
  16.166 +CT_BINUTILS_EXTRA_CONFIG=""
  16.167 +
  16.168 +#
  16.169 +# C compiler
  16.170 +#
  16.171 +CT_CC_GCC=y
  16.172 +CT_CC_VERSION="4.3.1"
  16.173 +CT_CC="gcc"
  16.174 +# CT_CC_V_2_95_3 is not set
  16.175 +# CT_CC_V_3_2_3 is not set
  16.176 +# CT_CC_V_3_3_6 is not set
  16.177 +# CT_CC_V_3_4_6 is not set
  16.178 +# CT_CC_V_4_0_0 is not set
  16.179 +# CT_CC_V_4_0_1 is not set
  16.180 +# CT_CC_V_4_0_2 is not set
  16.181 +# CT_CC_V_4_0_3 is not set
  16.182 +# CT_CC_V_4_0_4 is not set
  16.183 +# CT_CC_V_4_1_0 is not set
  16.184 +# CT_CC_V_4_1_1 is not set
  16.185 +# CT_CC_V_4_1_2 is not set
  16.186 +# CT_CC_V_4_2_0 is not set
  16.187 +# CT_CC_V_4_2_1 is not set
  16.188 +# CT_CC_V_4_2_2 is not set
  16.189 +# CT_CC_V_4_2_3 is not set
  16.190 +# CT_CC_V_4_2_4 is not set
  16.191 +# CT_CC_V_4_3_0 is not set
  16.192 +CT_CC_V_4_3_1=y
  16.193 +CT_CC_GCC_4_3_or_later=y
  16.194 +CT_CC_CORE_EXTRA_CONFIG=""
  16.195 +CT_CC_PKGVERSION="crosstool-NG-${CT_VERSION}"
  16.196 +CT_CC_BUGURL=""
  16.197 +CT_CC_SUPPORT_CXX=y
  16.198 +CT_CC_SUPPORT_FORTRAN=y
  16.199 +CT_CC_SUPPORT_JAVA=y
  16.200 +CT_CC_SUPPORT_ADA=y
  16.201 +CT_CC_SUPPORT_OBJC=y
  16.202 +CT_CC_SUPPORT_OBJCXX=y
  16.203 +
  16.204 +#
  16.205 +# Only C language supported on bare metal
  16.206 +#
  16.207 +CT_LIBC="none"
  16.208 +
  16.209 +#
  16.210 +# Tools facilities
  16.211 +#
  16.212 +# CT_SSTRIP is not set
  16.213 +
  16.214 +#
  16.215 +# Debug facilities
  16.216 +#
  16.217 +CT_GDB=y
  16.218 +CT_GDB_CROSS=y
  16.219 +# CT_GDB_CROSS_STATIC is not set
  16.220 +# CT_GDB_CROSS_INSIGHT is not set
  16.221 +# CT_GDB_V_snapshot is not set
  16.222 +# CT_GDB_V_6_4 is not set
  16.223 +# CT_GDB_V_6_5 is not set
  16.224 +# CT_GDB_V_6_6 is not set
  16.225 +# CT_GDB_V_6_7 is not set
  16.226 +# CT_GDB_V_6_7_1 is not set
  16.227 +CT_GDB_V_6_8=y
  16.228 +CT_GDB_VERSION="6.8"
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/scripts/build/cc/gcc.sh	Sun Sep 14 16:21:07 2008 +0000
    17.3 @@ -0,0 +1,299 @@
    17.4 +# This file adds the function to build the gcc C compiler
    17.5 +        ${extra_config}                         \
    17.6 +# Copyright 2007 Yann E. MORIN
    17.7 +# Licensed under the GPL v2. See COPYING in the root of this package
    17.8 +
    17.9 +do_print_filename() {
   17.10 +    [ "${CT_CC}" = "gcc" ] || return 0
   17.11 +    echo "gcc-${CT_CC_VERSION}"
   17.12 +}
   17.13 +
   17.14 +# Download gcc
   17.15 +do_cc_get() {
   17.16 +    # Ah! gcc folks are kind of 'different': they store the tarballs in
   17.17 +    # subdirectories of the same name! That's because gcc is such /crap/ that
   17.18 +    # it is such /big/ that it needs being splitted for distribution! Sad. :-(
   17.19 +    # Arrgghh! Some of those versions does not follow this convention:
   17.20 +    # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
   17.21 +    # subdirectory! You bastard!
   17.22 +    CT_GetFile "${CT_CC_FILE}"  \
   17.23 +               {ftp,http}://ftp.gnu.org/gnu/gcc{,{,/releases}/${CT_CC_FILE}}
   17.24 +}
   17.25 +
   17.26 +# Extract gcc
   17.27 +do_cc_extract() {
   17.28 +    CT_ExtractAndPatch "${CT_CC_FILE}"
   17.29 +}
   17.30 +
   17.31 +#------------------------------------------------------------------------------
   17.32 +# Core gcc pass 1
   17.33 +do_cc_core_pass_1() {
   17.34 +    # If we're building for bare metal, build the static core gcc,
   17.35 +    # with libgcc.
   17.36 +    # In case we're not bare metal, and we're NPTL, build the static core gcc.
   17.37 +    # In any other case, do nothing.
   17.38 +    case "${CT_BARE_METAL},${CT_THREADS}" in
   17.39 +        y,*)    do_cc_core mode=baremetal build_libgcc=yes;;
   17.40 +        ,nptl)  do_cc_core mode=static build_libgcc=no;;
   17.41 +        *)      ;;
   17.42 +    esac
   17.43 +}
   17.44 +
   17.45 +# Core gcc pass 2
   17.46 +do_cc_core_pass_2() {
   17.47 +    # In case we're building for bare metal, do nothing, we already have
   17.48 +    # our compiler.
   17.49 +    # In case we're NPTL, build the shared core gcc.
   17.50 +    # In any other case, build the static core gcc and the target libgcc.
   17.51 +    case "${CT_BARE_METAL},${CT_THREADS}" in
   17.52 +        y,*)    ;;
   17.53 +        ,nptl)  do_cc_core mode=shared build_libgcc=yes;;
   17.54 +        *)      do_cc_core mode=static build_libgcc=yes;;
   17.55 +    esac
   17.56 +}
   17.57 +
   17.58 +#------------------------------------------------------------------------------
   17.59 +# Build core gcc
   17.60 +# This function is used to build both the static and the shared core C conpiler,
   17.61 +# with or without the target libgcc. We need to know wether:
   17.62 +#  - we're building static, shared or bare metal: mode=[static|shared|baremetal]
   17.63 +#  - we need to build libgcc or not             : build_libgcc=[yes|no]
   17.64 +# Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no]
   17.65 +do_cc_core() {
   17.66 +    local mode
   17.67 +    local build_libgcc
   17.68 +    local core_prefix_dir
   17.69 +    local extra_config
   17.70 +
   17.71 +    eval $1
   17.72 +    eval $2
   17.73 +    CT_TestOrAbort "Internal Error: 'mode' must either 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared" -o "${mode}" = "baremetal"
   17.74 +    CT_TestOrAbort "Internal Error: 'build_libgcc' must be either 'yes' or 'no', not '${build_libgcc:-(empty)}'" "${build_libgcc}" = "yes" -o "${build_libgcc}" = "no"
   17.75 +    # In normal conditions, ( "${mode}" = "shared" ) implies
   17.76 +    # ( "${build_libgcc}" = "yes" ), but I won't check for that
   17.77 +
   17.78 +    mkdir -p "${CT_BUILD_DIR}/build-cc-core-${mode}"
   17.79 +    cd "${CT_BUILD_DIR}/build-cc-core-${mode}"
   17.80 +
   17.81 +    CT_DoStep INFO "Installing ${mode} core C compiler"
   17.82 +    case "${mode}" in
   17.83 +        static)
   17.84 +            core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
   17.85 +            extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
   17.86 +            copy_headers=y
   17.87 +            ;;
   17.88 +        shared)
   17.89 +            core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
   17.90 +            extra_config="${extra_config} --enable-shared"
   17.91 +            copy_headers=y
   17.92 +            ;;
   17.93 +        baremetal)
   17.94 +            core_prefix_dir="${CT_PREFIX_DIR}"
   17.95 +            extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
   17.96 +            copy_headers=n
   17.97 +            ;;
   17.98 +    esac
   17.99 +
  17.100 +    if [ "${copy_headers}" = "y" ]; then
  17.101 +        CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
  17.102 +        CT_DoExecLog ALL mkdir -p "${core_prefix_dir}/${CT_TARGET}/include"
  17.103 +        CT_DoExecLog ALL cp -r "${CT_HEADERS_DIR}"/* "${core_prefix_dir}/${CT_TARGET}/include"
  17.104 +    fi
  17.105 +
  17.106 +    CT_DoLog EXTRA "Configuring ${mode} core C compiler"
  17.107 +
  17.108 +    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
  17.109 +    extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
  17.110 +    extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
  17.111 +    extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
  17.112 +    extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
  17.113 +    extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
  17.114 +    [ "${CT_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
  17.115 +    if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
  17.116 +        extra_config="${extra_config} --enable-__cxa_atexit"
  17.117 +    else
  17.118 +        extra_config="${extra_config} --disable-__cxa_atexit"
  17.119 +    fi
  17.120 +
  17.121 +    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
  17.122 +
  17.123 +    # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
  17.124 +    CC_FOR_BUILD="${CT_CC_NATIVE}"                  \
  17.125 +    CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
  17.126 +    CT_DoExecLog ALL                                \
  17.127 +    "${CT_SRC_DIR}/${CT_CC_FILE}/configure"         \
  17.128 +        ${CT_CANADIAN_OPT}                          \
  17.129 +        --host=${CT_HOST}                           \
  17.130 +        --target=${CT_TARGET}                       \
  17.131 +        --prefix="${core_prefix_dir}"               \
  17.132 +        --with-local-prefix="${CT_SYSROOT_DIR}"     \
  17.133 +        --disable-multilib                          \
  17.134 +        ${CC_CORE_SYSROOT_ARG}                      \
  17.135 +        ${extra_config}                             \
  17.136 +        --disable-nls                               \
  17.137 +        --enable-symvers=gnu                        \
  17.138 +        --enable-languages=c                        \
  17.139 +        --enable-target-optspace                    \
  17.140 +        ${CT_CC_CORE_EXTRA_CONFIG}
  17.141 +
  17.142 +    if [ "${build_libgcc}" = "yes" ]; then
  17.143 +        # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or
  17.144 +        # gcc/config/t-libunwind so -lc is removed from the link for
  17.145 +        # libgcc_s.so, as we do not have a target -lc yet.
  17.146 +        # This is not as ugly as it appears to be ;-) All symbols get resolved
  17.147 +        # during the glibc build, and we provide a proper libgcc_s.so for the
  17.148 +        # cross toolchain during the final gcc build.
  17.149 +        #
  17.150 +        # As we cannot modify the source tree, nor override SHLIB_LC itself
  17.151 +        # during configure or make, we have to edit the resultant
  17.152 +        # gcc/libgcc.mk itself to remove -lc from the link.
  17.153 +        # This causes us to have to jump through some hoops...
  17.154 +        #
  17.155 +        # To produce libgcc.mk to edit we firstly require libiberty.a,
  17.156 +        # so we configure then build it.
  17.157 +        # Next we have to configure gcc, create libgcc.mk then edit it...
  17.158 +        # So much easier if we just edit the source tree, but hey...
  17.159 +        if [ ! -f "${CT_SRC_DIR}/${CT_CC_FILE}/gcc/BASE-VER" ]; then
  17.160 +            CT_DoExecLog ALL make configure-libiberty
  17.161 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a
  17.162 +            CT_DoExecLog ALL make configure-gcc configure-libcpp
  17.163 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp
  17.164 +        else
  17.165 +            CT_DoExecLog ALL make configure-gcc configure-libcpp configure-build-libiberty
  17.166 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp all-build-libiberty
  17.167 +        fi
  17.168 +        # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here.
  17.169 +        if [ -d "${CT_SRC_DIR}/${CT_CC_FILE}/libdecnumber" ]; then
  17.170 +            CT_DoExecLog ALL make configure-libdecnumber
  17.171 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libdecnumber libdecnumber.a
  17.172 +        fi
  17.173 +
  17.174 +        # Starting with GCC 4.3, libgcc.mk is no longer built,
  17.175 +        # and libgcc.mvars is used instead.
  17.176 +
  17.177 +        gcc_version_major=$(echo ${CT_CC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  17.178 +        gcc_version_minor=$(echo ${CT_CC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  17.179 +
  17.180 +        if [    ${gcc_version_major} -eq 4 -a ${gcc_version_minor} -ge 3    \
  17.181 +             -o ${gcc_version_major} -gt 4                                  ]; then
  17.182 +            libgcc_rule="libgcc.mvars"
  17.183 +            build_rules="all-gcc all-target-libgcc"
  17.184 +            install_rules="install-gcc install-target-libgcc"
  17.185 +        else
  17.186 +            libgcc_rule="libgcc.mk"
  17.187 +            build_rules="all-gcc"
  17.188 +            install_rules="install-gcc"
  17.189 +        fi
  17.190 +
  17.191 +        CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule}
  17.192 +        sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule}
  17.193 +    else # build_libgcc
  17.194 +            build_rules="all-gcc"
  17.195 +            install_rules="install-gcc"
  17.196 +    fi   # ! build libgcc
  17.197 +
  17.198 +    if [ "${CT_CANADIAN}" = "y" ]; then
  17.199 +        CT_DoLog EXTRA "Building libiberty"
  17.200 +        CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
  17.201 +    fi
  17.202 +
  17.203 +    CT_DoLog EXTRA "Building ${mode} core C compiler"
  17.204 +    CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_rules}
  17.205 +
  17.206 +    CT_DoLog EXTRA "Installing ${mode} core C compiler"
  17.207 +    CT_DoExecLog ALL make ${install_rules}
  17.208 +
  17.209 +    CT_EndStep
  17.210 +}
  17.211 +
  17.212 +#------------------------------------------------------------------------------
  17.213 +# Build final gcc
  17.214 +do_cc() {
  17.215 +    # If building for bare metal, nothing to be done here, the static core conpiler is enough!
  17.216 +    [ "${CT_BARE_METAL}" = "y" ] && return 0
  17.217 +
  17.218 +    CT_DoStep INFO "Installing final compiler"
  17.219 +
  17.220 +    mkdir -p "${CT_BUILD_DIR}/build-cc"
  17.221 +    cd "${CT_BUILD_DIR}/build-cc"
  17.222 +
  17.223 +    CT_DoLog EXTRA "Configuring final compiler"
  17.224 +
  17.225 +    # Enable selected languages
  17.226 +    lang_opt="c"
  17.227 +    [ "${CT_CC_LANG_CXX}" = "y"      ] && lang_opt="${lang_opt},c++"
  17.228 +    [ "${CT_CC_LANG_FORTRAN}" = "y"  ] && lang_opt="${lang_opt},fortran"
  17.229 +    [ "${CT_CC_LANG_ADA}" = "y"      ] && lang_opt="${lang_opt},ada"
  17.230 +    [ "${CT_CC_LANG_JAVA}" = "y"     ] && lang_opt="${lang_opt},java"
  17.231 +    [ "${CT_CC_LANG_OBJC}" = "y"     ] && lang_opt="${lang_opt},objc"
  17.232 +    [ "${CT_CC_LANG_OBJCXX}" = "y"   ] && lang_opt="${lang_opt},obj-c++"
  17.233 +    CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
  17.234 +    CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
  17.235 +    CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
  17.236 +    CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
  17.237 +    lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
  17.238 +
  17.239 +    extra_config="--enable-languages=${lang_opt}"
  17.240 +    extra_config="${extra_config} --disable-multilib"
  17.241 +    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
  17.242 +    extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
  17.243 +    extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
  17.244 +    extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
  17.245 +    extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
  17.246 +    extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
  17.247 +    [ "${CT_SHARED_LIBS}" = "y" ]                   || extra_config="${extra_config} --disable-shared"
  17.248 +    [ "${CT_GMP_MPFR}" = "y" ]                      && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
  17.249 +    [ -n "${CT_CC_PKGVERSION}" ]                    && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
  17.250 +    [ -n "${CT_CC_BUGURL}" ]                        && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
  17.251 +    [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ]        && extra_config="${extra_config} --enable-sjlj-exceptions"
  17.252 +    [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ]   && extra_config="${extra_config} --disable-sjlj-exceptions"
  17.253 +    if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
  17.254 +        extra_config="${extra_config} --enable-__cxa_atexit"
  17.255 +    else
  17.256 +        extra_config="${extra_config} --disable-__cxa_atexit"
  17.257 +    fi
  17.258 +
  17.259 +    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
  17.260 +
  17.261 +    # --enable-symvers=gnu really only needed for sh4 to work around a
  17.262 +    # detection problem only matters for gcc-3.2.x and later, I think.
  17.263 +    # --disable-nls to work around crash bug on ppc405, but also because
  17.264 +    # embedded systems don't really need message catalogs...
  17.265 +    CC_FOR_BUILD="${CT_CC_NATIVE}"              \
  17.266 +    CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
  17.267 +    CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"     \
  17.268 +    CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"   \
  17.269 +    LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}"   \
  17.270 +    CT_DoExecLog ALL                            \
  17.271 +    "${CT_SRC_DIR}/${CT_CC_FILE}/configure"     \
  17.272 +        ${CT_CANADIAN_OPT}                      \
  17.273 +        --target=${CT_TARGET} --host=${CT_HOST} \
  17.274 +        --prefix="${CT_PREFIX_DIR}"             \
  17.275 +        ${CC_SYSROOT_ARG}                       \
  17.276 +        ${extra_config}                         \
  17.277 +        --with-local-prefix="${CT_SYSROOT_DIR}" \
  17.278 +        --disable-nls                           \
  17.279 +        --enable-threads=posix                  \
  17.280 +        --enable-symvers=gnu                    \
  17.281 +        --enable-c99                            \
  17.282 +        --enable-long-long                      \
  17.283 +        --enable-target-optspace                \
  17.284 +        ${CT_CC_EXTRA_CONFIG}
  17.285 +
  17.286 +    if [ "${CT_CANADIAN}" = "y" ]; then
  17.287 +        CT_DoLog EXTRA "Building libiberty"
  17.288 +        CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
  17.289 +    fi
  17.290 +
  17.291 +    CT_DoLog EXTRA "Building final compiler"
  17.292 +    CT_DoExecLog ALL make ${PARALLELMFLAGS} all
  17.293 +
  17.294 +    CT_DoLog EXTRA "Installing final compiler"
  17.295 +    CT_DoExecLog ALL make install
  17.296 +
  17.297 +    # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
  17.298 +    # to call the C compiler with the same, somewhat canonical name.
  17.299 +    ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}"-{g,}cc 2>&1 |CT_DoLog ALL
  17.300 +
  17.301 +    CT_EndStep
  17.302 +}
    18.1 --- a/scripts/build/cc_gcc.sh	Thu Sep 11 09:02:00 2008 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,275 +0,0 @@
    18.4 -# This file adds the function to build the gcc C compiler
    18.5 -# Copyright 2007 Yann E. MORIN
    18.6 -# Licensed under the GPL v2. See COPYING in the root of this package
    18.7 -
    18.8 -do_print_filename() {
    18.9 -    [ "${CT_CC}" = "gcc" ] || return 0
   18.10 -    echo "gcc-${CT_CC_VERSION}"
   18.11 -}
   18.12 -
   18.13 -# Download gcc
   18.14 -do_cc_get() {
   18.15 -    # Ah! gcc folks are kind of 'different': they store the tarballs in
   18.16 -    # subdirectories of the same name! That's because gcc is such /crap/ that
   18.17 -    # it is such /big/ that it needs being splitted for distribution! Sad. :-(
   18.18 -    # Arrgghh! Some of those versions does not follow this convention:
   18.19 -    # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
   18.20 -    # subdirectory! You bastard!
   18.21 -    CT_GetFile "${CT_CC_FILE}"  \
   18.22 -               {ftp,http}://ftp.gnu.org/gnu/gcc{,{,/releases}/${CT_CC_FILE}}
   18.23 -}
   18.24 -
   18.25 -# Extract gcc
   18.26 -do_cc_extract() {
   18.27 -    CT_ExtractAndPatch "${CT_CC_FILE}"
   18.28 -}
   18.29 -
   18.30 -#------------------------------------------------------------------------------
   18.31 -# Core gcc pass 1
   18.32 -do_cc_core_pass_1() {
   18.33 -    # In case we're NPTL, build the static core gcc;
   18.34 -    # in any other case, do nothing.
   18.35 -    case "${CT_THREADS}" in
   18.36 -        nptl)   do_cc_core mode=static build_libgcc=no;;
   18.37 -        *)      ;;
   18.38 -    esac
   18.39 -}
   18.40 -
   18.41 -# Core gcc pass 2
   18.42 -do_cc_core_pass_2() {
   18.43 -    # In case we're NPTL, build the shared core gcc,
   18.44 -    # in any other case, build the static core gcc and the target libgcc.
   18.45 -    case "${CT_THREADS}" in
   18.46 -        nptl)   do_cc_core mode=shared build_libgcc=yes;;
   18.47 -        *)      do_cc_core mode=static build_libgcc=yes;;
   18.48 -    esac
   18.49 -}
   18.50 -
   18.51 -#------------------------------------------------------------------------------
   18.52 -# Build core gcc
   18.53 -# This function is used to build both the static and the shared core C conpiler,
   18.54 -# with or without the target libgcc. We need to know wether:
   18.55 -#  - we're building static or shared: mode=[static|shared]
   18.56 -#  - we need to build libgcc or not:  build_libgcc=[yes|no]
   18.57 -# Usage: do_cc_core_static mode=[static|shared] build_libgcc=[yes|no]
   18.58 -do_cc_core() {
   18.59 -    local mode
   18.60 -    local build_libgcc
   18.61 -    local core_prefix_dir
   18.62 -    local extra_config
   18.63 -
   18.64 -    eval $1
   18.65 -    eval $2
   18.66 -    CT_TestOrAbort "Internal Error: 'mode' must either 'static' or 'shared', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared"
   18.67 -    CT_TestOrAbort "Internal Error: 'build_libgcc' must be either 'yes' or 'no', not '${build_libgcc:-(empty)}'" "${build_libgcc}" = "yes" -o "${build_libgcc}" = "no"
   18.68 -    # In normal conditions, ( "${mode}" = "shared" ) implies
   18.69 -    # ( "${build_libgcc}" = "yes" ), but I won't check for that
   18.70 -
   18.71 -    mkdir -p "${CT_BUILD_DIR}/build-cc-core-${mode}"
   18.72 -    cd "${CT_BUILD_DIR}/build-cc-core-${mode}"
   18.73 -
   18.74 -    CT_DoStep INFO "Installing ${mode} core C compiler"
   18.75 -    case "${mode}" in
   18.76 -        static)
   18.77 -            core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
   18.78 -            extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
   18.79 -            ;;
   18.80 -        shared)
   18.81 -            core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
   18.82 -            extra_config="${extra_config} --enable-shared"
   18.83 -            ;;
   18.84 -    esac
   18.85 -
   18.86 -    CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
   18.87 -    CT_DoExecLog ALL mkdir -p "${core_prefix_dir}/${CT_TARGET}/include"
   18.88 -    CT_DoExecLog ALL cp -r "${CT_HEADERS_DIR}"/* "${core_prefix_dir}/${CT_TARGET}/include"
   18.89 -
   18.90 -    CT_DoLog EXTRA "Configuring ${mode} core C compiler"
   18.91 -
   18.92 -    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
   18.93 -    extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
   18.94 -    extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
   18.95 -    extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
   18.96 -    extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
   18.97 -    extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
   18.98 -    [ "${CT_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
   18.99 -    if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
  18.100 -        extra_config="${extra_config} --enable-__cxa_atexit"
  18.101 -    else
  18.102 -        extra_config="${extra_config} --disable-__cxa_atexit"
  18.103 -    fi
  18.104 -
  18.105 -    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
  18.106 -
  18.107 -    # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
  18.108 -    CC_FOR_BUILD="${CT_CC_NATIVE}"                  \
  18.109 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
  18.110 -    CT_DoExecLog ALL                                \
  18.111 -    "${CT_SRC_DIR}/${CT_CC_FILE}/configure"         \
  18.112 -        ${CT_CANADIAN_OPT}                          \
  18.113 -        --host=${CT_HOST}                           \
  18.114 -        --target=${CT_TARGET}                       \
  18.115 -        --prefix="${core_prefix_dir}"               \
  18.116 -        --with-local-prefix="${CT_SYSROOT_DIR}"     \
  18.117 -        --disable-multilib                          \
  18.118 -        ${CC_CORE_SYSROOT_ARG}                      \
  18.119 -        ${extra_config}                             \
  18.120 -        --disable-nls                               \
  18.121 -        --enable-symvers=gnu                        \
  18.122 -        --enable-languages=c                        \
  18.123 -        --enable-target-optspace                    \
  18.124 -        ${CT_CC_CORE_EXTRA_CONFIG}
  18.125 -
  18.126 -    if [ "${build_libgcc}" = "yes" ]; then
  18.127 -        # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or
  18.128 -        # gcc/config/t-libunwind so -lc is removed from the link for
  18.129 -        # libgcc_s.so, as we do not have a target -lc yet.
  18.130 -        # This is not as ugly as it appears to be ;-) All symbols get resolved
  18.131 -        # during the glibc build, and we provide a proper libgcc_s.so for the
  18.132 -        # cross toolchain during the final gcc build.
  18.133 -        #
  18.134 -        # As we cannot modify the source tree, nor override SHLIB_LC itself
  18.135 -        # during configure or make, we have to edit the resultant
  18.136 -        # gcc/libgcc.mk itself to remove -lc from the link.
  18.137 -        # This causes us to have to jump through some hoops...
  18.138 -        #
  18.139 -        # To produce libgcc.mk to edit we firstly require libiberty.a,
  18.140 -        # so we configure then build it.
  18.141 -        # Next we have to configure gcc, create libgcc.mk then edit it...
  18.142 -        # So much easier if we just edit the source tree, but hey...
  18.143 -        if [ ! -f "${CT_SRC_DIR}/${CT_CC_FILE}/gcc/BASE-VER" ]; then
  18.144 -            CT_DoExecLog ALL make configure-libiberty
  18.145 -            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a
  18.146 -            CT_DoExecLog ALL make configure-gcc configure-libcpp
  18.147 -            CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp
  18.148 -        else
  18.149 -            CT_DoExecLog ALL make configure-gcc configure-libcpp configure-build-libiberty
  18.150 -            CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp all-build-libiberty
  18.151 -        fi
  18.152 -        # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here.
  18.153 -        if [ -d "${CT_SRC_DIR}/${CT_CC_FILE}/libdecnumber" ]; then
  18.154 -            CT_DoExecLog ALL make configure-libdecnumber
  18.155 -            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libdecnumber libdecnumber.a
  18.156 -        fi
  18.157 -
  18.158 -        # Starting with GCC 4.3, libgcc.mk is no longer built,
  18.159 -        # and libgcc.mvars is used instead.
  18.160 -
  18.161 -        gcc_version_major=$(echo ${CT_CC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  18.162 -        gcc_version_minor=$(echo ${CT_CC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  18.163 -
  18.164 -        if [    ${gcc_version_major} -eq 4 -a ${gcc_version_minor} -ge 3    \
  18.165 -             -o ${gcc_version_major} -gt 4                                  ]; then
  18.166 -            libgcc_rule="libgcc.mvars"
  18.167 -            build_rules="all-gcc all-target-libgcc"
  18.168 -            install_rules="install-gcc install-target-libgcc"
  18.169 -        else
  18.170 -            libgcc_rule="libgcc.mk"
  18.171 -            build_rules="all-gcc"
  18.172 -            install_rules="install-gcc"
  18.173 -        fi
  18.174 -
  18.175 -        CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule}
  18.176 -        sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule}
  18.177 -    else # build_libgcc
  18.178 -            build_rules="all-gcc"
  18.179 -            install_rules="install-gcc"
  18.180 -    fi   # ! build libgcc
  18.181 -
  18.182 -    if [ "${CT_CANADIAN}" = "y" ]; then
  18.183 -        CT_DoLog EXTRA "Building libiberty"
  18.184 -        CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
  18.185 -    fi
  18.186 -
  18.187 -    CT_DoLog EXTRA "Building ${mode} core C compiler"
  18.188 -    CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_rules}
  18.189 -
  18.190 -    CT_DoLog EXTRA "Installing ${mode} core C compiler"
  18.191 -    CT_DoExecLog ALL make ${install_rules}
  18.192 -
  18.193 -    CT_EndStep
  18.194 -}
  18.195 -
  18.196 -#------------------------------------------------------------------------------
  18.197 -# Build final gcc
  18.198 -do_cc() {
  18.199 -    CT_DoStep INFO "Installing final compiler"
  18.200 -
  18.201 -    mkdir -p "${CT_BUILD_DIR}/build-cc"
  18.202 -    cd "${CT_BUILD_DIR}/build-cc"
  18.203 -
  18.204 -    CT_DoLog EXTRA "Configuring final compiler"
  18.205 -
  18.206 -    # Enable selected languages
  18.207 -    lang_opt="c"
  18.208 -    [ "${CT_CC_LANG_CXX}" = "y"      ] && lang_opt="${lang_opt},c++"
  18.209 -    [ "${CT_CC_LANG_FORTRAN}" = "y"  ] && lang_opt="${lang_opt},fortran"
  18.210 -    [ "${CT_CC_LANG_ADA}" = "y"      ] && lang_opt="${lang_opt},ada"
  18.211 -    [ "${CT_CC_LANG_JAVA}" = "y"     ] && lang_opt="${lang_opt},java"
  18.212 -    [ "${CT_CC_LANG_OBJC}" = "y"     ] && lang_opt="${lang_opt},objc"
  18.213 -    [ "${CT_CC_LANG_OBJCXX}" = "y"   ] && lang_opt="${lang_opt},obj-c++"
  18.214 -    CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
  18.215 -    CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
  18.216 -    CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
  18.217 -    CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
  18.218 -    lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
  18.219 -
  18.220 -    extra_config="--enable-languages=${lang_opt}"
  18.221 -    extra_config="${extra_config} --disable-multilib"
  18.222 -    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
  18.223 -    [ "${CT_SHARED_LIBS}" = "y" ]     || extra_config="${extra_config} --disable-shared"
  18.224 -    [ "${CT_GMP_MPFR}" = "y" ]                      && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
  18.225 -    [ -n "${CT_CC_PKGVERSION}" ]                    && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
  18.226 -    [ -n "${CT_CC_BUGURL}" ]                        && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
  18.227 -    [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ]        && extra_config="${extra_config} --enable-sjlj-exceptions"
  18.228 -    [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ]   && extra_config="${extra_config} --disable-sjlj-exceptions"
  18.229 -    if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
  18.230 -        extra_config="${extra_config} --enable-__cxa_atexit"
  18.231 -    else
  18.232 -        extra_config="${extra_config} --disable-__cxa_atexit"
  18.233 -    fi
  18.234 -
  18.235 -    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
  18.236 -
  18.237 -    # --enable-symvers=gnu really only needed for sh4 to work around a
  18.238 -    # detection problem only matters for gcc-3.2.x and later, I think.
  18.239 -    # --disable-nls to work around crash bug on ppc405, but also because
  18.240 -    # embedded systems don't really need message catalogs...
  18.241 -    CC_FOR_BUILD="${CT_CC_NATIVE}"              \
  18.242 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
  18.243 -    CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"     \
  18.244 -    CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"   \
  18.245 -    LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}"   \
  18.246 -    CT_DoExecLog ALL                            \
  18.247 -    "${CT_SRC_DIR}/${CT_CC_FILE}/configure"     \
  18.248 -        ${CT_CANADIAN_OPT}                      \
  18.249 -        --target=${CT_TARGET} --host=${CT_HOST} \
  18.250 -        --prefix="${CT_PREFIX_DIR}"             \
  18.251 -        ${CC_SYSROOT_ARG}                       \
  18.252 -        ${extra_config}                         \
  18.253 -        --with-local-prefix="${CT_SYSROOT_DIR}" \
  18.254 -        --disable-nls                           \
  18.255 -        --enable-threads=posix                  \
  18.256 -        --enable-symvers=gnu                    \
  18.257 -        --enable-c99                            \
  18.258 -        --enable-long-long                      \
  18.259 -        --enable-target-optspace                \
  18.260 -        ${CT_CC_EXTRA_CONFIG}
  18.261 -
  18.262 -    if [ "${CT_CANADIAN}" = "y" ]; then
  18.263 -        CT_DoLog EXTRA "Building libiberty"
  18.264 -        CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
  18.265 -    fi
  18.266 -
  18.267 -    CT_DoLog EXTRA "Building final compiler"
  18.268 -    CT_DoExecLog ALL make ${PARALLELMFLAGS} all
  18.269 -
  18.270 -    CT_DoLog EXTRA "Installing final compiler"
  18.271 -    CT_DoExecLog ALL make install
  18.272 -
  18.273 -    # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
  18.274 -    # to call the C compiler with the same, somewhat canonical name.
  18.275 -    ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}"-{g,}cc 2>&1 |CT_DoLog ALL
  18.276 -
  18.277 -    CT_EndStep
  18.278 -}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/scripts/build/kernel/none.sh	Sun Sep 14 16:21:07 2008 +0000
    19.3 @@ -0,0 +1,19 @@
    19.4 +# This file declares functions for bare metal kernel (IE. none)
    19.5 +# Copyright 2008 Yann E. MORIN
    19.6 +# Licensed under the GPL v2. See COPYING in the root of this package
    19.7 +
    19.8 +do_print_filename() {
    19.9 +    :
   19.10 +}
   19.11 +
   19.12 +do_kernel_get() {
   19.13 +    :
   19.14 +}
   19.15 +
   19.16 +do_kernel_extract() {
   19.17 +    :
   19.18 +}
   19.19 +
   19.20 +do_kernel_headers() {
   19.21 +    :
   19.22 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/scripts/build/libc/eglibc.sh	Sun Sep 14 16:21:07 2008 +0000
    20.3 @@ -0,0 +1,283 @@
    20.4 +# eglibc build functions (initially by Thomas JOURDAN).
    20.5 +
    20.6 +do_print_filename() {
    20.7 +    [ "${CT_LIBC}" = "eglibc" ] || return 0
    20.8 +    echo "eglibc-${CT_LIBC_VERSION}"
    20.9 +    for addon in $(do_libc_add_ons_list " "); do
   20.10 +        # NPTL addon is not to be downloaded, in any case
   20.11 +        [ "${addon}" = "nptl" ] && continue || true
   20.12 +        echo "eglibc-${addon}-${CT_LIBC_VERSION}"
   20.13 +    done
   20.14 +}
   20.15 +
   20.16 +# Download eglibc repository
   20.17 +do_eglibc_get() {
   20.18 +    CT_HasOrAbort svn
   20.19 +
   20.20 +    case "${CT_LIBC_VERSION}" in
   20.21 +        trunk)  svn_url="svn://svn.eglibc.org/trunk";;
   20.22 +        *)      svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
   20.23 +    esac
   20.24 +
   20.25 +    CT_MktempDir tmp_dir
   20.26 +    CT_Pushd "${tmp_dir}"
   20.27 +
   20.28 +    case "${CT_EGLIBC_CHECKOUT}" in
   20.29 +        y)  svn_action="checkout";;
   20.30 +        *)  svn_action="export --force";;
   20.31 +    esac
   20.32 +
   20.33 +    CT_DoSetProxy ${CT_PROXY_TYPE}
   20.34 +    CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
   20.35 +
   20.36 +    # Compress eglibc
   20.37 +    CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
   20.38 +    CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
   20.39 +
   20.40 +    # Compress linuxthreads, localedef and ports
   20.41 +    # Assign them the name the way ct-ng like it
   20.42 +    for addon in linuxthreads localedef ports; do
   20.43 +        CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
   20.44 +    done
   20.45 +
   20.46 +    CT_Popd
   20.47 +
   20.48 +    # Remove source files
   20.49 +    CT_DoExecLog ALL rm -rf "${tmp_dir}"
   20.50 +}
   20.51 +
   20.52 +# Download glibc
   20.53 +do_libc_get() {
   20.54 +    # eglibc is only available through subversion, there are no
   20.55 +    # snapshots available. Moreover, addons will be downloaded
   20.56 +    # simultaneously.
   20.57 +
   20.58 +    # build filename
   20.59 +    eglibc="${CT_LIBC_FILE}.tar.bz2"
   20.60 +    eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
   20.61 +    eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
   20.62 +    eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
   20.63 +
   20.64 +    # Check if every tarballs are already present
   20.65 +    if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ]              && \
   20.66 +       [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
   20.67 +       [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ]    && \
   20.68 +       [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
   20.69 +        CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
   20.70 +        return 0
   20.71 +    fi
   20.72 +
   20.73 +    if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ]              && \
   20.74 +       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
   20.75 +       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ]    && \
   20.76 +       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ]        && \
   20.77 +       [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
   20.78 +        CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
   20.79 +        for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
   20.80 +            CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
   20.81 +        done
   20.82 +        return 0
   20.83 +    fi
   20.84 +
   20.85 +    # Not found locally, try from the network
   20.86 +    CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
   20.87 +    do_eglibc_get
   20.88 +
   20.89 +    if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
   20.90 +        CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
   20.91 +        for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
   20.92 +            CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
   20.93 +            CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
   20.94 +        done
   20.95 +    fi
   20.96 +
   20.97 +    return 0
   20.98 +}
   20.99 +
  20.100 +# Extract eglibc
  20.101 +do_libc_extract() {
  20.102 +    CT_ExtractAndPatch "${CT_LIBC_FILE}"
  20.103 +
  20.104 +    # C library addons
  20.105 +    for addon in $(do_libc_add_ons_list " "); do
  20.106 +        # NPTL addon is not to be extracted, in any case
  20.107 +        [ "${addon}" = "nptl" ] && continue || true
  20.108 +        CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
  20.109 +    done
  20.110 +
  20.111 +    return 0
  20.112 +}
  20.113 +
  20.114 +# There is nothing to do for eglibc check config
  20.115 +do_libc_check_config() {
  20.116 +    :
  20.117 +}
  20.118 +
  20.119 +# This function installs the glibc headers needed to build the core compiler
  20.120 +do_libc_headers() {
  20.121 +    # Instead of doing two time the same actions, headers will
  20.122 +    # be installed with start files
  20.123 +    :
  20.124 +}
  20.125 +
  20.126 +# Build and install start files
  20.127 +do_libc_start_files() {
  20.128 +    CT_DoStep INFO "Installing C library headers / start files"
  20.129 +
  20.130 +    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
  20.131 +    cd "${CT_BUILD_DIR}/build-libc-startfiles"
  20.132 +
  20.133 +    CT_DoLog EXTRA "Configuring C library"
  20.134 +
  20.135 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  20.136 +    cross_cxx=$(CT_Which "${CT_TARGET}-g++")
  20.137 +    cross_ar=$(CT_Which "${CT_TARGET}-ar")
  20.138 +    cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
  20.139 +    
  20.140 +    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
  20.141 +    CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
  20.142 +    CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
  20.143 +    CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
  20.144 +
  20.145 +    BUILD_CC=${CT_CC_NATIVE}                    \
  20.146 +    CC=${cross_cc}                              \
  20.147 +    CXX=${cross_cxx}                            \
  20.148 +    AR=${cross_ar}                              \
  20.149 +    RANLIB=${cross_ranlib}                      \
  20.150 +    CT_DoExecLog ALL                            \
  20.151 +    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"   \
  20.152 +        --prefix=/usr                           \
  20.153 +        --with-headers="${CT_HEADERS_DIR}"      \
  20.154 +        --build="${CT_UNIQ_BUILD}"              \
  20.155 +        --host="${CT_TARGET}"                   \
  20.156 +        --disable-profile                       \
  20.157 +        --without-gd                            \
  20.158 +        --without-cvs                           \
  20.159 +        --enable-add-ons
  20.160 +
  20.161 +    CT_DoLog EXTRA "Installing C library headers"
  20.162 +
  20.163 +    # use the 'install-headers' makefile target to install the
  20.164 +    # headers
  20.165 +
  20.166 +    CT_DoExecLog ALL                    \
  20.167 +    make install-headers                \
  20.168 +         install_root=${CT_SYSROOT_DIR} \
  20.169 +         install-bootstrap-headers=yes
  20.170 +
  20.171 +    CT_DoLog EXTRA "Installing C library start files"
  20.172 +
  20.173 +    # there are a few object files needed to link shared libraries,
  20.174 +    # which we build and install by hand
  20.175 +
  20.176 +    CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
  20.177 +    CT_DoExecLog ALL make csu/subdir_lib
  20.178 +    CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
  20.179 +        ${CT_SYSROOT_DIR}/usr/lib
  20.180 +
  20.181 +    # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.  
  20.182 +    # However, since we will never actually execute its code, 
  20.183 +    # it doesn't matter what it contains.  So, treating '/dev/null' 
  20.184 +    # as a C source file, we produce a dummy 'libc.so' in one step
  20.185 +
  20.186 +    CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
  20.187 +
  20.188 +    CT_EndStep
  20.189 +}
  20.190 +
  20.191 +# This function builds and install the full glibc
  20.192 +do_libc() {
  20.193 +    CT_DoStep INFO "Installing C library"
  20.194 +
  20.195 +    mkdir -p "${CT_BUILD_DIR}/build-libc"
  20.196 +    cd "${CT_BUILD_DIR}/build-libc"
  20.197 +
  20.198 +    CT_DoLog EXTRA "Configuring C library"
  20.199 +
  20.200 +    # Add some default glibc config options if not given by user.
  20.201 +    # We don't need to be conditional on wether the user did set different
  20.202 +    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
  20.203 +
  20.204 +    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  20.205 +
  20.206 +    case "${CT_THREADS}" in
  20.207 +        nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
  20.208 +        linuxthreads)   extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
  20.209 +        none)           extra_config="${extra_config} --without-__thread --without-nptl"
  20.210 +                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  20.211 +                            *-tls*) ;;
  20.212 +                            *) extra_config="${extra_config} --without-tls";;
  20.213 +                        esac
  20.214 +                        ;;
  20.215 +    esac
  20.216 +
  20.217 +    case "${CT_SHARED_LIBS}" in
  20.218 +        y) extra_config="${extra_config} --enable-shared";;
  20.219 +        *) extra_config="${extra_config} --disable-shared";;
  20.220 +    esac
  20.221 +
  20.222 +    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  20.223 +        y,) extra_config="${extra_config} --with-fp";;
  20.224 +        ,y) extra_config="${extra_config} --without-fp";;
  20.225 +    esac
  20.226 +
  20.227 +    case "$(do_libc_add_ons_list ,)" in
  20.228 +        "") ;;
  20.229 +        *)  extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
  20.230 +    esac
  20.231 +
  20.232 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  20.233 +
  20.234 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")    
  20.235 +
  20.236 +    CT_DoLog DEBUG "Using gcc for target:     '${cross_cc}'"
  20.237 +    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  20.238 +    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  20.239 +    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  20.240 +
  20.241 +    BUILD_CC=${CT_CC_NATIVE}                                        \
  20.242 +    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O"   \
  20.243 +    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
  20.244 +    AR=${CT_TARGET}-ar                                              \
  20.245 +    RANLIB=${CT_TARGET}-ranlib                                      \
  20.246 +    CT_DoExecLog ALL                                                \
  20.247 +    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  20.248 +        --prefix=/usr                                               \
  20.249 +        --with-headers="${CT_HEADERS_DIR}"                          \
  20.250 +        --build=${CT_UNIQ_BUILD}                                    \
  20.251 +        --host=${CT_TARGET}                                         \
  20.252 +        --disable-profile                                           \
  20.253 +        --without-gd                                                \
  20.254 +        --without-cvs                                               \
  20.255 +        ${extra_config}                                             \
  20.256 +        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  20.257 +    
  20.258 +    CT_DoLog EXTRA "Building C library"
  20.259 +
  20.260 +    CT_DoExecLog ALL make
  20.261 +
  20.262 +    CT_DoLog EXTRA "Installing C library"
  20.263 +
  20.264 +    CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
  20.265 +
  20.266 +    CT_EndStep
  20.267 +}
  20.268 +
  20.269 +# This function finishes the glibc install
  20.270 +do_libc_finish() {
  20.271 +    # Nothing to be done for eglibc
  20.272 +    :
  20.273 +}
  20.274 +
  20.275 +# Build up the addons list, separated with $1
  20.276 +do_libc_add_ons_list() {
  20.277 +    local sep="$1"
  20.278 +    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
  20.279 +    case "${CT_THREADS}" in
  20.280 +        none)   ;;
  20.281 +        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
  20.282 +    esac
  20.283 +    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
  20.284 +    addons_list="${addons_list%%${sep}}"
  20.285 +    echo "${addons_list##${sep}}"
  20.286 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/scripts/build/libc/glibc.sh	Sun Sep 14 16:21:07 2008 +0000
    21.3 @@ -0,0 +1,531 @@
    21.4 +# This file adds functions to build glibc
    21.5 +# Copyright 2007 Yann E. MORIN
    21.6 +# Licensed under the GPL v2. See COPYING in the root of this package
    21.7 +
    21.8 +do_print_filename() {
    21.9 +    [ "${CT_LIBC}" = "glibc" ] || return 0
   21.10 +    echo "glibc-${CT_LIBC_VERSION}"
   21.11 +    for addon in $(do_libc_add_ons_list " "); do
   21.12 +        # NPTL addon is not to be downloaded, in any case
   21.13 +        [ "${addon}" = "nptl" ] && continue || true
   21.14 +        echo "glibc-${addon}-${CT_LIBC_VERSION}"
   21.15 +    done
   21.16 +}
   21.17 +
   21.18 +# Download glibc
   21.19 +do_libc_get() {
   21.20 +    # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
   21.21 +    # directory. Good. Alas, there is no snapshot there. I'll deal with them
   21.22 +    # later on... :-/
   21.23 +    CT_GetFile "${CT_LIBC_FILE}"                        \
   21.24 +               {ftp,http}://ftp.gnu.org/gnu/glibc       \
   21.25 +               ftp://gcc.gnu.org/pub/glibc/releases     \
   21.26 +               ftp://gcc.gnu.org/pub/glibc/snapshots
   21.27 +
   21.28 +    # C library addons
   21.29 +    for addon in $(do_libc_add_ons_list " "); do
   21.30 +        # NPTL addon is not to be downloaded, in any case
   21.31 +        [ "${addon}" = "nptl" ] && continue || true
   21.32 +        CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" \
   21.33 +                   {ftp,http}://ftp.gnu.org/gnu/glibc       \
   21.34 +                   ftp://gcc.gnu.org/pub/glibc/releases     \
   21.35 +                   ftp://gcc.gnu.org/pub/glibc/snapshots
   21.36 +    done
   21.37 +
   21.38 +    return 0
   21.39 +}
   21.40 +
   21.41 +# Extract glibc
   21.42 +do_libc_extract() {
   21.43 +    CT_ExtractAndPatch "${CT_LIBC_FILE}"
   21.44 +
   21.45 +    # C library addons
   21.46 +    for addon in $(do_libc_add_ons_list " "); do
   21.47 +        # NPTL addon is not to be extracted, in any case
   21.48 +        [ "${addon}" = "nptl" ] && continue || true
   21.49 +        CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
   21.50 +    done
   21.51 +
   21.52 +    return 0
   21.53 +}
   21.54 +
   21.55 +# There is nothing to do for glibc check config
   21.56 +do_libc_check_config() {
   21.57 +    :
   21.58 +}
   21.59 +
   21.60 +# This function installs the glibc headers needed to build the core compiler
   21.61 +do_libc_headers() {
   21.62 +    # Only need to install bootstrap glibc headers for gcc-3.0 and above?  Or maybe just gcc-3.3 and above?
   21.63 +    # See also http://gcc.gnu.org/PR8180, which complains about the need for this step.
   21.64 +    grep -q 'gcc-[34]' "${CT_SRC_DIR}/${CT_CC_FILE}/ChangeLog" 2>/dev/null || return 0
   21.65 +
   21.66 +    CT_DoStep INFO "Installing C library headers"
   21.67 +
   21.68 +    mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   21.69 +    cd "${CT_BUILD_DIR}/build-libc-headers"
   21.70 +
   21.71 +    CT_DoLog EXTRA "Configuring C library"
   21.72 +
   21.73 +    # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
   21.74 +    # 1. override CC to keep glibc's configure from using $TARGET-gcc. 
   21.75 +    # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly
   21.76 +    # 3. build with gcc 3.2 or later
   21.77 +    # Compare these options with the ones used when building glibc for real below - they're different.
   21.78 +    # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode
   21.79 +    # so when configure checks to make sure gcc has access to the assembler you just built...
   21.80 +    # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path.
   21.81 +    # Set --build so maybe we don't have to specify "cross-compiling=yes" below (haven't tried yet)
   21.82 +    # Note: the warning
   21.83 +    # "*** WARNING: Are you sure you do not want to use the `linuxthreads'"
   21.84 +    # *** add-on?"
   21.85 +    # is ok here, since all we want are the basic headers at this point.
   21.86 +    # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
   21.87 +    # 'a version of binutils that supports .machine "altivec" is needed'.
   21.88 +
   21.89 +    addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
   21.90 +    # We need to remove any threading addon when installing headers
   21.91 +    addons_config="${addons_config//nptl/}"
   21.92 +    addons_config="${addons_config//linuxthreads/}"
   21.93 +    addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;')
   21.94 +
   21.95 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
   21.96 +    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
   21.97 +    CT_DoLog DEBUG "Extra config passed : '${addons_config}'"
   21.98 +
   21.99 +    libc_cv_ppc_machine=yes                     \
  21.100 +    CC=${cross_cc}                              \
  21.101 +    CT_DoExecLog ALL                            \
  21.102 +    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"   \
  21.103 +        --build="${CT_UNIQ_BUILD}"              \
  21.104 +        --host="${CT_TARGET}"                   \
  21.105 +        --prefix=/usr                           \
  21.106 +        --with-headers="${CT_HEADERS_DIR}"      \
  21.107 +        --without-cvs                           \
  21.108 +        --disable-sanity-checks                 \
  21.109 +        --enable-hacker-mode                    \
  21.110 +        ${addons_config}                        \
  21.111 +        --without-nptl
  21.112 +
  21.113 +    CT_DoLog EXTRA "Installing C library headers"
  21.114 +
  21.115 +    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/${CT_LIBC_FILE}/ChangeLog"; then
  21.116 +        # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
  21.117 +        # which fails without a real cross-compiler.
  21.118 +        # Fortunately, we don't need errlist-compat.c, since we just need .h
  21.119 +        # files, so work around this by creating a fake errlist-compat.c and
  21.120 +        # satisfying its dependencies.
  21.121 +        # Another workaround might be to tell configure to not use any cross
  21.122 +        # options to $(CC).
  21.123 +        # The real fix would be to get install-headers to not generate
  21.124 +        # errlist-compat.c.
  21.125 +        # Note: BOOTSTRAP_GCC is used by:
  21.126 +        # patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
  21.127 +
  21.128 +        libc_cv_ppc_machine=yes                         \
  21.129 +        CT_DoExecLog ALL                                \
  21.130 +        make CFLAGS="-O -DBOOTSTRAP_GCC"                \
  21.131 +             OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"    \
  21.132 +             sysdeps/gnu/errlist.c
  21.133 +        mkdir -p stdio-common
  21.134 +
  21.135 +        # sleep for 2 seconds for benefit of filesystems with lousy time
  21.136 +        # resolution, like FAT, so make knows for sure errlist-compat.c doesn't
  21.137 +        # need generating
  21.138 +        sleep 2
  21.139 +        CT_DoExecLog ALL touch stdio-common/errlist-compat.c
  21.140 +    fi
  21.141 +    # Note: BOOTSTRAP_GCC (see above)
  21.142 +    libc_cv_ppc_machine=yes                         \
  21.143 +    CT_DoExecLog ALL                                \
  21.144 +    make cross-compiling=yes                        \
  21.145 +         install_root=${CT_SYSROOT_DIR}             \
  21.146 +         CFLAGS="-O -DBOOTSTRAP_GCC"                \
  21.147 +         ${LIBC_SYSROOT_ARG}                        \
  21.148 +         OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"    \
  21.149 +         install-headers
  21.150 +
  21.151 +    # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
  21.152 +    # so do them by hand.  We can tolerate an empty stubs.h for the moment.
  21.153 +    # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
  21.154 +    mkdir -p "${CT_HEADERS_DIR}/gnu"
  21.155 +    CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
  21.156 +    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/${CT_LIBC_FILE}/include/features.h"  \
  21.157 +                           "${CT_HEADERS_DIR}/features.h"
  21.158 +
  21.159 +    # Building the bootstrap gcc requires either setting inhibit_libc, or
  21.160 +    # having a copy of stdio_lim.h... see
  21.161 +    # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
  21.162 +    CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
  21.163 +
  21.164 +    # Following error building gcc-4.0.0's gcj:
  21.165 +    #  error: bits/syscall.h: No such file or directory
  21.166 +    # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
  21.167 +    # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
  21.168 +    [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
  21.169 +
  21.170 +    # Those headers are to be manually copied so gcc can build properly
  21.171 +    pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
  21.172 +    pthreadtypes_h=
  21.173 +    case "${CT_THREADS}" in
  21.174 +        nptl)
  21.175 +            # NOTE: for some archs, the pathes are different, but they are not
  21.176 +            # supported by crosstool-NG right now. See original crosstool when they are.
  21.177 +            pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
  21.178 +            pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
  21.179 +            if [ ! -f "${pthreadtypes_h}" ]; then
  21.180 +                pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_LIBC}-ports-${CT_LIBC_VERSION}/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
  21.181 +            fi
  21.182 +            ;;
  21.183 +        linuxthreads)
  21.184 +            pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
  21.185 +            ;;
  21.186 +        *)
  21.187 +            pthread_h=
  21.188 +            pthreadtypes_h=
  21.189 +            ;;
  21.190 +    esac
  21.191 +    if [ -n "${pthread_h}" ]; then
  21.192 +        CT_DoExecLog ALL cp -v "${pthread_h}" "${CT_HEADERS_DIR}/pthread.h"
  21.193 +    fi
  21.194 +    if [ -n "${pthreadtypes_h}" ]; then
  21.195 +        CT_DoExecLog ALL cp -v "${pthreadtypes_h}" "${CT_HEADERS_DIR}/bits/pthreadtypes.h"
  21.196 +    fi
  21.197 +
  21.198 +    CT_EndStep
  21.199 +}
  21.200 +
  21.201 +# Build and install start files
  21.202 +do_libc_start_files() {
  21.203 +    # Needed only in the NPTL case. Otherwise, return.
  21.204 +    [ "${CT_THREADS}" = "nptl" ] || return 0
  21.205 +
  21.206 +    CT_DoStep INFO "Installing C library start files"
  21.207 +
  21.208 +    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
  21.209 +    cd "${CT_BUILD_DIR}/build-libc-startfiles"
  21.210 +
  21.211 +    CT_DoLog EXTRA "Configuring C library"
  21.212 +
  21.213 +    # Add some default glibc config options if not given by user.
  21.214 +    extra_config=""
  21.215 +    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  21.216 +        *enable-kernel*) ;;
  21.217 +        *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  21.218 +    esac
  21.219 +    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  21.220 +        *-tls*) ;;
  21.221 +        *) extra_config="${extra_config} --with-tls"
  21.222 +    esac
  21.223 +    case "${CT_SHARED_LIBS}" in
  21.224 +        y) extra_config="${extra_config} --enable-shared";;
  21.225 +        *) extra_config="${extra_config} --disable-shared";;
  21.226 +    esac
  21.227 +    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  21.228 +        y,) extra_config="${extra_config} --with-fp";;
  21.229 +        ,y) extra_config="${extra_config} --without-fp";;
  21.230 +    esac
  21.231 +    # Obviously, we want threads, as we come here only for NPTL
  21.232 +    extra_config="${extra_config} --with-__thread"
  21.233 +
  21.234 +    addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
  21.235 +    extra_config="${extra_config} ${addons_config}"
  21.236 +
  21.237 +    # Add some default CC args
  21.238 +    glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  21.239 +    glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  21.240 +    # In case we're using a snapshot, fake a >=2.6 version.
  21.241 +    if [    "${CT_LIBC_V_LATEST}" = "y" \
  21.242 +         -o "${CT_LIBC_V_date}" = "y"   ]; then
  21.243 +        glibc_version_major=3
  21.244 +        glibc_version_minor=0
  21.245 +    fi
  21.246 +    if [    ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6    \
  21.247 +         -o ${glibc_version_major} -gt 2                                    ]; then
  21.248 +        # Don't use -pipe: configure chokes on it for glibc >= 2.6.
  21.249 +        CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
  21.250 +        extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
  21.251 +    else
  21.252 +        extra_cc_args="${CT_CFLAGS_FOR_HOST}"
  21.253 +    fi
  21.254 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  21.255 +
  21.256 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  21.257 +    CT_DoLog DEBUG "Using gcc for target    : '${cross_cc}'"
  21.258 +    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  21.259 +    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  21.260 +    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  21.261 +
  21.262 +    # Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2
  21.263 +    # note: this is awkward, doesn't work well if you need more than one
  21.264 +    # line in configparms
  21.265 +    echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
  21.266 +
  21.267 +    echo "libc_cv_forced_unwind=yes" > config.cache
  21.268 +    echo "libc_cv_c_cleanup=yes" >> config.cache
  21.269 +
  21.270 +    # Please see the comment for the configure step in do_libc().
  21.271 +
  21.272 +    BUILD_CC=${CT_CC_NATIVE}                                        \
  21.273 +    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O "  \
  21.274 +    CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}"      \
  21.275 +    AR=${CT_TARGET}-ar                                              \
  21.276 +    RANLIB=${CT_TARGET}-ranlib                                      \
  21.277 +    CT_DoExecLog ALL                                                \
  21.278 +    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  21.279 +        --prefix=/usr                                               \
  21.280 +        --build="${CT_UNIQ_BUILD}"                                  \
  21.281 +        --host=${CT_TARGET}                                         \
  21.282 +        --without-cvs                                               \
  21.283 +        --disable-profile                                           \
  21.284 +        --disable-debug                                             \
  21.285 +        --without-gd                                                \
  21.286 +        --with-headers="${CT_HEADERS_DIR}"                          \
  21.287 +        --cache-file=config.cache                                   \
  21.288 +        ${extra_config}                                             \
  21.289 +        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  21.290 +
  21.291 +
  21.292 +    #TODO: should check whether slibdir has been set in configparms to */lib64
  21.293 +    #      and copy the startfiles into the appropriate libdir.
  21.294 +    CT_DoLog EXTRA "Building C library start files"
  21.295 +    CT_DoExecLog ALL make OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" csu/subdir_lib
  21.296 +
  21.297 +    CT_DoLog EXTRA "Installing C library start files"
  21.298 +    if [ "${CT_USE_SYSROOT}" = "y" ]; then
  21.299 +        CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/usr/lib/"
  21.300 +    else
  21.301 +        CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/lib/"
  21.302 +    fi
  21.303 +
  21.304 +    CT_EndStep
  21.305 +}
  21.306 +
  21.307 +# This function builds and install the full glibc
  21.308 +do_libc() {
  21.309 +    CT_DoStep INFO "Installing C library"
  21.310 +
  21.311 +    mkdir -p "${CT_BUILD_DIR}/build-libc"
  21.312 +    cd "${CT_BUILD_DIR}/build-libc"
  21.313 +
  21.314 +    CT_DoLog EXTRA "Configuring C library"
  21.315 +
  21.316 +    # Add some default glibc config options if not given by user.
  21.317 +    # We don't need to be conditional on wether the user did set different
  21.318 +    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
  21.319 +
  21.320 +    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  21.321 +
  21.322 +    case "${CT_THREADS}" in
  21.323 +        nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
  21.324 +        linuxthreads)   extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
  21.325 +        none)           extra_config="${extra_config} --without-__thread --without-nptl"
  21.326 +                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  21.327 +                            *-tls*) ;;
  21.328 +                            *) extra_config="${extra_config} --without-tls";;
  21.329 +                        esac
  21.330 +                        ;;
  21.331 +    esac
  21.332 +
  21.333 +    case "${CT_SHARED_LIBS}" in
  21.334 +        y) extra_config="${extra_config} --enable-shared";;
  21.335 +        *) extra_config="${extra_config} --disable-shared";;
  21.336 +    esac
  21.337 +
  21.338 +    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  21.339 +        y,) extra_config="${extra_config} --with-fp";;
  21.340 +        ,y) extra_config="${extra_config} --without-fp";;
  21.341 +    esac
  21.342 +
  21.343 +    case "$(do_libc_add_ons_list ,)" in
  21.344 +        "") ;;
  21.345 +        *)  extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
  21.346 +    esac
  21.347 +
  21.348 +    # Add some default CC args
  21.349 +    glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  21.350 +    glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  21.351 +    # In case we're using a snapshot, fake a >=2.6 version.
  21.352 +    if [    "${CT_LIBC_V_LATEST}" = "y" \
  21.353 +         -o "${CT_LIBC_V_date}" = "y"   ]; then
  21.354 +        glibc_version_major=3
  21.355 +        glibc_version_minor=0
  21.356 +    fi
  21.357 +    if [    ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6    \
  21.358 +         -o ${glibc_version_major} -gt 2                                    ]; then
  21.359 +        # Don't use -pipe: configure chokes on it for glibc >= 2.6.
  21.360 +        CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
  21.361 +        extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
  21.362 +    else
  21.363 +        extra_cc_args="${CT_CFLAGS_FOR_HOST}"
  21.364 +    fi
  21.365 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  21.366 +
  21.367 +    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  21.368 +    CT_DoLog DEBUG "Using gcc for target    : '${cross_cc}'"
  21.369 +    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  21.370 +    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  21.371 +    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  21.372 +
  21.373 +    # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
  21.374 +    # note: this is awkward, doesn't work well if you need more than one line in configparms
  21.375 +    echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
  21.376 +
  21.377 +    # For glibc 2.3.4 and later we need to set some autoconf cache
  21.378 +    # variables, because nptl/sysdeps/pthread/configure.in does not
  21.379 +    # work when cross-compiling.
  21.380 +    if [ "${CT_THREADS}" = "nptl" ]; then
  21.381 +        echo libc_cv_forced_unwind=yes
  21.382 +        echo libc_cv_c_cleanup=yes
  21.383 +    fi >config.cache
  21.384 +
  21.385 +    # Configure with --prefix the way we want it on the target...
  21.386 +    # There are a whole lot of settings here.  You'll probably want
  21.387 +    # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
  21.388 +    # Compare these options with the ones used when installing the glibc headers above - they're different.
  21.389 +    # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory" 
  21.390 +    # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html. 
  21.391 +    # Set BUILD_CC, or you won't be able to build datafiles
  21.392 +    # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs
  21.393 +
  21.394 +    # OK. I'm fed up with those folks telling me what I should do.
  21.395 +    # I don't configure nptl? Well, maybe that's purposedly because
  21.396 +    # I don't want nptl! --disable-sanity-checks will shut up those
  21.397 +    # silly messages. GNU folks again, he?
  21.398 +
  21.399 +    BUILD_CC=${CT_CC_NATIVE}                                        \
  21.400 +    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O"   \
  21.401 +    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
  21.402 +    AR=${CT_TARGET}-ar                                              \
  21.403 +    RANLIB=${CT_TARGET}-ranlib                                      \
  21.404 +    CT_DoExecLog ALL                                                \
  21.405 +    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  21.406 +        --prefix=/usr                                               \
  21.407 +        --build=${CT_UNIQ_BUILD}                                    \
  21.408 +        --host=${CT_TARGET}                                         \
  21.409 +        --without-cvs                                               \
  21.410 +        --disable-profile                                           \
  21.411 +        --disable-debug                                             \
  21.412 +        --without-gd                                                \
  21.413 +        --disable-sanity-checks                                     \
  21.414 +        --cache-file=config.cache                                   \
  21.415 +        --with-headers="${CT_HEADERS_DIR}"                          \
  21.416 +        ${extra_config}                                             \
  21.417 +        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  21.418 +
  21.419 +    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
  21.420 +        # nptl-era glibc.
  21.421 +        # If the install-lib-all target (which is added by our make-install-lib-all.patch)
  21.422 +        # is present, it means we're building glibc-2.3.3 or later, and we can't
  21.423 +        # build programs yet, as they require libeh, which won't be installed
  21.424 +        # until full build of gcc
  21.425 +        # YEM-FIXME: This comment is misleading: latest glibc-s do not have the
  21.426 +        #            make-install-lib-all.patch applied, so do not pass through this
  21.427 +        #            part of the if statement; nonetheless, they do build, and
  21.428 +        #            the result is useable (maybe the dual-pass core gcc is
  21.429 +        #            responsible for this).
  21.430 +        GLIBC_INITIAL_BUILD_RULE=lib
  21.431 +        GLIBC_INITIAL_INSTALL_RULE="install-lib-all install-headers"
  21.432 +        GLIBC_INSTALL_APPS_LATER=yes
  21.433 +    else
  21.434 +        # classic glibc.  
  21.435 +        # We can build and install everything with the bootstrap compiler.
  21.436 +        # YEM-FIXME: See the above FIXME as well.
  21.437 +        GLIBC_INITIAL_BUILD_RULE=all
  21.438 +        GLIBC_INITIAL_INSTALL_RULE=install
  21.439 +        GLIBC_INSTALL_APPS_LATER=no
  21.440 +    fi
  21.441 +
  21.442 +    # If this fails with an error like this:
  21.443 +    # ...  linux/autoconf.h: No such file or directory 
  21.444 +    # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
  21.445 +    # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
  21.446 +    # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
  21.447 +    # No need for PARALLELMFLAGS here, Makefile already reads this environment variable
  21.448 +    CT_DoLog EXTRA "Building C library"
  21.449 +    CT_DoExecLog ALL make LD=${CT_TARGET}-ld                        \
  21.450 +                           RANLIB=${CT_TARGET}-ranlib               \
  21.451 +                           OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"  \
  21.452 +                           ${GLIBC_INITIAL_BUILD_RULE}
  21.453 +
  21.454 +    CT_DoLog EXTRA "Installing C library"
  21.455 +    CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}"          \
  21.456 +                          ${LIBC_SYSROOT_ARG}                       \
  21.457 +                          OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"   \
  21.458 +                          ${GLIBC_INITIAL_INSTALL_RULE}
  21.459 +
  21.460 +    # This doesn't seem to work when building a crosscompiler,
  21.461 +    # as it tries to execute localedef using the just-built ld.so!?
  21.462 +    #CT_DoLog EXTRA "Installing locales"
  21.463 +    #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
  21.464 +
  21.465 +    # Fix problems in linker scripts.
  21.466 +    #
  21.467 +    # 1. Remove absolute paths
  21.468 +    # Any file in a list of known suspects that isn't a symlink is assumed to be a linker script.
  21.469 +    # FIXME: test -h is not portable
  21.470 +    # FIXME: probably need to check more files than just these three...
  21.471 +    # Need to use sed instead of just assuming we know what's in libc.so because otherwise alpha breaks
  21.472 +    #
  21.473 +    # 2. Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
  21.474 +    # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
  21.475 +    #
  21.476 +    # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
  21.477 +    CT_DoLog EXTRA "Fixing C library linker scripts"
  21.478 +    for file in libc.so libpthread.so libgcc_s.so; do
  21.479 +        for dir in lib lib64 usr/lib usr/lib64; do
  21.480 +            if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
  21.481 +                CT_DoExecLog ALL cp -v "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
  21.482 +                CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
  21.483 +                CT_DoExecLog ALL sed -i -r -e 's,/usr/lib/,,g;
  21.484 +                                               s,/usr/lib64/,,g;
  21.485 +                                               s,/lib/,,g;
  21.486 +                                               s,/lib64/,,g;
  21.487 +                                               /BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
  21.488 +            fi
  21.489 +        done
  21.490 +    done
  21.491 +
  21.492 +    CT_EndStep
  21.493 +}
  21.494 +
  21.495 +# This function finishes the glibc install
  21.496 +do_libc_finish() {
  21.497 +    # Finally, build and install glibc programs, now that libeh (if any) is installed
  21.498 +    # Don't do this unless needed, 'cause it causes glibc-2.{1.3,2.2} to fail here with
  21.499 +    # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__deregister_frame_info'
  21.500 +    # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__register_frame_info'
  21.501 +    [ "${GLIBC_INSTALL_APPS_LATER}" = "yes" ] || return 0
  21.502 +
  21.503 +    CT_DoStep INFO "Finishing C library"
  21.504 +
  21.505 +    cd "${CT_BUILD_DIR}/build-libc"
  21.506 +
  21.507 +    CT_DoLog EXTRA "Re-building C library"
  21.508 +    CT_DoExecLog ALL make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib
  21.509 +
  21.510 +    CT_DoLog EXTRA "Installing missing C library components"
  21.511 +    # note: should do full install and then fix linker scripts, but this is faster
  21.512 +    for t in bin rootsbin sbin data others; do
  21.513 +        CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}"          \
  21.514 +                              ${LIBC_SYSROOT_ARG}                       \
  21.515 +                              OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"   \
  21.516 +                              install-${t}
  21.517 +    done
  21.518 +
  21.519 +    CT_EndStep
  21.520 +}
  21.521 +
  21.522 +# Build up the addons list, separated with $1
  21.523 +do_libc_add_ons_list() {
  21.524 +    local sep="$1"
  21.525 +    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
  21.526 +    case "${CT_THREADS}" in
  21.527 +        none)   ;;
  21.528 +        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
  21.529 +    esac
  21.530 +    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
  21.531 +    addons_list="${addons_list%%${sep}}"
  21.532 +    echo "${addons_list##${sep}}"
  21.533 +}
  21.534 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/scripts/build/libc/none.sh	Sun Sep 14 16:21:07 2008 +0000
    22.3 @@ -0,0 +1,36 @@
    22.4 +# This file adds functions to build the C library for bare metal (IE. none)
    22.5 +# Copyright 2008 Yann E. MORIN
    22.6 +# Licensed under the GPL v2. See COPYING in the root of this package
    22.7 +
    22.8 +do_print_filename() {
    22.9 +    :
   22.10 +}
   22.11 +
   22.12 +do_libc_get() {
   22.13 +    :
   22.14 +}
   22.15 +
   22.16 +do_libc_extract() {
   22.17 +    :
   22.18 +}
   22.19 +
   22.20 +do_libc_check_config() {
   22.21 +    :
   22.22 +}
   22.23 +
   22.24 +do_libc_headers() {
   22.25 +    :
   22.26 +}
   22.27 +
   22.28 +# Build and install start files
   22.29 +do_libc_start_files() {
   22.30 +    :
   22.31 +}
   22.32 +
   22.33 +do_libc() {
   22.34 +    :
   22.35 +}
   22.36 +
   22.37 +do_libc_finish() {
   22.38 +    :
   22.39 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/scripts/build/libc/uClibc.sh	Sun Sep 14 16:21:07 2008 +0000
    23.3 @@ -0,0 +1,313 @@
    23.4 +# This file declares functions to install the uClibc C library
    23.5 +# Copyright 2007 Yann E. MORIN
    23.6 +# Licensed under the GPL v2. See COPYING in the root of this package
    23.7 +
    23.8 +do_print_filename() {
    23.9 +    [ "${CT_LIBC}" = "uClibc" ] || return 0
   23.10 +    echo "uClibc-${CT_LIBC_VERSION}"
   23.11 +    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && echo "uClibc-locale-030818" || true
   23.12 +}
   23.13 +
   23.14 +# Download uClibc
   23.15 +do_libc_get() {
   23.16 +    libc_src="http://www.uclibc.org/downloads
   23.17 +              http://www.uclibc.org/downloads/snapshots
   23.18 +              http://www.uclibc.org/downloads/old-releases"
   23.19 +    # For uClibc, we have almost every thing: releases, and snapshots
   23.20 +    # for the last month or so. We'll have to deal with svn revisions
   23.21 +    # later...
   23.22 +    CT_GetFile "${CT_LIBC_FILE}" ${libc_src}
   23.23 +    # uClibc locales
   23.24 +    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} || true
   23.25 +
   23.26 +    return 0
   23.27 +}
   23.28 +
   23.29 +# Extract uClibc
   23.30 +do_libc_extract() {
   23.31 +    CT_ExtractAndPatch "${CT_LIBC_FILE}"
   23.32 +    # uClibc locales
   23.33 +    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818" || true
   23.34 +
   23.35 +    return 0
   23.36 +}
   23.37 +
   23.38 +# Check that uClibc has been previously configured
   23.39 +do_libc_check_config() {
   23.40 +    CT_DoStep INFO "Checking C library configuration"
   23.41 +
   23.42 +    CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}"
   23.43 +
   23.44 +    if egrep '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
   23.45 +        CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
   23.46 +        CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
   23.47 +    fi
   23.48 +
   23.49 +    CT_DoLog EXTRA "Munging uClibc configuration"
   23.50 +    mungeuClibcConfig "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_BUILD_DIR}/uClibc.config"
   23.51 +
   23.52 +    CT_EndStep
   23.53 +}
   23.54 +
   23.55 +# This functions installs uClibc's headers
   23.56 +do_libc_headers() {
   23.57 +    # Only need to install bootstrap uClibc headers for gcc-3.0 and above?  Or maybe just gcc-3.3 and above?
   23.58 +    # See also http://gcc.gnu.org/PR8180, which complains about the need for this step.
   23.59 +    grep -q 'gcc-[34]' "${CT_SRC_DIR}/${CT_CC_FILE}/ChangeLog" 2>/dev/null || return 0
   23.60 +
   23.61 +    CT_DoStep INFO "Installing C library headers"
   23.62 +
   23.63 +    mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   23.64 +    cd "${CT_BUILD_DIR}/build-libc-headers"
   23.65 +
   23.66 +    # Simply copy files until uClibc has the ablity to build out-of-tree
   23.67 +    CT_DoLog EXTRA "Copying sources to build dir"
   23.68 +    { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
   23.69 +
   23.70 +    # Retrieve the config file
   23.71 +    cp "${CT_BUILD_DIR}/uClibc.config" .config
   23.72 +
   23.73 +    # uClibc uses the CROSS environment variable as a prefix to the
   23.74 +    # compiler tools to use.  Setting it to the empty string forces
   23.75 +    # use of the native build host tools, which we need at this
   23.76 +    # stage, as we don't have target tools yet.
   23.77 +    CT_DoLog EXTRA "Applying configuration"
   23.78 +    CT_DoYes "" |CT_DoExecLog ALL make CROSS= PREFIX="${CT_SYSROOT_DIR}/" oldconfig
   23.79 +
   23.80 +    CT_DoLog EXTRA "Building headers"
   23.81 +    CT_DoExecLog ALL make ${CT_LIBC_UCLIBC_VERBOSITY} CROSS= PREFIX="${CT_SYSROOT_DIR}/" headers
   23.82 +
   23.83 +    CT_DoLog EXTRA "Installing headers"
   23.84 +    CT_DoExecLog ALL make ${CT_LIBC_UCLIBC_VERBOSITY} CROSS= PREFIX="${CT_SYSROOT_DIR}/" install_dev
   23.85 +
   23.86 +    CT_EndStep
   23.87 +}
   23.88 +
   23.89 +# Build and install start files
   23.90 +do_libc_start_files() {
   23.91 +    :
   23.92 +}
   23.93 +
   23.94 +# This function build and install the full uClibc
   23.95 +do_libc() {
   23.96 +    CT_DoStep INFO "Installing C library"
   23.97 +
   23.98 +    mkdir -p "${CT_BUILD_DIR}/build-libc"
   23.99 +    cd "${CT_BUILD_DIR}/build-libc"
  23.100 +
  23.101 +    # Simply copy files until uClibc has the ablity to build out-of-tree
  23.102 +    CT_DoLog EXTRA "Copying sources to build dir"
  23.103 +    { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
  23.104 +
  23.105 +    # Retrieve the config file
  23.106 +    cp "${CT_BUILD_DIR}/uClibc.config" .config
  23.107 +
  23.108 +    # uClibc uses the CROSS environment variable as a prefix to the compiler
  23.109 +    # tools to use.  The newly built tools should be in our path, so we need
  23.110 +    # only give the correct name for them.
  23.111 +    # Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
  23.112 +    # depending  on the configuration of the library. That is, they are tailored
  23.113 +    # to best fit the target. So it is useless and seems to be a bad thing to
  23.114 +    # use LIBC_EXTRA_CFLAGS here.
  23.115 +    CT_DoLog EXTRA "Applying configuration"
  23.116 +    CT_DoYes "" |CT_DoExecLog ALL               \
  23.117 +                 make CROSS=${CT_TARGET}-       \
  23.118 +                 PREFIX="${CT_SYSROOT_DIR}/"    \
  23.119 +                 oldconfig
  23.120 +
  23.121 +    # We do _not_ want to strip anything for now, in case we specifically
  23.122 +    # asked for a debug toolchain, thus the STRIPTOOL= assignment
  23.123 +    CT_DoLog EXTRA "Building C library"
  23.124 +    CT_DoExecLog ALL                    \
  23.125 +    make CROSS=${CT_TARGET}-            \
  23.126 +         PREFIX="${CT_SYSROOT_DIR}/"    \
  23.127 +         STRIPTOOL=true                 \
  23.128 +         ${CT_LIBC_UCLIBC_VERBOSITY}    \
  23.129 +         all
  23.130 +
  23.131 +    # YEM-FIXME: we want to install libraries in $SYSROOT/lib, but we don't want
  23.132 +    # to install headers in $SYSROOT/include, thus making only install_runtime.
  23.133 +    # Plus, the headers were previously installed earlier with install_dev, so
  23.134 +    # all should be well. Unfortunately, the install_dev target does not install
  23.135 +    # crti.o and consorts... :-( So reverting to target 'install'.
  23.136 +    # Note: PARALLELMFLAGS is not usefull for installation.
  23.137 +    # We do _not_ want to strip anything for now, in case we specifically
  23.138 +    # asked for a debug toolchain, thus the STRIPTOOL= assignment
  23.139 +    CT_DoLog EXTRA "Installing C library"
  23.140 +    CT_DoExecLog ALL                    \
  23.141 +    make CROSS=${CT_TARGET}-            \
  23.142 +         PREFIX="${CT_SYSROOT_DIR}/"    \
  23.143 +         STRIPTOOL=true                 \
  23.144 +         ${CT_LIBC_UCLIBC_VERBOSITY}    \
  23.145 +         install
  23.146 +
  23.147 +    CT_EndStep
  23.148 +}
  23.149 +
  23.150 +# This function is used to install those components needing the final C compiler
  23.151 +do_libc_finish() {
  23.152 +    :
  23.153 +}
  23.154 +
  23.155 +# Initialises the .config file to sensible values
  23.156 +# $1: original file
  23.157 +# $2: munged file
  23.158 +mungeuClibcConfig() {
  23.159 +    src_config_file="$1"
  23.160 +    dst_config_file="$2"
  23.161 +    munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed"
  23.162 +
  23.163 +    # Start with a fresh file
  23.164 +    rm -f "${munge_file}"
  23.165 +    touch "${munge_file}"
  23.166 +
  23.167 +    # Hack our target in the config file.
  23.168 +    # Also remove stripping: its the responsibility of the
  23.169 +    # firmware builder to strip or not.
  23.170 +    cat >>"${munge_file}" <<-ENDSED
  23.171 +s/^(TARGET_.*)=y$/# \\1 is not set/
  23.172 +s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/
  23.173 +s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/
  23.174 +s/.*(DOSTRIP).*/# \\1 is not set/
  23.175 +ENDSED
  23.176 +
  23.177 +    # Ah. We may one day need architecture-specific handler here...
  23.178 +    # Hack the ARM {E,O}ABI into the config file
  23.179 +    if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
  23.180 +        cat >>"${munge_file}" <<-ENDSED
  23.181 +s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
  23.182 +s/.*(CONFIG_ARM_EABI).*/\\1=y/
  23.183 +ENDSED
  23.184 +    else
  23.185 +        cat >>"${munge_file}" <<-ENDSED
  23.186 +s/.*(CONFIG_ARM_OABI).*/\\1=y/
  23.187 +s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
  23.188 +ENDSED
  23.189 +    fi
  23.190 +
  23.191 +    # Accomodate for old and new uClibc versions, where the
  23.192 +    # way to select between big/little endian has changed
  23.193 +    case "${CT_ARCH_BE},${CT_ARCH_LE}" in
  23.194 +        y,) cat >>"${munge_file}" <<-ENDSED
  23.195 +s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
  23.196 +s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
  23.197 +s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
  23.198 +s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
  23.199 +ENDSED
  23.200 +        ;;
  23.201 +        ,y) cat >>"${munge_file}" <<-ENDSED
  23.202 +s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
  23.203 +s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
  23.204 +s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
  23.205 +s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
  23.206 +ENDSED
  23.207 +        ;;
  23.208 +    esac
  23.209 +
  23.210 +    # Accomodate for old and new uClibc version, where the
  23.211 +    # way to select between hard/soft float has changed
  23.212 +    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  23.213 +        y,) cat >>"${munge_file}" <<-ENDSED
  23.214 +s/^[^_]*(HAS_FPU).*/\\1=y/
  23.215 +s/.*(UCLIBC_HAS_FPU).*/\\1=y/
  23.216 +ENDSED
  23.217 +            ;;
  23.218 +        ,y) cat >>"${munge_file}" <<-ENDSED
  23.219 +s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
  23.220 +s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
  23.221 +ENDSED
  23.222 +            ;;
  23.223 +    esac
  23.224 +
  23.225 +    # Change paths to work with crosstool-NG
  23.226 +    # From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev
  23.227 +    #  " we just want the kernel headers, not the whole kernel source ...
  23.228 +    #  " so people may need to update their paths slightly
  23.229 +    quoted_kernel_source=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\/,g;')
  23.230 +    quoted_headers_dir=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/,\\/,g;')
  23.231 +    # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
  23.232 +    # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
  23.233 +    # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and
  23.234 +    # newer versions use KERNEL_HEADERS (which is right). See:
  23.235 +    cat >>"${munge_file}" <<-ENDSED
  23.236 +s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
  23.237 +s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
  23.238 +s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
  23.239 +s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
  23.240 +s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
  23.241 +s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
  23.242 +ENDSED
  23.243 +
  23.244 +    if [ "${CT_USE_PIPES}" = "y" ]; then
  23.245 +        if grep UCLIBC_EXTRA_CFLAGS extra/Configs/Config.in >/dev/null 2>&1; then
  23.246 +            # Good, there is special provision for such things as -pipe!
  23.247 +            cat >>"${munge_file}" <<-ENDSED
  23.248 +s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
  23.249 +ENDSED
  23.250 +        else
  23.251 +            # Hack our -pipe into WARNINGS, which will be internally incorporated to
  23.252 +            # CFLAGS. This a dirty hack, but yet needed
  23.253 +            cat >> "${munge_file}" <<-ENDSED
  23.254 +s/^(WARNINGS=".*)"$/\\1 -pipe"/
  23.255 +ENDSED
  23.256 +        fi
  23.257 +    fi
  23.258 +
  23.259 +    # Force on options needed for C++ if we'll be making a C++ compiler.
  23.260 +    # Note that the two PREGEN_LOCALE and the XLOCALE lines may be missing
  23.261 +    # entirely if LOCALE is not set.  If LOCALE was already set, we'll
  23.262 +    # assume the user has already made all the appropriate generation
  23.263 +    # arrangements.  Note that having the uClibc Makefile download the
  23.264 +    # pregenerated locales is not compatible with crosstool; besides,
  23.265 +    # crosstool downloads them as part of getandpatch.sh.
  23.266 +    if [ "${CT_CC_LANG_CXX}" = "y" ]; then
  23.267 +        cat >>"${munge_file}" <<-ENDSED
  23.268 +s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
  23.269 +s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
  23.270 +# Add these three lines when doing C++?
  23.271 +s/^# UCLIBC_HAS_WCHAR is not set/UCLIBC_HAS_WCHAR=y/
  23.272 +#s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\nUCLIBC_PREGENERATED_LOCALE_DATA=y\\n\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\n\\# UCLIBC_HAS_XLOCALE is not set/
  23.273 +s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
  23.274 +ENDSED
  23.275 +    fi
  23.276 +
  23.277 +    # Always build the libpthread_db
  23.278 +    cat >>"${munge_file}" <<-ENDSED
  23.279 +s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
  23.280 +ENDSED
  23.281 +
  23.282 +    # Force on debug options if asked for
  23.283 +    case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
  23.284 +      0)
  23.285 +        cat >>"${munge_file}" <<-ENDSED
  23.286 +s/^DODEBUG=y/# DODEBUG is not set/
  23.287 +s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
  23.288 +s/^DOASSERTS=y/# DOASSERTS is not set/
  23.289 +s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
  23.290 +s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
  23.291 +s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
  23.292 +ENDSED
  23.293 +        ;;
  23.294 +      1)
  23.295 +        cat >>"${munge_file}" <<-ENDSED
  23.296 +s/^# DODEBUG is not set.*/DODEBUG=y/
  23.297 +s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
  23.298 +s/^DOASSERTS=y/# DOASSERTS is not set/
  23.299 +s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
  23.300 +s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
  23.301 +s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
  23.302 +ENDSED
  23.303 +        ;;
  23.304 +      2)
  23.305 +        cat >>"${munge_file}" <<-ENDSED
  23.306 +s/^# DODEBUG is not set.*/DODEBUG=y/
  23.307 +s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
  23.308 +s/^# DOASSERTS is not set.*/DOASSERTS=y/
  23.309 +s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
  23.310 +s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
  23.311 +s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
  23.312 +ENDSED
  23.313 +        ;;
  23.314 +    esac
  23.315 +    sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
  23.316 +}
    24.1 --- a/scripts/build/libc_eglibc.sh	Thu Sep 11 09:02:00 2008 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,283 +0,0 @@
    24.4 -# eglibc build functions (initially by Thomas JOURDAN).
    24.5 -
    24.6 -do_print_filename() {
    24.7 -    [ "${CT_LIBC}" = "eglibc" ] || return 0
    24.8 -    echo "eglibc-${CT_LIBC_VERSION}"
    24.9 -    for addon in $(do_libc_add_ons_list " "); do
   24.10 -        # NPTL addon is not to be downloaded, in any case
   24.11 -        [ "${addon}" = "nptl" ] && continue || true
   24.12 -        echo "eglibc-${addon}-${CT_LIBC_VERSION}"
   24.13 -    done
   24.14 -}
   24.15 -
   24.16 -# Download eglibc repository
   24.17 -do_eglibc_get() {
   24.18 -    CT_HasOrAbort svn
   24.19 -
   24.20 -    case "${CT_LIBC_VERSION}" in
   24.21 -        trunk)  svn_url="svn://svn.eglibc.org/trunk";;
   24.22 -        *)      svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
   24.23 -    esac
   24.24 -
   24.25 -    CT_MktempDir tmp_dir
   24.26 -    CT_Pushd "${tmp_dir}"
   24.27 -
   24.28 -    case "${CT_EGLIBC_CHECKOUT}" in
   24.29 -        y)  svn_action="checkout";;
   24.30 -        *)  svn_action="export --force";;
   24.31 -    esac
   24.32 -
   24.33 -    CT_DoSetProxy ${CT_PROXY_TYPE}
   24.34 -    CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
   24.35 -
   24.36 -    # Compress eglibc
   24.37 -    CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
   24.38 -    CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
   24.39 -
   24.40 -    # Compress linuxthreads, localedef and ports
   24.41 -    # Assign them the name the way ct-ng like it
   24.42 -    for addon in linuxthreads localedef ports; do
   24.43 -        CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
   24.44 -    done
   24.45 -
   24.46 -    CT_Popd
   24.47 -
   24.48 -    # Remove source files
   24.49 -    CT_DoExecLog ALL rm -rf "${tmp_dir}"
   24.50 -}
   24.51 -
   24.52 -# Download glibc
   24.53 -do_libc_get() {
   24.54 -    # eglibc is only available through subversion, there are no
   24.55 -    # snapshots available. Moreover, addons will be downloaded
   24.56 -    # simultaneously.
   24.57 -
   24.58 -    # build filename
   24.59 -    eglibc="${CT_LIBC_FILE}.tar.bz2"
   24.60 -    eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
   24.61 -    eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
   24.62 -    eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
   24.63 -
   24.64 -    # Check if every tarballs are already present
   24.65 -    if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ]              && \
   24.66 -       [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
   24.67 -       [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ]    && \
   24.68 -       [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
   24.69 -        CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
   24.70 -        return 0
   24.71 -    fi
   24.72 -
   24.73 -    if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ]              && \
   24.74 -       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
   24.75 -       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ]    && \
   24.76 -       [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ]        && \
   24.77 -       [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
   24.78 -        CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
   24.79 -        for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
   24.80 -            CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
   24.81 -        done
   24.82 -        return 0
   24.83 -    fi
   24.84 -
   24.85 -    # Not found locally, try from the network
   24.86 -    CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
   24.87 -    do_eglibc_get
   24.88 -
   24.89 -    if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
   24.90 -        CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
   24.91 -        for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
   24.92 -            CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
   24.93 -            CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
   24.94 -        done
   24.95 -    fi
   24.96 -
   24.97 -    return 0
   24.98 -}
   24.99 -
  24.100 -# Extract eglibc
  24.101 -do_libc_extract() {
  24.102 -    CT_ExtractAndPatch "${CT_LIBC_FILE}"
  24.103 -
  24.104 -    # C library addons
  24.105 -    for addon in $(do_libc_add_ons_list " "); do
  24.106 -        # NPTL addon is not to be extracted, in any case
  24.107 -        [ "${addon}" = "nptl" ] && continue || true
  24.108 -        CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
  24.109 -    done
  24.110 -
  24.111 -    return 0
  24.112 -}
  24.113 -
  24.114 -# There is nothing to do for eglibc check config
  24.115 -do_libc_check_config() {
  24.116 -    :
  24.117 -}
  24.118 -
  24.119 -# This function installs the glibc headers needed to build the core compiler
  24.120 -do_libc_headers() {
  24.121 -    # Instead of doing two time the same actions, headers will
  24.122 -    # be installed with start files
  24.123 -    :
  24.124 -}
  24.125 -
  24.126 -# Build and install start files
  24.127 -do_libc_start_files() {
  24.128 -    CT_DoStep INFO "Installing C library headers / start files"
  24.129 -
  24.130 -    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
  24.131 -    cd "${CT_BUILD_DIR}/build-libc-startfiles"
  24.132 -
  24.133 -    CT_DoLog EXTRA "Configuring C library"
  24.134 -
  24.135 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  24.136 -    cross_cxx=$(CT_Which "${CT_TARGET}-g++")
  24.137 -    cross_ar=$(CT_Which "${CT_TARGET}-ar")
  24.138 -    cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
  24.139 -    
  24.140 -    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
  24.141 -    CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
  24.142 -    CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
  24.143 -    CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
  24.144 -
  24.145 -    BUILD_CC=${CT_CC_NATIVE}                    \
  24.146 -    CC=${cross_cc}                              \
  24.147 -    CXX=${cross_cxx}                            \
  24.148 -    AR=${cross_ar}                              \
  24.149 -    RANLIB=${cross_ranlib}                      \
  24.150 -    CT_DoExecLog ALL                            \
  24.151 -    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"   \
  24.152 -        --prefix=/usr                           \
  24.153 -        --with-headers="${CT_HEADERS_DIR}"      \
  24.154 -        --build="${CT_UNIQ_BUILD}"              \
  24.155 -        --host="${CT_TARGET}"                   \
  24.156 -        --disable-profile                       \
  24.157 -        --without-gd                            \
  24.158 -        --without-cvs                           \
  24.159 -        --enable-add-ons
  24.160 -
  24.161 -    CT_DoLog EXTRA "Installing C library headers"
  24.162 -
  24.163 -    # use the 'install-headers' makefile target to install the
  24.164 -    # headers
  24.165 -
  24.166 -    CT_DoExecLog ALL                    \
  24.167 -    make install-headers                \
  24.168 -         install_root=${CT_SYSROOT_DIR} \
  24.169 -         install-bootstrap-headers=yes
  24.170 -
  24.171 -    CT_DoLog EXTRA "Installing C library start files"
  24.172 -
  24.173 -    # there are a few object files needed to link shared libraries,
  24.174 -    # which we build and install by hand
  24.175 -
  24.176 -    CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
  24.177 -    CT_DoExecLog ALL make csu/subdir_lib
  24.178 -    CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
  24.179 -        ${CT_SYSROOT_DIR}/usr/lib
  24.180 -
  24.181 -    # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.  
  24.182 -    # However, since we will never actually execute its code, 
  24.183 -    # it doesn't matter what it contains.  So, treating '/dev/null' 
  24.184 -    # as a C source file, we produce a dummy 'libc.so' in one step
  24.185 -
  24.186 -    CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
  24.187 -
  24.188 -    CT_EndStep
  24.189 -}
  24.190 -
  24.191 -# This function builds and install the full glibc
  24.192 -do_libc() {
  24.193 -    CT_DoStep INFO "Installing C library"
  24.194 -
  24.195 -    mkdir -p "${CT_BUILD_DIR}/build-libc"
  24.196 -    cd "${CT_BUILD_DIR}/build-libc"
  24.197 -
  24.198 -    CT_DoLog EXTRA "Configuring C library"
  24.199 -
  24.200 -    # Add some default glibc config options if not given by user.
  24.201 -    # We don't need to be conditional on wether the user did set different
  24.202 -    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
  24.203 -
  24.204 -    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  24.205 -
  24.206 -    case "${CT_THREADS}" in
  24.207 -        nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
  24.208 -        linuxthreads)   extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
  24.209 -        none)           extra_config="${extra_config} --without-__thread --without-nptl"
  24.210 -                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  24.211 -                            *-tls*) ;;
  24.212 -                            *) extra_config="${extra_config} --without-tls";;
  24.213 -                        esac
  24.214 -                        ;;
  24.215 -    esac
  24.216 -
  24.217 -    case "${CT_SHARED_LIBS}" in
  24.218 -        y) extra_config="${extra_config} --enable-shared";;
  24.219 -        *) extra_config="${extra_config} --disable-shared";;
  24.220 -    esac
  24.221 -
  24.222 -    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  24.223 -        y,) extra_config="${extra_config} --with-fp";;
  24.224 -        ,y) extra_config="${extra_config} --without-fp";;
  24.225 -    esac
  24.226 -
  24.227 -    case "$(do_libc_add_ons_list ,)" in
  24.228 -        "") ;;
  24.229 -        *)  extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
  24.230 -    esac
  24.231 -
  24.232 -    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  24.233 -
  24.234 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")    
  24.235 -
  24.236 -    CT_DoLog DEBUG "Using gcc for target:     '${cross_cc}'"
  24.237 -    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  24.238 -    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  24.239 -    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  24.240 -
  24.241 -    BUILD_CC=${CT_CC_NATIVE}                                        \
  24.242 -    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O"   \
  24.243 -    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
  24.244 -    AR=${CT_TARGET}-ar                                              \
  24.245 -    RANLIB=${CT_TARGET}-ranlib                                      \
  24.246 -    CT_DoExecLog ALL                                                \
  24.247 -    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  24.248 -        --prefix=/usr                                               \
  24.249 -        --with-headers="${CT_HEADERS_DIR}"                          \
  24.250 -        --build=${CT_UNIQ_BUILD}                                    \
  24.251 -        --host=${CT_TARGET}                                         \
  24.252 -        --disable-profile                                           \
  24.253 -        --without-gd                                                \
  24.254 -        --without-cvs                                               \
  24.255 -        ${extra_config}                                             \
  24.256 -        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  24.257 -    
  24.258 -    CT_DoLog EXTRA "Building C library"
  24.259 -
  24.260 -    CT_DoExecLog ALL make
  24.261 -
  24.262 -    CT_DoLog EXTRA "Installing C library"
  24.263 -
  24.264 -    CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
  24.265 -
  24.266 -    CT_EndStep
  24.267 -}
  24.268 -
  24.269 -# This function finishes the glibc install
  24.270 -do_libc_finish() {
  24.271 -    # Nothing to be done for eglibc
  24.272 -    :
  24.273 -}
  24.274 -
  24.275 -# Build up the addons list, separated with $1
  24.276 -do_libc_add_ons_list() {
  24.277 -    local sep="$1"
  24.278 -    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
  24.279 -    case "${CT_THREADS}" in
  24.280 -        none)   ;;
  24.281 -        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
  24.282 -    esac
  24.283 -    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
  24.284 -    addons_list="${addons_list%%${sep}}"
  24.285 -    echo "${addons_list##${sep}}"
  24.286 -}
    25.1 --- a/scripts/build/libc_glibc.sh	Thu Sep 11 09:02:00 2008 +0000
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,531 +0,0 @@
    25.4 -# This file adds functions to build glibc
    25.5 -# Copyright 2007 Yann E. MORIN
    25.6 -# Licensed under the GPL v2. See COPYING in the root of this package
    25.7 -
    25.8 -do_print_filename() {
    25.9 -    [ "${CT_LIBC}" = "glibc" ] || return 0
   25.10 -    echo "glibc-${CT_LIBC_VERSION}"
   25.11 -    for addon in $(do_libc_add_ons_list " "); do
   25.12 -        # NPTL addon is not to be downloaded, in any case
   25.13 -        [ "${addon}" = "nptl" ] && continue || true
   25.14 -        echo "glibc-${addon}-${CT_LIBC_VERSION}"
   25.15 -    done
   25.16 -}
   25.17 -
   25.18 -# Download glibc
   25.19 -do_libc_get() {
   25.20 -    # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
   25.21 -    # directory. Good. Alas, there is no snapshot there. I'll deal with them
   25.22 -    # later on... :-/
   25.23 -    CT_GetFile "${CT_LIBC_FILE}"                        \
   25.24 -               {ftp,http}://ftp.gnu.org/gnu/glibc       \
   25.25 -               ftp://gcc.gnu.org/pub/glibc/releases     \
   25.26 -               ftp://gcc.gnu.org/pub/glibc/snapshots
   25.27 -
   25.28 -    # C library addons
   25.29 -    for addon in $(do_libc_add_ons_list " "); do
   25.30 -        # NPTL addon is not to be downloaded, in any case
   25.31 -        [ "${addon}" = "nptl" ] && continue || true
   25.32 -        CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" \
   25.33 -                   {ftp,http}://ftp.gnu.org/gnu/glibc       \
   25.34 -                   ftp://gcc.gnu.org/pub/glibc/releases     \
   25.35 -                   ftp://gcc.gnu.org/pub/glibc/snapshots
   25.36 -    done
   25.37 -
   25.38 -    return 0
   25.39 -}
   25.40 -
   25.41 -# Extract glibc
   25.42 -do_libc_extract() {
   25.43 -    CT_ExtractAndPatch "${CT_LIBC_FILE}"
   25.44 -
   25.45 -    # C library addons
   25.46 -    for addon in $(do_libc_add_ons_list " "); do
   25.47 -        # NPTL addon is not to be extracted, in any case
   25.48 -        [ "${addon}" = "nptl" ] && continue || true
   25.49 -        CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
   25.50 -    done
   25.51 -
   25.52 -    return 0
   25.53 -}
   25.54 -
   25.55 -# There is nothing to do for glibc check config
   25.56 -do_libc_check_config() {
   25.57 -    :
   25.58 -}
   25.59 -
   25.60 -# This function installs the glibc headers needed to build the core compiler
   25.61 -do_libc_headers() {
   25.62 -    # Only need to install bootstrap glibc headers for gcc-3.0 and above?  Or maybe just gcc-3.3 and above?
   25.63 -    # See also http://gcc.gnu.org/PR8180, which complains about the need for this step.
   25.64 -    grep -q 'gcc-[34]' "${CT_SRC_DIR}/${CT_CC_FILE}/ChangeLog" 2>/dev/null || return 0
   25.65 -
   25.66 -    CT_DoStep INFO "Installing C library headers"
   25.67 -
   25.68 -    mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   25.69 -    cd "${CT_BUILD_DIR}/build-libc-headers"
   25.70 -
   25.71 -    CT_DoLog EXTRA "Configuring C library"
   25.72 -
   25.73 -    # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
   25.74 -    # 1. override CC to keep glibc's configure from using $TARGET-gcc. 
   25.75 -    # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly
   25.76 -    # 3. build with gcc 3.2 or later
   25.77 -    # Compare these options with the ones used when building glibc for real below - they're different.
   25.78 -    # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode
   25.79 -    # so when configure checks to make sure gcc has access to the assembler you just built...
   25.80 -    # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path.
   25.81 -    # Set --build so maybe we don't have to specify "cross-compiling=yes" below (haven't tried yet)
   25.82 -    # Note: the warning
   25.83 -    # "*** WARNING: Are you sure you do not want to use the `linuxthreads'"
   25.84 -    # *** add-on?"
   25.85 -    # is ok here, since all we want are the basic headers at this point.
   25.86 -    # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
   25.87 -    # 'a version of binutils that supports .machine "altivec" is needed'.
   25.88 -
   25.89 -    addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
   25.90 -    # We need to remove any threading addon when installing headers
   25.91 -    addons_config="${addons_config//nptl/}"
   25.92 -    addons_config="${addons_config//linuxthreads/}"
   25.93 -    addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;')
   25.94 -
   25.95 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
   25.96 -    CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
   25.97 -    CT_DoLog DEBUG "Extra config passed : '${addons_config}'"
   25.98 -
   25.99 -    libc_cv_ppc_machine=yes                     \
  25.100 -    CC=${cross_cc}                              \
  25.101 -    CT_DoExecLog ALL                            \
  25.102 -    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"   \
  25.103 -        --build="${CT_UNIQ_BUILD}"              \
  25.104 -        --host="${CT_TARGET}"                   \
  25.105 -        --prefix=/usr                           \
  25.106 -        --with-headers="${CT_HEADERS_DIR}"      \
  25.107 -        --without-cvs                           \
  25.108 -        --disable-sanity-checks                 \
  25.109 -        --enable-hacker-mode                    \
  25.110 -        ${addons_config}                        \
  25.111 -        --without-nptl
  25.112 -
  25.113 -    CT_DoLog EXTRA "Installing C library headers"
  25.114 -
  25.115 -    if grep -q GLIBC_2.3 "${CT_SRC_DIR}/${CT_LIBC_FILE}/ChangeLog"; then
  25.116 -        # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
  25.117 -        # which fails without a real cross-compiler.
  25.118 -        # Fortunately, we don't need errlist-compat.c, since we just need .h
  25.119 -        # files, so work around this by creating a fake errlist-compat.c and
  25.120 -        # satisfying its dependencies.
  25.121 -        # Another workaround might be to tell configure to not use any cross
  25.122 -        # options to $(CC).
  25.123 -        # The real fix would be to get install-headers to not generate
  25.124 -        # errlist-compat.c.
  25.125 -        # Note: BOOTSTRAP_GCC is used by:
  25.126 -        # patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
  25.127 -
  25.128 -        libc_cv_ppc_machine=yes                         \
  25.129 -        CT_DoExecLog ALL                                \
  25.130 -        make CFLAGS="-O -DBOOTSTRAP_GCC"                \
  25.131 -             OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"    \
  25.132 -             sysdeps/gnu/errlist.c
  25.133 -        mkdir -p stdio-common
  25.134 -
  25.135 -        # sleep for 2 seconds for benefit of filesystems with lousy time
  25.136 -        # resolution, like FAT, so make knows for sure errlist-compat.c doesn't
  25.137 -        # need generating
  25.138 -        sleep 2
  25.139 -        CT_DoExecLog ALL touch stdio-common/errlist-compat.c
  25.140 -    fi
  25.141 -    # Note: BOOTSTRAP_GCC (see above)
  25.142 -    libc_cv_ppc_machine=yes                         \
  25.143 -    CT_DoExecLog ALL                                \
  25.144 -    make cross-compiling=yes                        \
  25.145 -         install_root=${CT_SYSROOT_DIR}             \
  25.146 -         CFLAGS="-O -DBOOTSTRAP_GCC"                \
  25.147 -         ${LIBC_SYSROOT_ARG}                        \
  25.148 -         OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"    \
  25.149 -         install-headers
  25.150 -
  25.151 -    # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
  25.152 -    # so do them by hand.  We can tolerate an empty stubs.h for the moment.
  25.153 -    # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
  25.154 -    mkdir -p "${CT_HEADERS_DIR}/gnu"
  25.155 -    CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
  25.156 -    CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/${CT_LIBC_FILE}/include/features.h"  \
  25.157 -                           "${CT_HEADERS_DIR}/features.h"
  25.158 -
  25.159 -    # Building the bootstrap gcc requires either setting inhibit_libc, or
  25.160 -    # having a copy of stdio_lim.h... see
  25.161 -    # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
  25.162 -    CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
  25.163 -
  25.164 -    # Following error building gcc-4.0.0's gcj:
  25.165 -    #  error: bits/syscall.h: No such file or directory
  25.166 -    # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
  25.167 -    # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
  25.168 -    [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
  25.169 -
  25.170 -    # Those headers are to be manually copied so gcc can build properly
  25.171 -    pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
  25.172 -    pthreadtypes_h=
  25.173 -    case "${CT_THREADS}" in
  25.174 -        nptl)
  25.175 -            # NOTE: for some archs, the pathes are different, but they are not
  25.176 -            # supported by crosstool-NG right now. See original crosstool when they are.
  25.177 -            pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
  25.178 -            pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
  25.179 -            if [ ! -f "${pthreadtypes_h}" ]; then
  25.180 -                pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_LIBC}-ports-${CT_LIBC_VERSION}/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
  25.181 -            fi
  25.182 -            ;;
  25.183 -        linuxthreads)
  25.184 -            pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
  25.185 -            ;;
  25.186 -        *)
  25.187 -            pthread_h=
  25.188 -            pthreadtypes_h=
  25.189 -            ;;
  25.190 -    esac
  25.191 -    if [ -n "${pthread_h}" ]; then
  25.192 -        CT_DoExecLog ALL cp -v "${pthread_h}" "${CT_HEADERS_DIR}/pthread.h"
  25.193 -    fi
  25.194 -    if [ -n "${pthreadtypes_h}" ]; then
  25.195 -        CT_DoExecLog ALL cp -v "${pthreadtypes_h}" "${CT_HEADERS_DIR}/bits/pthreadtypes.h"
  25.196 -    fi
  25.197 -
  25.198 -    CT_EndStep
  25.199 -}
  25.200 -
  25.201 -# Build and install start files
  25.202 -do_libc_start_files() {
  25.203 -    # Needed only in the NPTL case. Otherwise, return.
  25.204 -    [ "${CT_THREADS}" = "nptl" ] || return 0
  25.205 -
  25.206 -    CT_DoStep INFO "Installing C library start files"
  25.207 -
  25.208 -    mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
  25.209 -    cd "${CT_BUILD_DIR}/build-libc-startfiles"
  25.210 -
  25.211 -    CT_DoLog EXTRA "Configuring C library"
  25.212 -
  25.213 -    # Add some default glibc config options if not given by user.
  25.214 -    extra_config=""
  25.215 -    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  25.216 -        *enable-kernel*) ;;
  25.217 -        *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  25.218 -    esac
  25.219 -    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  25.220 -        *-tls*) ;;
  25.221 -        *) extra_config="${extra_config} --with-tls"
  25.222 -    esac
  25.223 -    case "${CT_SHARED_LIBS}" in
  25.224 -        y) extra_config="${extra_config} --enable-shared";;
  25.225 -        *) extra_config="${extra_config} --disable-shared";;
  25.226 -    esac
  25.227 -    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  25.228 -        y,) extra_config="${extra_config} --with-fp";;
  25.229 -        ,y) extra_config="${extra_config} --without-fp";;
  25.230 -    esac
  25.231 -    # Obviously, we want threads, as we come here only for NPTL
  25.232 -    extra_config="${extra_config} --with-__thread"
  25.233 -
  25.234 -    addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
  25.235 -    extra_config="${extra_config} ${addons_config}"
  25.236 -
  25.237 -    # Add some default CC args
  25.238 -    glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  25.239 -    glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  25.240 -    # In case we're using a snapshot, fake a >=2.6 version.
  25.241 -    if [    "${CT_LIBC_V_LATEST}" = "y" \
  25.242 -         -o "${CT_LIBC_V_date}" = "y"   ]; then
  25.243 -        glibc_version_major=3
  25.244 -        glibc_version_minor=0
  25.245 -    fi
  25.246 -    if [    ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6    \
  25.247 -         -o ${glibc_version_major} -gt 2                                    ]; then
  25.248 -        # Don't use -pipe: configure chokes on it for glibc >= 2.6.
  25.249 -        CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
  25.250 -        extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
  25.251 -    else
  25.252 -        extra_cc_args="${CT_CFLAGS_FOR_HOST}"
  25.253 -    fi
  25.254 -    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  25.255 -
  25.256 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  25.257 -    CT_DoLog DEBUG "Using gcc for target    : '${cross_cc}'"
  25.258 -    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  25.259 -    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  25.260 -    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  25.261 -
  25.262 -    # Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2
  25.263 -    # note: this is awkward, doesn't work well if you need more than one
  25.264 -    # line in configparms
  25.265 -    echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
  25.266 -
  25.267 -    echo "libc_cv_forced_unwind=yes" > config.cache
  25.268 -    echo "libc_cv_c_cleanup=yes" >> config.cache
  25.269 -
  25.270 -    # Please see the comment for the configure step in do_libc().
  25.271 -
  25.272 -    BUILD_CC=${CT_CC_NATIVE}                                        \
  25.273 -    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O "  \
  25.274 -    CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}"      \
  25.275 -    AR=${CT_TARGET}-ar                                              \
  25.276 -    RANLIB=${CT_TARGET}-ranlib                                      \
  25.277 -    CT_DoExecLog ALL                                                \
  25.278 -    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  25.279 -        --prefix=/usr                                               \
  25.280 -        --build="${CT_UNIQ_BUILD}"                                  \
  25.281 -        --host=${CT_TARGET}                                         \
  25.282 -        --without-cvs                                               \
  25.283 -        --disable-profile                                           \
  25.284 -        --disable-debug                                             \
  25.285 -        --without-gd                                                \
  25.286 -        --with-headers="${CT_HEADERS_DIR}"                          \
  25.287 -        --cache-file=config.cache                                   \
  25.288 -        ${extra_config}                                             \
  25.289 -        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  25.290 -
  25.291 -
  25.292 -    #TODO: should check whether slibdir has been set in configparms to */lib64
  25.293 -    #      and copy the startfiles into the appropriate libdir.
  25.294 -    CT_DoLog EXTRA "Building C library start files"
  25.295 -    CT_DoExecLog ALL make OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" csu/subdir_lib
  25.296 -
  25.297 -    CT_DoLog EXTRA "Installing C library start files"
  25.298 -    if [ "${CT_USE_SYSROOT}" = "y" ]; then
  25.299 -        CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/usr/lib/"
  25.300 -    else
  25.301 -        CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/lib/"
  25.302 -    fi
  25.303 -
  25.304 -    CT_EndStep
  25.305 -}
  25.306 -
  25.307 -# This function builds and install the full glibc
  25.308 -do_libc() {
  25.309 -    CT_DoStep INFO "Installing C library"
  25.310 -
  25.311 -    mkdir -p "${CT_BUILD_DIR}/build-libc"
  25.312 -    cd "${CT_BUILD_DIR}/build-libc"
  25.313 -
  25.314 -    CT_DoLog EXTRA "Configuring C library"
  25.315 -
  25.316 -    # Add some default glibc config options if not given by user.
  25.317 -    # We don't need to be conditional on wether the user did set different
  25.318 -    # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
  25.319 -
  25.320 -    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
  25.321 -
  25.322 -    case "${CT_THREADS}" in
  25.323 -        nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
  25.324 -        linuxthreads)   extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
  25.325 -        none)           extra_config="${extra_config} --without-__thread --without-nptl"
  25.326 -                        case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
  25.327 -                            *-tls*) ;;
  25.328 -                            *) extra_config="${extra_config} --without-tls";;
  25.329 -                        esac
  25.330 -                        ;;
  25.331 -    esac
  25.332 -
  25.333 -    case "${CT_SHARED_LIBS}" in
  25.334 -        y) extra_config="${extra_config} --enable-shared";;
  25.335 -        *) extra_config="${extra_config} --disable-shared";;
  25.336 -    esac
  25.337 -
  25.338 -    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  25.339 -        y,) extra_config="${extra_config} --with-fp";;
  25.340 -        ,y) extra_config="${extra_config} --without-fp";;
  25.341 -    esac
  25.342 -
  25.343 -    case "$(do_libc_add_ons_list ,)" in
  25.344 -        "") ;;
  25.345 -        *)  extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
  25.346 -    esac
  25.347 -
  25.348 -    # Add some default CC args
  25.349 -    glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
  25.350 -    glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
  25.351 -    # In case we're using a snapshot, fake a >=2.6 version.
  25.352 -    if [    "${CT_LIBC_V_LATEST}" = "y" \
  25.353 -         -o "${CT_LIBC_V_date}" = "y"   ]; then
  25.354 -        glibc_version_major=3
  25.355 -        glibc_version_minor=0
  25.356 -    fi
  25.357 -    if [    ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6    \
  25.358 -         -o ${glibc_version_major} -gt 2                                    ]; then
  25.359 -        # Don't use -pipe: configure chokes on it for glibc >= 2.6.
  25.360 -        CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
  25.361 -        extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
  25.362 -    else
  25.363 -        extra_cc_args="${CT_CFLAGS_FOR_HOST}"
  25.364 -    fi
  25.365 -    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
  25.366 -
  25.367 -    cross_cc=$(CT_Which "${CT_TARGET}-gcc")
  25.368 -    CT_DoLog DEBUG "Using gcc for target    : '${cross_cc}'"
  25.369 -    CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
  25.370 -    CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
  25.371 -    CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
  25.372 -
  25.373 -    # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
  25.374 -    # note: this is awkward, doesn't work well if you need more than one line in configparms
  25.375 -    echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
  25.376 -
  25.377 -    # For glibc 2.3.4 and later we need to set some autoconf cache
  25.378 -    # variables, because nptl/sysdeps/pthread/configure.in does not
  25.379 -    # work when cross-compiling.
  25.380 -    if [ "${CT_THREADS}" = "nptl" ]; then
  25.381 -        echo libc_cv_forced_unwind=yes
  25.382 -        echo libc_cv_c_cleanup=yes
  25.383 -    fi >config.cache
  25.384 -
  25.385 -    # Configure with --prefix the way we want it on the target...
  25.386 -    # There are a whole lot of settings here.  You'll probably want
  25.387 -    # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
  25.388 -    # Compare these options with the ones used when installing the glibc headers above - they're different.
  25.389 -    # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory" 
  25.390 -    # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html. 
  25.391 -    # Set BUILD_CC, or you won't be able to build datafiles
  25.392 -    # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs
  25.393 -
  25.394 -    # OK. I'm fed up with those folks telling me what I should do.
  25.395 -    # I don't configure nptl? Well, maybe that's purposedly because
  25.396 -    # I don't want nptl! --disable-sanity-checks will shut up those
  25.397 -    # silly messages. GNU folks again, he?
  25.398 -
  25.399 -    BUILD_CC=${CT_CC_NATIVE}                                        \
  25.400 -    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O"   \
  25.401 -    CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
  25.402 -    AR=${CT_TARGET}-ar                                              \
  25.403 -    RANLIB=${CT_TARGET}-ranlib                                      \
  25.404 -    CT_DoExecLog ALL                                                \
  25.405 -    "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure"                       \
  25.406 -        --prefix=/usr                                               \
  25.407 -        --build=${CT_UNIQ_BUILD}                                    \
  25.408 -        --host=${CT_TARGET}                                         \
  25.409 -        --without-cvs                                               \
  25.410 -        --disable-profile                                           \
  25.411 -        --disable-debug                                             \
  25.412 -        --without-gd                                                \
  25.413 -        --disable-sanity-checks                                     \
  25.414 -        --cache-file=config.cache                                   \
  25.415 -        --with-headers="${CT_HEADERS_DIR}"                          \
  25.416 -        ${extra_config}                                             \
  25.417 -        ${CT_LIBC_GLIBC_EXTRA_CONFIG}
  25.418 -
  25.419 -    if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
  25.420 -        # nptl-era glibc.
  25.421 -        # If the install-lib-all target (which is added by our make-install-lib-all.patch)
  25.422 -        # is present, it means we're building glibc-2.3.3 or later, and we can't
  25.423 -        # build programs yet, as they require libeh, which won't be installed
  25.424 -        # until full build of gcc
  25.425 -        # YEM-FIXME: This comment is misleading: latest glibc-s do not have the
  25.426 -        #            make-install-lib-all.patch applied, so do not pass through this
  25.427 -        #            part of the if statement; nonetheless, they do build, and
  25.428 -        #            the result is useable (maybe the dual-pass core gcc is
  25.429 -        #            responsible for this).
  25.430 -        GLIBC_INITIAL_BUILD_RULE=lib
  25.431 -        GLIBC_INITIAL_INSTALL_RULE="install-lib-all install-headers"
  25.432 -        GLIBC_INSTALL_APPS_LATER=yes
  25.433 -    else
  25.434 -        # classic glibc.  
  25.435 -        # We can build and install everything with the bootstrap compiler.
  25.436 -        # YEM-FIXME: See the above FIXME as well.
  25.437 -        GLIBC_INITIAL_BUILD_RULE=all
  25.438 -        GLIBC_INITIAL_INSTALL_RULE=install
  25.439 -        GLIBC_INSTALL_APPS_LATER=no
  25.440 -    fi
  25.441 -
  25.442 -    # If this fails with an error like this:
  25.443 -    # ...  linux/autoconf.h: No such file or directory 
  25.444 -    # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
  25.445 -    # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
  25.446 -    # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
  25.447 -    # No need for PARALLELMFLAGS here, Makefile already reads this environment variable
  25.448 -    CT_DoLog EXTRA "Building C library"
  25.449 -    CT_DoExecLog ALL make LD=${CT_TARGET}-ld                        \
  25.450 -                           RANLIB=${CT_TARGET}-ranlib               \
  25.451 -                           OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"  \
  25.452 -                           ${GLIBC_INITIAL_BUILD_RULE}
  25.453 -
  25.454 -    CT_DoLog EXTRA "Installing C library"
  25.455 -    CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}"          \
  25.456 -                          ${LIBC_SYSROOT_ARG}                       \
  25.457 -                          OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"   \
  25.458 -                          ${GLIBC_INITIAL_INSTALL_RULE}
  25.459 -
  25.460 -    # This doesn't seem to work when building a crosscompiler,
  25.461 -    # as it tries to execute localedef using the just-built ld.so!?
  25.462 -    #CT_DoLog EXTRA "Installing locales"
  25.463 -    #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
  25.464 -
  25.465 -    # Fix problems in linker scripts.
  25.466 -    #
  25.467 -    # 1. Remove absolute paths
  25.468 -    # Any file in a list of known suspects that isn't a symlink is assumed to be a linker script.
  25.469 -    # FIXME: test -h is not portable
  25.470 -    # FIXME: probably need to check more files than just these three...
  25.471 -    # Need to use sed instead of just assuming we know what's in libc.so because otherwise alpha breaks
  25.472 -    #
  25.473 -    # 2. Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
  25.474 -    # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
  25.475 -    #
  25.476 -    # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
  25.477 -    CT_DoLog EXTRA "Fixing C library linker scripts"
  25.478 -    for file in libc.so libpthread.so libgcc_s.so; do
  25.479 -        for dir in lib lib64 usr/lib usr/lib64; do
  25.480 -            if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
  25.481 -                CT_DoExecLog ALL cp -v "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
  25.482 -                CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
  25.483 -                CT_DoExecLog ALL sed -i -r -e 's,/usr/lib/,,g;
  25.484 -                                               s,/usr/lib64/,,g;
  25.485 -                                               s,/lib/,,g;
  25.486 -                                               s,/lib64/,,g;
  25.487 -                                               /BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
  25.488 -            fi
  25.489 -        done
  25.490 -    done
  25.491 -
  25.492 -    CT_EndStep
  25.493 -}
  25.494 -
  25.495 -# This function finishes the glibc install
  25.496 -do_libc_finish() {
  25.497 -    # Finally, build and install glibc programs, now that libeh (if any) is installed
  25.498 -    # Don't do this unless needed, 'cause it causes glibc-2.{1.3,2.2} to fail here with
  25.499 -    # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__deregister_frame_info'
  25.500 -    # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__register_frame_info'
  25.501 -    [ "${GLIBC_INSTALL_APPS_LATER}" = "yes" ] || return 0
  25.502 -
  25.503 -    CT_DoStep INFO "Finishing C library"
  25.504 -
  25.505 -    cd "${CT_BUILD_DIR}/build-libc"
  25.506 -
  25.507 -    CT_DoLog EXTRA "Re-building C library"
  25.508 -    CT_DoExecLog ALL make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib
  25.509 -
  25.510 -    CT_DoLog EXTRA "Installing missing C library components"
  25.511 -    # note: should do full install and then fix linker scripts, but this is faster
  25.512 -    for t in bin rootsbin sbin data others; do
  25.513 -        CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}"          \
  25.514 -                              ${LIBC_SYSROOT_ARG}                       \
  25.515 -                              OBJDUMP_FOR_HOST="${CT_TARGET}-objdump"   \
  25.516 -                              install-${t}
  25.517 -    done
  25.518 -
  25.519 -    CT_EndStep
  25.520 -}
  25.521 -
  25.522 -# Build up the addons list, separated with $1
  25.523 -do_libc_add_ons_list() {
  25.524 -    local sep="$1"
  25.525 -    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
  25.526 -    case "${CT_THREADS}" in
  25.527 -        none)   ;;
  25.528 -        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
  25.529 -    esac
  25.530 -    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
  25.531 -    addons_list="${addons_list%%${sep}}"
  25.532 -    echo "${addons_list##${sep}}"
  25.533 -}
  25.534 -
    26.1 --- a/scripts/build/libc_uClibc.sh	Thu Sep 11 09:02:00 2008 +0000
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,313 +0,0 @@
    26.4 -# This file declares functions to install the uClibc C library
    26.5 -# Copyright 2007 Yann E. MORIN
    26.6 -# Licensed under the GPL v2. See COPYING in the root of this package
    26.7 -
    26.8 -do_print_filename() {
    26.9 -    [ "${CT_LIBC}" = "uClibc" ] || return 0
   26.10 -    echo "uClibc-${CT_LIBC_VERSION}"
   26.11 -    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && echo "uClibc-locale-030818" || true
   26.12 -}
   26.13 -
   26.14 -# Download uClibc
   26.15 -do_libc_get() {
   26.16 -    libc_src="http://www.uclibc.org/downloads
   26.17 -              http://www.uclibc.org/downloads/snapshots
   26.18 -              http://www.uclibc.org/downloads/old-releases"
   26.19 -    # For uClibc, we have almost every thing: releases, and snapshots
   26.20 -    # for the last month or so. We'll have to deal with svn revisions
   26.21 -    # later...
   26.22 -    CT_GetFile "${CT_LIBC_FILE}" ${libc_src}
   26.23 -    # uClibc locales
   26.24 -    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} || true
   26.25 -
   26.26 -    return 0
   26.27 -}
   26.28 -
   26.29 -# Extract uClibc
   26.30 -do_libc_extract() {
   26.31 -    CT_ExtractAndPatch "${CT_LIBC_FILE}"
   26.32 -    # uClibc locales
   26.33 -    [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818" || true
   26.34 -
   26.35 -    return 0
   26.36 -}
   26.37 -
   26.38 -# Check that uClibc has been previously configured
   26.39 -do_libc_check_config() {
   26.40 -    CT_DoStep INFO "Checking C library configuration"
   26.41 -
   26.42 -    CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}"
   26.43 -
   26.44 -    if egrep '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
   26.45 -        CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
   26.46 -        CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
   26.47 -    fi
   26.48 -
   26.49 -    CT_DoLog EXTRA "Munging uClibc configuration"
   26.50 -    mungeuClibcConfig "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_BUILD_DIR}/uClibc.config"
   26.51 -
   26.52 -    CT_EndStep
   26.53 -}
   26.54 -
   26.55 -# This functions installs uClibc's headers
   26.56 -do_libc_headers() {
   26.57 -    # Only need to install bootstrap uClibc headers for gcc-3.0 and above?  Or maybe just gcc-3.3 and above?
   26.58 -    # See also http://gcc.gnu.org/PR8180, which complains about the need for this step.
   26.59 -    grep -q 'gcc-[34]' "${CT_SRC_DIR}/${CT_CC_FILE}/ChangeLog" 2>/dev/null || return 0
   26.60 -
   26.61 -    CT_DoStep INFO "Installing C library headers"
   26.62 -
   26.63 -    mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
   26.64 -    cd "${CT_BUILD_DIR}/build-libc-headers"
   26.65 -
   26.66 -    # Simply copy files until uClibc has the ablity to build out-of-tree
   26.67 -    CT_DoLog EXTRA "Copying sources to build dir"
   26.68 -    { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
   26.69 -
   26.70 -    # Retrieve the config file
   26.71 -    cp "${CT_BUILD_DIR}/uClibc.config" .config
   26.72 -
   26.73 -    # uClibc uses the CROSS environment variable as a prefix to the
   26.74 -    # compiler tools to use.  Setting it to the empty string forces
   26.75 -    # use of the native build host tools, which we need at this
   26.76 -    # stage, as we don't have target tools yet.
   26.77 -    CT_DoLog EXTRA "Applying configuration"
   26.78 -    CT_DoYes "" |CT_DoExecLog ALL make CROSS= PREFIX="${CT_SYSROOT_DIR}/" oldconfig
   26.79 -
   26.80 -    CT_DoLog EXTRA "Building headers"
   26.81 -    CT_DoExecLog ALL make ${CT_LIBC_UCLIBC_VERBOSITY} CROSS= PREFIX="${CT_SYSROOT_DIR}/" headers
   26.82 -
   26.83 -    CT_DoLog EXTRA "Installing headers"
   26.84 -    CT_DoExecLog ALL make ${CT_LIBC_UCLIBC_VERBOSITY} CROSS= PREFIX="${CT_SYSROOT_DIR}/" install_dev
   26.85 -
   26.86 -    CT_EndStep
   26.87 -}
   26.88 -
   26.89 -# Build and install start files
   26.90 -do_libc_start_files() {
   26.91 -    :
   26.92 -}
   26.93 -
   26.94 -# This function build and install the full uClibc
   26.95 -do_libc() {
   26.96 -    CT_DoStep INFO "Installing C library"
   26.97 -
   26.98 -    mkdir -p "${CT_BUILD_DIR}/build-libc"
   26.99 -    cd "${CT_BUILD_DIR}/build-libc"
  26.100 -
  26.101 -    # Simply copy files until uClibc has the ablity to build out-of-tree
  26.102 -    CT_DoLog EXTRA "Copying sources to build dir"
  26.103 -    { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
  26.104 -
  26.105 -    # Retrieve the config file
  26.106 -    cp "${CT_BUILD_DIR}/uClibc.config" .config
  26.107 -
  26.108 -    # uClibc uses the CROSS environment variable as a prefix to the compiler
  26.109 -    # tools to use.  The newly built tools should be in our path, so we need
  26.110 -    # only give the correct name for them.
  26.111 -    # Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
  26.112 -    # depending  on the configuration of the library. That is, they are tailored
  26.113 -    # to best fit the target. So it is useless and seems to be a bad thing to
  26.114 -    # use LIBC_EXTRA_CFLAGS here.
  26.115 -    CT_DoLog EXTRA "Applying configuration"
  26.116 -    CT_DoYes "" |CT_DoExecLog ALL               \
  26.117 -                 make CROSS=${CT_TARGET}-       \
  26.118 -                 PREFIX="${CT_SYSROOT_DIR}/"    \
  26.119 -                 oldconfig
  26.120 -
  26.121 -    # We do _not_ want to strip anything for now, in case we specifically
  26.122 -    # asked for a debug toolchain, thus the STRIPTOOL= assignment
  26.123 -    CT_DoLog EXTRA "Building C library"
  26.124 -    CT_DoExecLog ALL                    \
  26.125 -    make CROSS=${CT_TARGET}-            \
  26.126 -         PREFIX="${CT_SYSROOT_DIR}/"    \
  26.127 -         STRIPTOOL=true                 \
  26.128 -         ${CT_LIBC_UCLIBC_VERBOSITY}    \
  26.129 -         all
  26.130 -
  26.131 -    # YEM-FIXME: we want to install libraries in $SYSROOT/lib, but we don't want
  26.132 -    # to install headers in $SYSROOT/include, thus making only install_runtime.
  26.133 -    # Plus, the headers were previously installed earlier with install_dev, so
  26.134 -    # all should be well. Unfortunately, the install_dev target does not install
  26.135 -    # crti.o and consorts... :-( So reverting to target 'install'.
  26.136 -    # Note: PARALLELMFLAGS is not usefull for installation.
  26.137 -    # We do _not_ want to strip anything for now, in case we specifically
  26.138 -    # asked for a debug toolchain, thus the STRIPTOOL= assignment
  26.139 -    CT_DoLog EXTRA "Installing C library"
  26.140 -    CT_DoExecLog ALL                    \
  26.141 -    make CROSS=${CT_TARGET}-            \
  26.142 -         PREFIX="${CT_SYSROOT_DIR}/"    \
  26.143 -         STRIPTOOL=true                 \
  26.144 -         ${CT_LIBC_UCLIBC_VERBOSITY}    \
  26.145 -         install
  26.146 -
  26.147 -    CT_EndStep
  26.148 -}
  26.149 -
  26.150 -# This function is used to install those components needing the final C compiler
  26.151 -do_libc_finish() {
  26.152 -    :
  26.153 -}
  26.154 -
  26.155 -# Initialises the .config file to sensible values
  26.156 -# $1: original file
  26.157 -# $2: munged file
  26.158 -mungeuClibcConfig() {
  26.159 -    src_config_file="$1"
  26.160 -    dst_config_file="$2"
  26.161 -    munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed"
  26.162 -
  26.163 -    # Start with a fresh file
  26.164 -    rm -f "${munge_file}"
  26.165 -    touch "${munge_file}"
  26.166 -
  26.167 -    # Hack our target in the config file.
  26.168 -    # Also remove stripping: its the responsibility of the
  26.169 -    # firmware builder to strip or not.
  26.170 -    cat >>"${munge_file}" <<-ENDSED
  26.171 -s/^(TARGET_.*)=y$/# \\1 is not set/
  26.172 -s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/
  26.173 -s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/
  26.174 -s/.*(DOSTRIP).*/# \\1 is not set/
  26.175 -ENDSED
  26.176 -
  26.177 -    # Ah. We may one day need architecture-specific handler here...
  26.178 -    # Hack the ARM {E,O}ABI into the config file
  26.179 -    if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
  26.180 -        cat >>"${munge_file}" <<-ENDSED
  26.181 -s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
  26.182 -s/.*(CONFIG_ARM_EABI).*/\\1=y/
  26.183 -ENDSED
  26.184 -    else
  26.185 -        cat >>"${munge_file}" <<-ENDSED
  26.186 -s/.*(CONFIG_ARM_OABI).*/\\1=y/
  26.187 -s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
  26.188 -ENDSED
  26.189 -    fi
  26.190 -
  26.191 -    # Accomodate for old and new uClibc versions, where the
  26.192 -    # way to select between big/little endian has changed
  26.193 -    case "${CT_ARCH_BE},${CT_ARCH_LE}" in
  26.194 -        y,) cat >>"${munge_file}" <<-ENDSED
  26.195 -s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
  26.196 -s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
  26.197 -s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
  26.198 -s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
  26.199 -ENDSED
  26.200 -        ;;
  26.201 -        ,y) cat >>"${munge_file}" <<-ENDSED
  26.202 -s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
  26.203 -s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
  26.204 -s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
  26.205 -s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
  26.206 -ENDSED
  26.207 -        ;;
  26.208 -    esac
  26.209 -
  26.210 -    # Accomodate for old and new uClibc version, where the
  26.211 -    # way to select between hard/soft float has changed
  26.212 -    case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
  26.213 -        y,) cat >>"${munge_file}" <<-ENDSED
  26.214 -s/^[^_]*(HAS_FPU).*/\\1=y/
  26.215 -s/.*(UCLIBC_HAS_FPU).*/\\1=y/
  26.216 -ENDSED
  26.217 -            ;;
  26.218 -        ,y) cat >>"${munge_file}" <<-ENDSED
  26.219 -s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
  26.220 -s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
  26.221 -ENDSED
  26.222 -            ;;
  26.223 -    esac
  26.224 -
  26.225 -    # Change paths to work with crosstool-NG
  26.226 -    # From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev
  26.227 -    #  " we just want the kernel headers, not the whole kernel source ...
  26.228 -    #  " so people may need to update their paths slightly
  26.229 -    quoted_kernel_source=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\/,g;')
  26.230 -    quoted_headers_dir=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/,\\/,g;')
  26.231 -    # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
  26.232 -    # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
  26.233 -    # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and
  26.234 -    # newer versions use KERNEL_HEADERS (which is right). See:
  26.235 -    cat >>"${munge_file}" <<-ENDSED
  26.236 -s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
  26.237 -s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
  26.238 -s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
  26.239 -s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
  26.240 -s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
  26.241 -s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
  26.242 -ENDSED
  26.243 -
  26.244 -    if [ "${CT_USE_PIPES}" = "y" ]; then
  26.245 -        if grep UCLIBC_EXTRA_CFLAGS extra/Configs/Config.in >/dev/null 2>&1; then
  26.246 -            # Good, there is special provision for such things as -pipe!
  26.247 -            cat >>"${munge_file}" <<-ENDSED
  26.248 -s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
  26.249 -ENDSED
  26.250 -        else
  26.251 -            # Hack our -pipe into WARNINGS, which will be internally incorporated to
  26.252 -            # CFLAGS. This a dirty hack, but yet needed
  26.253 -            cat >> "${munge_file}" <<-ENDSED
  26.254 -s/^(WARNINGS=".*)"$/\\1 -pipe"/
  26.255 -ENDSED
  26.256 -        fi
  26.257 -    fi
  26.258 -
  26.259 -    # Force on options needed for C++ if we'll be making a C++ compiler.
  26.260 -    # Note that the two PREGEN_LOCALE and the XLOCALE lines may be missing
  26.261 -    # entirely if LOCALE is not set.  If LOCALE was already set, we'll
  26.262 -    # assume the user has already made all the appropriate generation
  26.263 -    # arrangements.  Note that having the uClibc Makefile download the
  26.264 -    # pregenerated locales is not compatible with crosstool; besides,
  26.265 -    # crosstool downloads them as part of getandpatch.sh.
  26.266 -    if [ "${CT_CC_LANG_CXX}" = "y" ]; then
  26.267 -        cat >>"${munge_file}" <<-ENDSED
  26.268 -s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
  26.269 -s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
  26.270 -# Add these three lines when doing C++?
  26.271 -s/^# UCLIBC_HAS_WCHAR is not set/UCLIBC_HAS_WCHAR=y/
  26.272 -#s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\nUCLIBC_PREGENERATED_LOCALE_DATA=y\\n\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\n\\# UCLIBC_HAS_XLOCALE is not set/
  26.273 -s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
  26.274 -ENDSED
  26.275 -    fi
  26.276 -
  26.277 -    # Always build the libpthread_db
  26.278 -    cat >>"${munge_file}" <<-ENDSED
  26.279 -s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
  26.280 -ENDSED
  26.281 -
  26.282 -    # Force on debug options if asked for
  26.283 -    case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
  26.284 -      0)
  26.285 -        cat >>"${munge_file}" <<-ENDSED
  26.286 -s/^DODEBUG=y/# DODEBUG is not set/
  26.287 -s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
  26.288 -s/^DOASSERTS=y/# DOASSERTS is not set/
  26.289 -s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
  26.290 -s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
  26.291 -s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
  26.292 -ENDSED
  26.293 -        ;;
  26.294 -      1)
  26.295 -        cat >>"${munge_file}" <<-ENDSED
  26.296 -s/^# DODEBUG is not set.*/DODEBUG=y/
  26.297 -s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
  26.298 -s/^DOASSERTS=y/# DOASSERTS is not set/
  26.299 -s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
  26.300 -s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
  26.301 -s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
  26.302 -ENDSED
  26.303 -        ;;
  26.304 -      2)
  26.305 -        cat >>"${munge_file}" <<-ENDSED
  26.306 -s/^# DODEBUG is not set.*/DODEBUG=y/
  26.307 -s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
  26.308 -s/^# DOASSERTS is not set.*/DOASSERTS=y/
  26.309 -s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
  26.310 -s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
  26.311 -s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
  26.312 -ENDSED
  26.313 -        ;;
  26.314 -    esac
  26.315 -    sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
  26.316 -}
    27.1 --- a/scripts/crosstool.sh	Thu Sep 11 09:02:00 2008 +0000
    27.2 +++ b/scripts/crosstool.sh	Sun Sep 14 16:21:07 2008 +0000
    27.3 @@ -356,8 +356,8 @@
    27.4  . "${CT_LIB_DIR}/scripts/build/gmp.sh"
    27.5  . "${CT_LIB_DIR}/scripts/build/mpfr.sh"
    27.6  . "${CT_LIB_DIR}/scripts/build/binutils.sh"
    27.7 -. "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh"
    27.8 -. "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh"
    27.9 +. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
   27.10 +. "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh"
   27.11  . "${CT_LIB_DIR}/scripts/build/debug.sh"
   27.12  . "${CT_LIB_DIR}/scripts/build/tools.sh"
   27.13  
   27.14 @@ -433,12 +433,13 @@
   27.15      find "${CT_PREFIX_DIR}/bin" -name "${CT_HOST}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
   27.16      rm -fv "${CT_PREFIX_DIR}/bin/makeinfo" |CT_DoLog DEBUG
   27.17  
   27.18 -    # Install the /populator/
   27.19 -    CT_DoLog EXTRA "Installing the populate helper"
   27.20 -    sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
   27.21 -        "${CT_LIB_DIR}/tools/populate.in"           \
   27.22 -        >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
   27.23 -    chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
   27.24 +    if [ "${CT_BARE_METAL}" != "y" ]; then
   27.25 +        CT_DoLog EXTRA "Installing the populate helper"
   27.26 +        sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
   27.27 +            "${CT_LIB_DIR}/tools/populate.in"           \
   27.28 +            >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
   27.29 +        chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
   27.30 +    fi
   27.31  
   27.32      # Create the aliases to the target tools
   27.33      CT_DoLog EXTRA "Creating toolchain aliases"
    28.1 --- a/scripts/functions	Thu Sep 11 09:02:00 2008 +0000
    28.2 +++ b/scripts/functions	Sun Sep 14 16:21:07 2008 +0000
    28.3 @@ -673,6 +673,7 @@
    28.4      # Set defaults for the system part of the tuple. Can be overriden
    28.5      # by architecture-specific values.
    28.6      case "${CT_LIBC}" in
    28.7 +        none)   CT_TARGET_SYS=elf;;
    28.8          *glibc) CT_TARGET_SYS=gnu;;
    28.9          uClibc) CT_TARGET_SYS=uclibc;;
   28.10      esac
   28.11 @@ -695,9 +696,10 @@
   28.12  
   28.13      # Finish the target tuple construction
   28.14      case "${CT_KERNEL}" in
   28.15 -        linux*)  CT_TARGET_KERNEL=linux;;
   28.16 +        none)   CT_TARGET_KERNEL=;;
   28.17 +        linux)  CT_TARGET_KERNEL=linux-;;
   28.18      esac
   28.19 -    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}")
   28.20 +    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_SYS}")
   28.21  
   28.22      # Prepare the target CFLAGS
   28.23      CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}"
    29.1 --- a/scripts/showSamples.sh	Thu Sep 11 09:02:00 2008 +0000
    29.2 +++ b/scripts/showSamples.sh	Sun Sep 14 16:21:07 2008 +0000
    29.3 @@ -30,7 +30,7 @@
    29.4          [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " "
    29.5          echo "]"
    29.6          if [ ${verbose} -ne 0 ]; then
    29.7 -            echo    "    OS        : ${CT_KERNEL}-${CT_KERNEL_VERSION}"
    29.8 +            echo    "    OS        : ${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
    29.9              if [ "${CT_GMP_MPFR}" = "y" ]; then
   29.10                  echo    "    GMP/MPFR  : gmp-${CT_GMP_VERSION} / mpfr-${CT_MPFR_VERSION}"
   29.11              fi
   29.12 @@ -44,7 +44,7 @@
   29.13              [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ",Objective-C++"
   29.14              [ -n "${CT_CC_LANG_OTHERS}"     ] && printf ",${CT_CC_LANG_OTHERS}"
   29.15              echo    ")"
   29.16 -            echo    "    C library : ${CT_LIBC}-${CT_LIBC_VERSION}"
   29.17 +            echo    "    C library : ${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
   29.18              printf  "    Tools     :"
   29.19              [ "${CT_LIBELF}"  ] && printf " libelf-${CT_LIBELF_VERSION}"
   29.20              [ "${CT_SSTRIP}"  ] && printf " sstrip"
   29.21 @@ -133,7 +133,7 @@
   29.22  done
   29.23  
   29.24  if [ "${opt}" = -w ]; then
   29.25 -    printf "^ Total: ${#@} samples  | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': Samples is curently BROKEN. |||||||||||||"
   29.26 +    printf "^ Total: ${#@} samples  | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': sample is curently BROKEN. |||||||||||||"
   29.27      echo   ""
   29.28  elif [ -z "${opt}" ]; then
   29.29      echo '      l (local)       : sample was found in current directory'