scripts/build/libc/newlib.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Oct 26 23:20:33 2009 +0100 (2009-10-26)
changeset 1589 c8619ad47c6d
parent 1588 3ccb1f76576f
child 1593 66b2463743af
permissions -rw-r--r--
libc/newlib: cleanup the build and finish steps

build step:
- ./configure
- remove glibc-specific options
- pass the target CFLAGS in the correct variable
- make:
- build in //

finish step:
- print proper message in finish step
mgl@1371
     1
# This file adds functions to build the Newlib C library
mgl@1467
     2
# Copyright 2009 DoréDevelopment
mgl@1371
     3
# Licensed under the GPL v2. See COPYING in the root of this package
mgl@1371
     4
#
mgl@1467
     5
# Edited by Martin Lund <mgl@doredevelopment.dk>
mgl@1371
     6
#
mgl@1371
     7
mgl@1371
     8
mgl@1371
     9
do_libc_get() {
mgl@1371
    10
    libc_src="ftp://sources.redhat.com/pub/newlib"
mgl@1373
    11
    avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
mgl@1373
    12
    
mgl@1373
    13
    CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
mgl@1371
    14
mgl@1373
    15
    if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
mgl@1373
    16
        CT_GetFile "avr32headers" ${avr32headers_src}
mgl@1373
    17
    fi
mgl@1371
    18
}
mgl@1371
    19
mgl@1371
    20
do_libc_extract() {
mgl@1371
    21
    CT_Extract "newlib-${CT_LIBC_VERSION}"
mgl@1371
    22
    CT_Patch "newlib-${CT_LIBC_VERSION}"
mgl@1371
    23
mgl@1373
    24
    if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
mgl@1373
    25
        CT_Extract "avr32headers"
mgl@1373
    26
    fi
mgl@1371
    27
}
mgl@1371
    28
mgl@1371
    29
do_libc_check_config() {
mgl@1371
    30
    :
mgl@1371
    31
}
mgl@1371
    32
mgl@1371
    33
do_libc_headers() {
mgl@1371
    34
    :
mgl@1371
    35
}
mgl@1371
    36
mgl@1371
    37
do_libc_start_files() {
mgl@1371
    38
    :
mgl@1371
    39
}
mgl@1371
    40
mgl@1371
    41
do_libc() {
mgl@1371
    42
    CT_DoStep INFO "Installing C library"
mgl@1371
    43
mgl@1371
    44
    mkdir -p "${CT_BUILD_DIR}/build-libc"
mgl@1371
    45
    cd "${CT_BUILD_DIR}/build-libc"
mgl@1371
    46
mgl@1371
    47
    CT_DoLog EXTRA "Configuring C library"
mgl@1371
    48
yann@1588
    49
    # Note: newlib handles the build/host/target a little bit differently
yann@1588
    50
    # than one would expect:
yann@1588
    51
    #   build  : not used
yann@1588
    52
    #   host   : the machine building newlib
yann@1588
    53
    #   target : the machine newlib runs on
yann@1589
    54
    CC_FOR_BUILD="${CT_BUILD}-gcc"                          \
yann@1589
    55
    CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS} -O"              \
yann@1589
    56
    AR=${CT_TARGET}-ar                                      \
yann@1589
    57
    RANLIB=${CT_TARGET}-ranlib                              \
yann@1589
    58
    CT_DoExecLog ALL                                        \
yann@1589
    59
    "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure"     \
yann@1589
    60
        --host=${CT_BUILD}                                  \
yann@1589
    61
        --target=${CT_TARGET}                               \
yann@1589
    62
        --prefix=${CT_PREFIX_DIR}
mgl@1371
    63
    
mgl@1371
    64
    CT_DoLog EXTRA "Building C library"
mgl@1371
    65
yann@1589
    66
    CT_DoExecLog ALL make ${PARALLELMFLAGS}
mgl@1371
    67
    
mgl@1371
    68
    CT_DoLog EXTRA "Installing C library"
mgl@1371
    69
mgl@1371
    70
    CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
mgl@1371
    71
mgl@1371
    72
    CT_EndStep
mgl@1371
    73
}
mgl@1371
    74
mgl@1371
    75
do_libc_finish() {
yann@1589
    76
    CT_DoStep INFO "Finishing C library"
mgl@1373
    77
    
mgl@1373
    78
    if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
yann@1589
    79
        CT_DoLog EXTRA "Installing Atmel's AVR32 headers"
mgl@1373
    80
        CT_DoExecLog ALL cp -r ${CT_SRC_DIR}/avr32headers "${CT_PREFIX_DIR}/${CT_TARGET}/include/avr32"
mgl@1373
    81
    fi
mgl@1373
    82
mgl@1373
    83
    CT_EndStep
mgl@1371
    84
}