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
5 # Edited by Martin Lund <mgl@doredevelopment.dk>
10 libc_src="ftp://sources.redhat.com/pub/newlib"
11 avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
13 CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
15 if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
16 CT_GetFile "avr32headers" ${avr32headers_src}
21 CT_Extract "newlib-${CT_LIBC_VERSION}"
22 CT_Patch "newlib-${CT_LIBC_VERSION}"
24 if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
25 CT_Extract "avr32headers"
29 do_libc_check_config() {
37 do_libc_start_files() {
42 CT_DoStep INFO "Installing C library"
44 mkdir -p "${CT_BUILD_DIR}/build-libc"
45 cd "${CT_BUILD_DIR}/build-libc"
47 CT_DoLog EXTRA "Configuring C library"
49 # Note: newlib handles the build/host/target a little bit differently
50 # than one would expect:
52 # host : the machine building newlib
53 # target : the machine newlib runs on
54 CC_FOR_BUILD="${CT_BUILD}-gcc" \
55 CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS} -O" \
57 RANLIB=${CT_TARGET}-ranlib \
59 "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
61 --target=${CT_TARGET} \
62 --prefix=${CT_PREFIX_DIR}
64 CT_DoLog EXTRA "Building C library"
66 CT_DoExecLog ALL make ${PARALLELMFLAGS}
68 CT_DoLog EXTRA "Installing C library"
70 CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
76 CT_DoStep INFO "Finishing C library"
78 if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
79 CT_DoLog EXTRA "Installing Atmel's AVR32 headers"
80 CT_DoExecLog ALL cp -r ${CT_SRC_DIR}/avr32headers "${CT_PREFIX_DIR}/${CT_TARGET}/include/avr32"