~alpine/aports

[alpine-aports] [PATCH 3/3] testing/newlib-arm-none-eabi: New aport

Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Details
Message ID
<20180528164930.20411-3-marian.buschsieweke@ovgu.de>
Sender timestamp
1527526170
DKIM signature
missing
Download raw message
Patch: +128 -0
A C standard library implementation intended for use on embedded ARM
http://www.sourceware.org/newlib/

Just as gcc-arm-none-eabi, this package is heavily based on Ubuntu's
libnewlib-arm-none-eabi package.
---
 testing/newlib-arm-none-eabi/APKBUILD         | 115 ++++++++++++++++++
 .../fix-include-paths-nano-specs.patch        |  13 ++
 2 files changed, 128 insertions(+)
 create mode 100644 testing/newlib-arm-none-eabi/APKBUILD
 create mode 100644 testing/newlib-arm-none-eabi/fix-include-paths-nano-specs.patch

diff --git a/testing/newlib-arm-none-eabi/APKBUILD b/testing/newlib-arm-none-eabi/APKBUILD
new file mode 100644
index 0000000000..c661d45bb7
--- /dev/null
+++ b/testing/newlib-arm-none-eabi/APKBUILD
@@ -0,0 +1,115 @@
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>

_realname=newlib
_target="arm-none-eabi"
pkgname="$_realname-$_target"
pkgver=2.4.0.20160527
pkgrel=0
pkgdesc="A C standard library implementation intended for use on embedded ARM"
url="http://www.sourceware.org/newlib/"
makedepends="texinfo"
depends="gcc-$_target binutils-$_target"
arch="all"
license="BSD"
source="
	http://archive.ubuntu.com/ubuntu/pool/universe/${_realname:0:1}/${_realname}/${_realname}_${pkgver}.orig.tar.xz
	fix-include-paths-nano-specs.patch
	"
#source="ftp://sourceware.org/pub/${_realname}/${_realname}-${pkgver}.tar.gz"
options="!check"

builddir="$srcdir/$_realname-$pkgver"

# This package installes 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,
# 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/

build() {
	mkdir "${builddir}/build" "${builddir}/build-nano"
	# nano version
	cd "${builddir}/build-nano"
	"$builddir"/configure \
			--host=$CHOST \
			--build=$CBUILD \
			--target=$_target \
			--prefix=/usr/ \
			--infodir=/deleteme/info \
			--mandir=/deleteme/man \
			--htmldir=/deleteme/html \
			--pdfdir=/deleteme/pdf \
			--disable-newlib-supplied-syscalls \
			--disable-nls \
			--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 \
			CC_FOR_TARGET="$_target"-gcc \
			GCC_FOR_TARGET="$_target"-gcc \
			AR_FOR_TARGET="$_target"-ar \
			AS_FOR_TARGET="$_target"-as \
			LD_FOR_TARGET="$_target"-ld \
			NM_FOR_TARGET="$_target"-nm \
			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"
	make

	# regular version
	cd "${builddir}/build"
	"$builddir"/configure \
			--host=$CHOST \
			--target=$_target \
			--prefix=/usr \
			--infodir=/deleteme/info \
			--mandir=/deleteme/man \
			--htmldir=/deleteme/html \
			--pdfdir=/deleteme/pdf \
			--disable-newlib-supplied-syscalls \
			--disable-nls \
			--enable-newlib-io-long-long \
			--enable-newlib-register-fini \
			CC_FOR_TARGET="$_target"-gcc \
			GCC_FOR_TARGET="$_target"-gcc \
			AR_FOR_TARGET="$_target"-ar \
			AS_FOR_TARGET="$_target"-as \
			LD_FOR_TARGET="$_target"-ld \
			NM_FOR_TARGET="$_target"-nm \
			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"
	make
}

package() {
	# install nano version
	cd "${builddir}/build-nano"
	make -j1 DESTDIR="$pkgdir" install
	# rename nano version libs
	cd "${pkgdir}/usr/$_target/lib"
	for file in $(find . -regex ".*\(c\|g\|rdimon\)\.a"); do
		mv "$file" "${file%.a}_nano.a"
	done
	mkdir -p "${pkgdir}/usr/$_target/include/nano"
	mv "${pkgdir}/usr/$_target/include/newlib.h" \
	   "${pkgdir}/usr/$_target/include/nano/"

	# install regular version
	cd "${builddir}/build"
	make -j1 DESTDIR="$pkgdir" install
	rm -rf "${pkgdir}/deleteme"
}

sha512sums="91d07a67a4f0b4ce7774352c50c8906c0051ebe588ed30c2abfdf4105b3bbeb98433c8b61126e5e6c1891b0f5a5462f762383b6fc419ba993a02b2484f46a9cc  newlib_2.4.0.20160527.orig.tar.xz
6a7daa621088f7a9c75787c73de34ea6e503ba8051e208b2b6dd03498384bda46a81c0572be7846a7a270e4c390aa8d418b55a73587dd9d212fc2f5d123782f3  fix-include-paths-nano-specs.patch"
diff --git a/testing/newlib-arm-none-eabi/fix-include-paths-nano-specs.patch b/testing/newlib-arm-none-eabi/fix-include-paths-nano-specs.patch
new file mode 100644
index 0000000000..f4ea97708f
--- /dev/null
+++ b/testing/newlib-arm-none-eabi/fix-include-paths-nano-specs.patch
@@ -0,0 +1,13 @@
Index: newlib-2.4.0.20160527/libgloss/arm/elf-nano.specs
===================================================================
--- newlib-2.4.0.20160527.orig/libgloss/arm/elf-nano.specs
+++ newlib-2.4.0.20160527/libgloss/arm/elf-nano.specs
@@ -3,7 +3,7 @@
 %rename cpp		nano_cpp
 
 *cpp:
--isystem =/include/newlib-nano %(nano_cpp)
+-isystem /usr/include/newlib/nano %(nano_cpp)
 
 *nano_libc:
 -lc_nano
-- 
2.17.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)