From d8c12f40e2441ccf2662f3c20ef451c45e8158b6 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 28 Dec 2019 02:18:41 +0100 Subject: [PATCH] cross-arm-none-eabi-newlib: build a nano variant --- srcpkgs/cross-arm-none-eabi-newlib/template | 73 +++++++++++++++++---- 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/srcpkgs/cross-arm-none-eabi-newlib/template b/srcpkgs/cross-arm-none-eabi-newlib/template index 076c52c93f..a5c27a2ce7 100644 --- a/srcpkgs/cross-arm-none-eabi-newlib/template +++ b/srcpkgs/cross-arm-none-eabi-newlib/template @@ -3,21 +3,14 @@ _triplet=arm-none-eabi _pkgname=newlib pkgname=cross-${_triplet}-${_pkgname} version=3.1.0.20181231 -revision=1 +revision=2 wrksrc="${_pkgname}-${version}" build_style=gnu-configure configure_args=" - --disable-newlib-supplied-syscalls - --disable-nls - --enable-interwork - --enable-newlib-io-long-long - --enable-newlib-register-fini - --host=${XBPS_CROSS_TRIPLET} - --prefix=/usr - --target=${_triplet} - --with-gnu-as - --with-gnu-ld -" + --prefix=/usr --target=${_triplet} --host=${XBPS_CROSS_TRIPLET} + --with-gnu-as --with-gnu-ld --disable-nls + --disable-newlib-supplied-syscalls --enable-newlib-retargetable-locking + --enable-interwork" hostmakedepends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc" short_desc="C library intended for use on embedded systems" maintainer="Ivan Sokolov " @@ -26,3 +19,59 @@ homepage="https://www.sourceware.org/${_pkgname}/" distfiles="ftp://sources.redhat.com/pub/${_pkgname}/${_pkgname}-${version}.tar.gz" checksum=9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0 nostrip=yes + +post_extract() { + mkdir -p build-{newlib,nano} +} + +do_configure() { + pushd build-newlib + export CFLAGS_FOR_TARGET="-g -O2 -ffunction-sections -fdata-sections" + ../configure ${configure_args} \ + --enable-newlib-io-long-long \ + --enable-newlib-register-fini + popd + + pushd build-nano + export CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections" + ../configure ${configure_args} \ + --enable-newlib-reent-small \ + --disable-newlib-fvwrite-in-streamio \ + --disable-newlib-fseek-optimization \ + --disable-newlib-wide-orient \ + --enable-newlib-nano-malloc \ + --disable-newlib-unbuf-stream-opt \ + --enable-lite-exit \ + --enable-newlib-global-atexit \ + --enable-newlib-nano-formatted-io + popd +} + +do_build() { + pushd build-newlib + make ${makejobs} + popd + + pushd build-nano + make ${makejobs} + popd +} + +do_install() { + pushd build-nano + make DESTDIR=${DESTDIR} install + find ${DESTDIR} -regex ".*/lib\(c\|g\|rdimon\)\.a" \ + -exec rename .a _nano.a '{}' \; + install -d ${DESTDIR}/usr/${_triplet}/include/newlib-nano + install -m644 -t ${DESTDIR}/usr/${_triplet}/include/newlib-nano \ + ${DESTDIR}/usr/${_triplet}/include/newlib.h + popd + + pushd build-newlib + make DESTDIR=${DESTDIR} install + popd +} + +post_install() { + vlicense COPYING +}