scripts/build/libc/newlib.sh
author Bob Dunlop <bob.dunlop@xyzzy.org.uk>
Tue Nov 09 10:44:29 2010 +0100 (2010-11-09)
changeset 2178 42cc9bd0db7e
parent 2166 c1fe0639585a
child 2203 ac3e215141a1
permissions -rw-r--r--
libc/eglibc: fix downloading

Since Subversion 1.6.13 was released, it is no longer possible
to checkout/export to the current working directory using '.'
(eg. "svn co bla://blabla/foo/bar ." no longer extracts the content
of bar into ./ but into ./bar).

Fix this by luring Subversion to extract into "$(pwd)", which has
the advantage of working both with all known versions so far.

At the same time, remove the useless redirection.
     1 # This file adds functions to build the Newlib C library
     2 # Copyright 2009 DoréDevelopment
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 #
     5 # Edited by Martin Lund <mgl@doredevelopment.dk>
     6 #
     7 
     8 libc_newlib_version() {
     9     if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
    10         echo "${CT_LIBC_VERSION}"
    11     else
    12         echo "cvs${CT_LIBC_VERSION:+-${CT_LIBC_VERSION}}"
    13     fi
    14 }
    15 
    16 do_libc_get() {
    17     local libc_src
    18     local avr32headers_src
    19     local save_chunks
    20 
    21     libc_src="ftp://sources.redhat.com/pub/newlib"
    22     avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
    23 
    24     save_chunks="${CT_DOWNLOAD_MAX_CHUNKS}"
    25     CT_DOWNLOAD_MAX_CHUNKS=1
    26 
    27     if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
    28         CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
    29     else
    30         CT_GetCVS "newlib-$(libc_newlib_version)"                   \
    31                   ":pserver:anoncvs@sources.redhat.com:/cvs/src"    \
    32                   "newlib"                                          \
    33                   "${CT_LIBC_VERSION}"                              \
    34                   "newlib-$(libc_newlib_version)=src"
    35     fi
    36 
    37     if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
    38         CT_GetFile "avr32headers" ${avr32headers_src}
    39     fi
    40 
    41     CT_DOWNLOAD_MAX_CHUNKS="${save_chunks}"
    42 }
    43 
    44 do_libc_extract() {
    45     CT_Extract "newlib-$(libc_newlib_version)"
    46     CT_Patch "newlib" "$(libc_newlib_version)"
    47 
    48     if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
    49         CT_Extract "avr32headers"
    50     fi
    51 }
    52 
    53 do_libc_check_config() {
    54     :
    55 }
    56 
    57 do_libc_headers() {
    58     :
    59 }
    60 
    61 do_libc_start_files() {
    62     local -a newlib_opts
    63 
    64     CT_DoStep INFO "Installing C library"
    65 
    66     mkdir -p "${CT_BUILD_DIR}/build-libc"
    67     cd "${CT_BUILD_DIR}/build-libc"
    68 
    69     CT_DoLog EXTRA "Configuring C library"
    70 
    71     if [ "${CT_LIBC_NEWLIB_IO_C99FMT}" = "y" ]; then
    72         newlib_opts+=( "--enable-newlib-io-c99-formats" )
    73     else
    74         newlib_opts+=( "--disable-newlib-io-c99-formats" )
    75     fi
    76     if [ "${CT_LIBC_NEWLIB_IO_LL}" = "y" ]; then
    77         newlib_opts+=( "--enable-newlib-io-long-long" )
    78     else
    79         newlib_opts+=( "--disable-newlib-io-long-long" )
    80     fi
    81     if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then
    82         newlib_opts+=( "--enable-newlib-io-float" )
    83         if [ "${CT_LIBC_NEWLIB_IO_LDBL}" = "y" ]; then
    84             newlib_opts+=( "--enable-newlib-io-long-double" )
    85         else
    86             newlib_opts+=( "--disable-newlib-io-long-double" )
    87         fi
    88     else
    89         newlib_opts+=( "--disable-newlib-io-float" )
    90         newlib_opts+=( "--disable-newlib-io-long-double" )
    91     fi
    92 
    93     # Note: newlib handles the build/host/target a little bit differently
    94     # than one would expect:
    95     #   build  : not used
    96     #   host   : the machine building newlib
    97     #   target : the machine newlib runs on
    98     CC_FOR_BUILD="${CT_BUILD}-gcc"                      \
    99     CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS} -O"          \
   100     AR=${CT_TARGET}-ar                                  \
   101     RANLIB=${CT_TARGET}-ranlib                          \
   102     CT_DoExecLog CFG                                    \
   103     "${CT_SRC_DIR}/newlib-$(libc_newlib_version)/configure" \
   104         --host=${CT_BUILD}                              \
   105         --target=${CT_TARGET}                           \
   106         --prefix=${CT_PREFIX_DIR}                       \
   107         "${newlib_opts[@]}"
   108 
   109     CT_DoLog EXTRA "Building C library"
   110     CT_DoExecLog ALL make ${PARALLELMFLAGS}
   111 
   112     CT_DoLog EXTRA "Installing C library"
   113     CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
   114 
   115     CT_EndStep
   116 }
   117 
   118 do_libc() {
   119     :
   120 }
   121 
   122 do_libc_finish() {
   123     CT_DoStep INFO "Finishing C library"
   124     
   125     if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
   126         CT_DoLog EXTRA "Installing Atmel's AVR32 headers"
   127         CT_DoExecLog ALL cp -r ${CT_SRC_DIR}/avr32headers "${CT_PREFIX_DIR}/${CT_TARGET}/include/avr32"
   128     fi
   129 
   130     CT_EndStep
   131 }