Subject: [alpine-aports] [PATCH 2/3] testing/gcc-arm-none-eabi: New aport

From: Marian Buschsieweke <[email-masked]>
Date: Mon, 28 May 2018 18:49:29 +0200

The GNU Compiler Collection for embedded ARM targets
http://gcc.gnu.org

This packet is heavily inspired by the Ubuntu package, as this one of the
very few tool chains for embedded ARM that reliably works.
---
 .../0001-gcc-gfdl-build.patch                 | 38 +++++++++
 .../0002-add-big-endian-support.patch         | 28 +++++++
 .../gcc-arm-none-eabi/0003-remove-armv8.patch | 74 +++++++++++++++++
 testing/gcc-arm-none-eabi/APKBUILD            | 83 +++++++++++++++++++
 4 files changed, 223 insertions(+)
 create mode 100644 testing/gcc-arm-none-eabi/0001-gcc-gfdl-build.patch
 create mode 100644 testing/gcc-arm-none-eabi/0002-add-big-endian-support.patch
 create mode 100644 testing/gcc-arm-none-eabi/0003-remove-armv8.patch
 create mode 100644 testing/gcc-arm-none-eabi/APKBUILD

diff --git a/testing/gcc-arm-none-eabi/0001-gcc-gfdl-build.patch b/testing/gcc-arm-none-eabi/0001-gcc-gfdl-build.patch
new file mode 100644
index 0000000000..811f9a96c3
--- /dev/null
+++ b/testing/gcc-arm-none-eabi/0001-gcc-gfdl-build.patch
@@ -0,0 +1,38 @@
+# DP: Build a dummy s-tm-texi without access to the texinfo sources
+# This patch was taken from gcc debian package
+
+--- src/gcc/Makefile.in
++++ src/gcc/Makefile.in
+@@ -2314,30 +2314,8 @@
+ # \r is not portable to Solaris tr, therefore we have a special
+ # case for ASCII.  We use \r for other encodings like EBCDIC.
+ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
+-	$(RUN_GEN) build/genhooks$(build_exeext) -d \
+-			$(srcdir)/doc/tm.texi.in > tmp-tm.texi
+-	case `echo X|tr X '\101'` in \
+-	  A) tr -d '\015' < tmp-tm.texi > tmp2-tm.texi ;; \
+-	  *) tr -d '\r' < tmp-tm.texi > tmp2-tm.texi ;; \
+-	esac
+-	mv tmp2-tm.texi tmp-tm.texi
+-	$(SHELL) $(srcdir)/../move-if-change tmp-tm.texi tm.texi
+-	@if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
+-	  $(STAMP) $@; \
+-	elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
+-	  && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \
+-	    || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \
+-	    || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \
+-	  ); then \
+-	  echo >&2 ; \
+-	  echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
+-	  false; \
+-	else \
+-	  echo >&2 ; \
+-	  echo Verify that you have permission to grant a GFDL license for all >&2 ; \
+-	  echo new text in tm.texi, then copy it to $(srcdir)/doc/tm.texi. >&2 ; \
+-	  false; \
+-	fi
++	cat $(srcdir)/doc/tm.texi.in > tmp-tm.texi
++	$(STAMP) $@
+ 
+ gimple-match.c: s-match gimple-match-head.c ; @true
+ generic-match.c: s-match generic-match-head.c ; @true
diff --git a/testing/gcc-arm-none-eabi/0002-add-big-endian-support.patch b/testing/gcc-arm-none-eabi/0002-add-big-endian-support.patch
new file mode 100644
index 0000000000..01357ee890
--- /dev/null
+++ b/testing/gcc-arm-none-eabi/0002-add-big-endian-support.patch
@@ -0,0 +1,28 @@
+--- src/gcc/config/arm/t-rmprofile
++++ src/gcc/config/arm/t-rmprofile
+@@ -52,6 +52,8 @@
+ MULTILIB_OPTIONS       += mfloat-abi=softfp/mfloat-abi=hard
+ MULTILIB_DIRNAMES      += softfp hard
+ 
++MULTILIB_OPTIONS       += mlittle-endian/mbig-endian
++MULTILIB_DIRNAMES      += le be
+ 
+ # Option combinations to build library with
+ 
+@@ -87,6 +89,8 @@
+ MULTILIB_REQUIRED      += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=softfp
+ MULTILIB_REQUIRED      += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=hard
+ 
++# ARMv7-R big endian
++MULTILIB_REQUIRED      += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=hard/mbig-endian
+ 
+ # Matches
+ 
+@@ -168,6 +172,7 @@
+ MULTILIB_REUSE         += mthumb/march.armv7=march.armv7
+ MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp=march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp
+ MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard
++MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian=march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian
+ MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp=march.armv7/mfpu.fpv5-d16/mfloat-abi.softfp
+ MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7/mfpu.fpv5-d16/mfloat-abi.hard
+ MULTILIB_REUSE         += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/march.armv7/mfpu.fpv5-d16/mfloat-abi.softfp
diff --git a/testing/gcc-arm-none-eabi/0003-remove-armv8.patch b/testing/gcc-arm-none-eabi/0003-remove-armv8.patch
new file mode 100644
index 0000000000..247204cb9e
--- /dev/null
+++ b/testing/gcc-arm-none-eabi/0003-remove-armv8.patch
@@ -0,0 +1,74 @@
+--- src/gcc/config/arm/t-rmprofile
++++ src/gcc/config/arm/t-rmprofile
+@@ -43,8 +43,8 @@
+ MULTILIB_OPTIONS       += mthumb
+ MULTILIB_DIRNAMES      += thumb
+ 
+-MULTILIB_OPTIONS       += march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7/march=armv8-m.base/march=armv8-m.main
+-MULTILIB_DIRNAMES      += v6-m v7-m v7e-m v7-ar v8-m.base v8-m.main
++MULTILIB_OPTIONS       += march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7
++MULTILIB_DIRNAMES      += v6-m v7-m v7e-m v7-ar
+ 
+ MULTILIB_OPTIONS       += mfpu=vfpv3-d16/mfpu=fpv4-sp-d16/mfpu=fpv5-sp-d16/mfpu=fpv5-d16
+ MULTILIB_DIRNAMES      += fpv3 fpv4-sp fpv5-sp fpv5
+@@ -64,9 +64,6 @@
+ # ARMv6-M
+ MULTILIB_REQUIRED      += mthumb/march=armv6s-m
+ 
+-# ARMv8-M Baseline
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.base
+-
+ # ARMv7-M
+ MULTILIB_REQUIRED      += mthumb/march=armv7-m
+ 
+@@ -77,13 +74,6 @@
+ MULTILIB_REQUIRED      += mthumb/march=armv7e-m/mfpu=fpv5-d16/mfloat-abi=softfp
+ MULTILIB_REQUIRED      += mthumb/march=armv7e-m/mfpu=fpv5-d16/mfloat-abi=hard
+ 
+-# ARMv8-M Mainline
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.main
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.main/mfpu=fpv5-d16/mfloat-abi=softfp
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.main/mfpu=fpv5-d16/mfloat-abi=hard
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.main/mfpu=fpv5-sp-d16/mfloat-abi=softfp
+-MULTILIB_REQUIRED      += mthumb/march=armv8-m.main/mfpu=fpv5-sp-d16/mfloat-abi=hard
+-
+ # ARMv7-R as well as ARMv7-A and ARMv8-A if aprofile was not specified
+ MULTILIB_REQUIRED      += mthumb/march=armv7
+ MULTILIB_REQUIRED      += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=softfp
+@@ -106,8 +96,6 @@
+ MULTILIB_MATCHES       += march?armv7-m=mcpu?cortex-m3
+ MULTILIB_MATCHES       += march?armv7e-m=mcpu?cortex-m4
+ MULTILIB_MATCHES       += march?armv7e-m=mcpu?cortex-m7
+-MULTILIB_MATCHES       += march?armv8-m.base=mcpu?cortex-m23
+-MULTILIB_MATCHES       += march?armv8-m.main=mcpu?cortex-m33
+ MULTILIB_MATCHES       += march?armv7=mcpu?cortex-r4
+ MULTILIB_MATCHES       += march?armv7=mcpu?cortex-r4f
+ MULTILIB_MATCHES       += march?armv7=mcpu?cortex-r5
+@@ -140,17 +128,10 @@
+ 
+ # Arch Matches
+ MULTILIB_MATCHES       += march?armv6s-m=march?armv6-m
+-MULTILIB_MATCHES       += march?armv8-m.main=march?armv8-m.main+dsp
+ MULTILIB_MATCHES       += march?armv7=march?armv7-r
+ ifeq (,$(HAS_APROFILE))
+ MULTILIB_MATCHES       += march?armv7=march?armv7-a
+ MULTILIB_MATCHES       += march?armv7=march?armv7ve
+-MULTILIB_MATCHES       += march?armv7=march?armv8-a
+-MULTILIB_MATCHES       += march?armv7=march?armv8-a+crc
+-MULTILIB_MATCHES       += march?armv7=march?armv8.1-a
+-MULTILIB_MATCHES       += march?armv7=march?armv8.1-a+crc
+-MULTILIB_MATCHES       += march?armv7=march?armv8.2-a
+-MULTILIB_MATCHES       += march?armv7=march?armv8.2-a+fp16
+ endif
+ 
+ # FPU matches
+@@ -163,9 +144,6 @@
+ MULTILIB_MATCHES       += mfpu?vfpv3-d16=mfpu?vfpv4
+ MULTILIB_MATCHES       += mfpu?vfpv3-d16=mfpu?vfpv4-d16
+ MULTILIB_MATCHES       += mfpu?vfpv3-d16=mfpu?neon-vfpv4
+-MULTILIB_MATCHES       += mfpu?fpv5-d16=mfpu?fp-armv8
+-MULTILIB_MATCHES       += mfpu?fpv5-d16=mfpu?neon-fp-armv8
+-MULTILIB_MATCHES       += mfpu?fpv5-d16=mfpu?crypto-neon-fp-armv8
+ endif
+ 
+ 
diff --git a/testing/gcc-arm-none-eabi/APKBUILD b/testing/gcc-arm-none-eabi/APKBUILD
new file mode 100644
index 0000000000..b3d6ea671d
--- /dev/null
+++ b/testing/gcc-arm-none-eabi/APKBUILD
@@ -0,0 +1,83 @@
+# Maintainer: Marian Buschsieweke <[email-masked]>
+pkgname=gcc-arm-none-eabi
+pkgver=6.3.1
+pkgrel=0
+pkgdesc="The GNU Compiler Collection for embedded ARM targets"
+url="http://gcc.gnu.org"
+depends="binutils-arm-none-eabi"
+makedepends="bash flex linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev isl-dev"
+arch="all"
+license="GPL LGPL"
+subpackages=""
+_ubuntusvnrev=253039
+source="https://launchpad.net/ubuntu/+archive/primary/+files/${pkgname}_${pkgver}+svn${_ubuntusvnrev}.orig.tar.xz
+	0001-gcc-gfdl-build.patch
+	0002-add-big-endian-support.patch
+	0003-remove-armv8.patch
+	"
+
+builddir="$srcdir/src"
+_workingdir="$builddir/build"
+_target="${pkgname#gcc-}"
+
+build() {
+	mkdir "$_workingdir" || return 1
+	cd "$_workingdir"
+
+	export CFLAGS_FOR_TARGET='-pipe'
+	export CXXFLAGS_FOR_TARGET='-pipe'
+
+	"$builddir"/configure\
+		--infodir=/deleteme/info \
+		--htmldir=/deleteme/html \
+		--pdfdir=/deleteme/pdf \
+		--mandir=/deleteme/man \
+		--enable-languages=c,c++,lto \
+		--enable-multilib \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--build="$CBUILD" \
+		--target="$_target" \
+		--with-system-zlib \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--without-included-gettext \
+		--prefix=/usr \
+		--disable-libstdc++-v3 \
+		--host=$CHOST \
+		--with-headers=no \
+		--without-newlib \
+		--with-multilib-list=rmprofile \
+		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 \
+		|| return 1
+	make
+}
+
+package() {
+	cd "$_workingdir"
+	make install DESTDIR="$pkgdir" || return 1
+	rm -rf "$pkgdir"/deleteme
+	rm -f "$pkgdir"/usr/lib/libcc1.*
+	find "$pkgdir"/usr/lib -type f -name "*.a" -exec "/usr/bin/$_target-strip" --strip-debug '{}' \;
+}
+
+sha512sums="75665bc9e442f005cfefb40263e28a65cf49523e3119336cacf6ab61bdc04ba387a35e11343b943c4eb1ba143e02cbb85fcea6e71420c491bf9e9ed77b9c0d4c  gcc-arm-none-eabi_6.3.1+svn253039.orig.tar.xz
+c3ce7e50187769add364981576541b2bea86bdd9d1e5c9b084cd76d89243c5d01b0038b35c3679169d7dc5ee0620201511ff875104915e03b2952dc0827d279d  0001-gcc-gfdl-build.patch
+3362981b68597c82d5298d04aa1ff82352d29209db74d8109faa013a5f43744c4b625d4d2a179359cbf6007ac367a18612374499982f0a8161d2720453c86180  0002-add-big-endian-support.patch
+f96f93636a933eea337853a7db933eec7c9bd446c565054594406102727b4cfeb14e878224af53445345a812aca5ffcd946a0e56f4a3885b7ce7c06b2e5d64f0  0003-remove-armv8.patch"
-- 
2.17.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---