2009-05-22 14:46:18 +00:00
|
|
|
# This file adds functions to build the Newlib C library
|
2009-06-14 20:43:33 +00:00
|
|
|
# Copyright 2009 DoréDevelopment
|
2009-05-22 14:46:18 +00:00
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
#
|
2009-06-14 20:43:33 +00:00
|
|
|
# Edited by Martin Lund <mgl@doredevelopment.dk>
|
2009-05-22 14:46:18 +00:00
|
|
|
#
|
|
|
|
|
2009-10-26 21:00:30 +00:00
|
|
|
libc_newlib_basename() {
|
|
|
|
if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
|
|
|
|
echo "newlib-${CT_LIBC_VERSION}"
|
|
|
|
else
|
|
|
|
echo "newlib-cvs${CT_LIBC_VERSION:+-${CT_LIBC_VERSION}}"
|
|
|
|
fi
|
|
|
|
}
|
2009-05-22 14:46:18 +00:00
|
|
|
|
|
|
|
do_libc_get() {
|
|
|
|
libc_src="ftp://sources.redhat.com/pub/newlib"
|
2009-05-23 18:46:42 +00:00
|
|
|
avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
|
2009-10-26 21:00:30 +00:00
|
|
|
|
|
|
|
if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
|
|
|
|
CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
|
|
|
|
else
|
|
|
|
CT_GetCVS "$(libc_newlib_basename)" \
|
|
|
|
":pserver:anoncvs@sources.redhat.com:/cvs/src" \
|
|
|
|
"newlib" \
|
|
|
|
"${CT_LIBC_VERSION}" \
|
|
|
|
"$(libc_newlib_basename)=src"
|
|
|
|
fi
|
2009-05-22 14:46:18 +00:00
|
|
|
|
2009-05-23 18:46:42 +00:00
|
|
|
if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
|
|
|
|
CT_GetFile "avr32headers" ${avr32headers_src}
|
|
|
|
fi
|
2009-05-22 14:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_libc_extract() {
|
2009-10-26 21:00:30 +00:00
|
|
|
CT_Extract "$(libc_newlib_basename)"
|
|
|
|
CT_Patch "$(libc_newlib_basename)"
|
2009-05-22 14:46:18 +00:00
|
|
|
|
2009-05-23 18:46:42 +00:00
|
|
|
if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
|
|
|
|
CT_Extract "avr32headers"
|
|
|
|
fi
|
2009-05-22 14:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_libc_check_config() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
do_libc_headers() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
do_libc_start_files() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
do_libc() {
|
|
|
|
CT_DoStep INFO "Installing C library"
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-libc"
|
|
|
|
cd "${CT_BUILD_DIR}/build-libc"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring C library"
|
|
|
|
|
2009-10-25 22:35:55 +00:00
|
|
|
# Note: newlib handles the build/host/target a little bit differently
|
|
|
|
# than one would expect:
|
|
|
|
# build : not used
|
|
|
|
# host : the machine building newlib
|
|
|
|
# target : the machine newlib runs on
|
2009-10-26 21:00:30 +00:00
|
|
|
CC_FOR_BUILD="${CT_BUILD}-gcc" \
|
|
|
|
CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS} -O" \
|
|
|
|
AR=${CT_TARGET}-ar \
|
|
|
|
RANLIB=${CT_TARGET}-ranlib \
|
|
|
|
CT_DoExecLog ALL \
|
|
|
|
"${CT_SRC_DIR}/$(libc_newlib_basename)/configure" \
|
|
|
|
--host=${CT_BUILD} \
|
|
|
|
--target=${CT_TARGET} \
|
2009-10-26 22:20:33 +00:00
|
|
|
--prefix=${CT_PREFIX_DIR}
|
2009-05-22 14:46:18 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building C library"
|
|
|
|
|
2009-10-26 22:20:33 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2009-05-22 14:46:18 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing C library"
|
|
|
|
|
|
|
|
CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
do_libc_finish() {
|
2009-10-26 22:20:33 +00:00
|
|
|
CT_DoStep INFO "Finishing C library"
|
2009-05-23 18:46:42 +00:00
|
|
|
|
|
|
|
if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
|
2009-10-26 22:20:33 +00:00
|
|
|
CT_DoLog EXTRA "Installing Atmel's AVR32 headers"
|
2009-05-23 18:46:42 +00:00
|
|
|
CT_DoExecLog ALL cp -r ${CT_SRC_DIR}/avr32headers "${CT_PREFIX_DIR}/${CT_TARGET}/include/avr32"
|
|
|
|
fi
|
|
|
|
|
|
|
|
CT_EndStep
|
2009-05-22 14:46:18 +00:00
|
|
|
}
|