diff options
Diffstat (limited to 'community/newlib/APKBUILD')
-rw-r--r-- | community/newlib/APKBUILD | 85 |
1 files changed, 57 insertions, 28 deletions
diff --git a/community/newlib/APKBUILD b/community/newlib/APKBUILD index 03b9afb33a8..220d71083e5 100644 --- a/community/newlib/APKBUILD +++ b/community/newlib/APKBUILD @@ -1,31 +1,49 @@ # Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de> +pkgname=newlib +pkgver=4.3.0.20230120 +pkgrel=3 +pkgdesc="C standard library implementation intended for use on embedded systems" +url="https://www.sourceware.org/newlib/" +makedepends="texinfo" +arch="aarch64 ppc64le x86_64 x86" +license="GPL-2.0-only AND LGPL-2.1-only AND 0BSD AND BSD-3-Clause AND GPL-3.0-only AND LGPL-3.0-only" +source=" + https://sourceware.org/pub/newlib/newlib-$pkgver.tar.gz + + msp430-elf-nano.specs + 0001-msp430-enable-syscalls.patch + " +options="!check" -# mips-mti-elf fails with "Error: unrecognized opcode `cfc1 $3,$31'" -_targets=" +# classify targets as exotic or mainstream. Only build support for +# exotic targets on typical developer / CI hardware (x86_86, aarach64). +_targets_mainstream=" arm-none-eabi - msp430-elf riscv-none-elf + " + +_targets_exotic=" + msp430-elf + or1k-elf aarch64-none-elf " -# or1k-elf fails to build on 32-bit architectures + case "$CARCH" in - x86_64|aarch64|ppc64le|mips64) _targets="$_targets or1k-elf" +x86_64|aarch64) + # support all targets on typical workstation / notebook / CI servers + _targets="$_targets_mainstream $_targets_exotic" + ;; +*) + # support only mainstream targets on exotic hosts + _targets="$_targets_mainstream" + ;; esac -pkgname=newlib -pkgver=4.1.0 -pkgrel=1 -pkgdesc="C standard library implementation intended for use on embedded systems" -url="https://www.sourceware.org/newlib/" -makedepends="texinfo" -# s390x, mips64 and riscv64 blocked by gcc-cross-embedded -arch="all !s390x !mips64 !riscv64" -license="GPL-2.0-only AND LGPL-2.1-only AND 0BSD AND BSD-3-Clause AND GPL-3.0-only AND LGPL-3.0-only" -source="https://sourceware.org/pub/newlib/newlib-$pkgver.tar.gz" -options="!check" for target in $_targets; do targetnorm="${target//-/_}" subpackages="newlib-$target:$targetnorm $subpackages" + # here only makedepends. The depends to binutils-$target and gcc-$target + # will be set in the subpkg newlib-$target makedepends="binutils-$target gcc-$target $makedepends" done @@ -33,9 +51,9 @@ done # 4.1.0-r0: # - CVE-2021-3420 -# This package installes two version of the newlib library to remain compatible +# This package installs two version of the newlib library to remain compatible # with projects expecting the GNU ARM Embedded Toolchain [1]. The nano version -# appends the postix "_nano" to the libaries. The is not an arbitrary choice, +# appends the postfix "_nano" to the libraries. The is not an arbitrary choice, # it matches the specs in "/usr/arm-none-eabi/lib/nano.specs", which is # part of the default newlib installation. # [1]: https://launchpad.net/gcc-arm-embedded/ @@ -45,6 +63,7 @@ build() { mkdir "$builddir/build-$target" "$builddir/build-$target-nano" # nano version cd "$builddir/build-$target-nano" + export CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections -fshort-wchar" "$builddir"/configure \ --target=$target \ --prefix=/usr/ \ @@ -52,17 +71,18 @@ build() { --mandir=/deleteme/man \ --htmldir=/deleteme/html \ --pdfdir=/deleteme/pdf \ - --disable-newlib-supplied-syscalls \ - --disable-nls \ --disable-newlib-fseek-optimization \ --disable-newlib-fvwrite-in-streamio \ + --disable-newlib-supplied-syscalls \ --disable-newlib-unbuf-stream-opt \ --disable-newlib-wide-orient \ + --disable-nls \ --enable-lite-exit \ --enable-newlib-global-atexit \ --enable-newlib-nano-formatted-io \ --enable-newlib-nano-malloc \ --enable-newlib-reent-small \ + --enable-newlib-retargetable-locking \ CC_FOR_TARGET="$target"-gcc \ GCC_FOR_TARGET="$target"-gcc \ AR_FOR_TARGET="$target"-ar \ @@ -72,12 +92,12 @@ build() { OBJDUMP_FOR_TARGET="$target"-objdump \ RANLIB_FOR_TARGET="$target"-ranlib \ READELF_FOR_TARGET="$target"-readelf \ - STRIP_FOR_TARGET="$target"-strip \ - CFLAGS="-Os -ffunction-sections -fdata-sections -fshort-wchar" + STRIP_FOR_TARGET="$target"-strip make # regular version cd "$builddir/build-$target" + export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" "$builddir"/configure \ --host=$CHOST \ --target=$target \ @@ -88,8 +108,10 @@ build() { --pdfdir=/deleteme/pdf \ --disable-newlib-supplied-syscalls \ --disable-nls \ + --enable-newlib-io-c99-formats \ --enable-newlib-io-long-long \ --enable-newlib-register-fini \ + --enable-newlib-retargetable-locking \ CC_FOR_TARGET="$target"-gcc \ GCC_FOR_TARGET="$target"-gcc \ AR_FOR_TARGET="$target"-ar \ @@ -99,8 +121,7 @@ build() { OBJDUMP_FOR_TARGET="$target"-objdump \ RANLIB_FOR_TARGET="$target"-ranlib \ READELF_FOR_TARGET="$target"-readelf \ - STRIP_FOR_TARGET="$target"-strip \ - CFLAGS="-O2 -ffunction-sections -fdata-sections -pipe" + STRIP_FOR_TARGET="$target"-strip make done } @@ -122,17 +143,23 @@ _install_subpkg() { make -j1 DESTDIR="$subpkgdir" install # rename nano version libs cd "$subpkgdir/usr/$target/lib" - find . -regex ".*\(c\|g\|rdimon\|gloss\)\.a" | while read -r _file; do + find . -regex ".*\(c\|g\|m\|rdimon\|gloss\)\.a" | while read -r _file; do mv "$_file" "${_file%%.a}_nano.a" done - mkdir -p "$subpkgdir/usr/$target/include/nano" + mkdir -p "$subpkgdir/usr/$target/include/newlib-nano" mv "$subpkgdir/usr/$target/include/newlib.h" \ - "$subpkgdir/usr/$target/include/nano/" + "$subpkgdir/usr/$target/include/newlib-nano/" # install regular version cd "$builddir/build-$target" make -j1 DESTDIR="$subpkgdir" install rm -rf "$subpkgdir/deleteme" + + # install custom nano specs, if existing + if [ -e "$srcdir/$target-nano.specs" ]; then + install -m 644 "$srcdir/$target-nano.specs" \ + "$subpkgdir/usr/$target/lib/nano.specs" + fi } arm_none_eabi() { @@ -160,5 +187,7 @@ aarch64_none_elf() { } sha512sums=" -6a24b64bb8136e4cd9d21b8720a36f87a34397fd952520af66903e183455c5cf19bb0ee4607c12a05d139c6c59382263383cb62c461a839f969d23d3bc4b1d34 newlib-4.1.0.tar.gz +4a06309d36c2255fef8fc8f2d133cafa850f1ed2eddfb27b5d45f5d16af69e0fca829a0b4c9b34af4ed3a28c6fcc929761e0ee823a4229f35c2853d432b5e7ef newlib-4.3.0.20230120.tar.gz +647b79e3cc6f3bb98b1263ebbf4b3efa4a4692fddc0df6491c726de2fa0ee46b05ab2ddf96c2c8c785f3cd6a442135ec97bf8df93a8f371d479ea46d03aa8a08 msp430-elf-nano.specs +268c44f8056067e03ee9914d04e8cfa2bb22764bb294b7d16dbfdd51c2e5ef0ad221037a86caafd20ab755b16b38519d61e27ffcd13239cbdbbfad421fa8cb60 0001-msp430-enable-syscalls.patch " |