Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework
@ 2019-05-08 21:51 voidlinux-github
  2019-05-09 15:00 ` voidlinux-github
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-08 21:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

There is a new pull request by sirikid against master on the void-packages repository

https://github.com/sirikid/void-packages cross-arm-none-eabi
https://github.com/void-linux/void-packages/pull/11571

[WIP] [RFC] cross-arm-none-eabi rework
I reworked cross-arm-none-eabi package and now I need some feedback from community.

Why:
- More granular updates — each component of the toolchain can be rebuilt and updated separately.
- Extensive use of template system features — less manual work and less mistakes.

Why not:
- Additional points of failure. Possible solution: arm-none-eabi [build helper](https://github.com/void-linux/void-packages/blob/master/Manual.md#build-helper-scripts).
- More packages in the repo with strange prefixes — this can confuse newcomers.

Please write your thoughts if you are interested in this package or in cross compilation in general, because I don’t even know if anyone except me needs this rework.


A patch file from https://github.com/void-linux/void-packages/pull/11571.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cross-arm-none-eabi-11571.patch --]
[-- Type: application/text/x-diff, Size: 17916 bytes --]

From f4962cb9911ba7f365562fd8ec8cb86ba3337e8c Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Tue, 30 Apr 2019 18:25:51 +0300
Subject: [PATCH 1/5] New package: cross-arm-none-eabi-binutils-2.32

---
 srcpkgs/cross-arm-none-eabi-binutils/template | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-binutils/template

diff --git a/srcpkgs/cross-arm-none-eabi-binutils/template b/srcpkgs/cross-arm-none-eabi-binutils/template
new file mode 100644
index 00000000000..bc7da156229
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-binutils/template
@@ -0,0 +1,27 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=binutils
+pkgname=cross-${_triplet}-${_pkgname}
+version=2.32
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-nls
+ --enable-deterministic-archives
+ --enable-interwork
+ --enable-ld=default
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --target=${_triplet}
+ --with-gnu-as
+ --with-gnu-ld
+ --with-sysroot=/usr/${_triplet}
+"
+short_desc="GNU binary utilities"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}/"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04

From 017b5d6aaee5e0ade4f1d7b3ff87e8e8b0403fba Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Mon, 6 May 2019 04:09:29 +0300
Subject: [PATCH 2/5] New package: cross-arm-none-eabi-gcc-8.3.0

---
 srcpkgs/cross-arm-none-eabi-gcc/template | 70 ++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gcc/template

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
new file mode 100644
index 00000000000..d939d902723
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -0,0 +1,70 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gcc
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.3.0
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-decimal-float
+ --disable-libffi
+ --disable-libgomp
+ --disable-libmudflap
+ --disable-libquadmath
+ --disable-libssp
+ --disable-libstdcxx-pch
+ --disable-nls
+ --disable-shared
+ --disable-shared
+ --disable-threads
+ --disable-tls
+ --disable-werror
+ --enable-__cxa_atexit
+ --enable-c99
+ --enable-gnu-indirect-function
+ --enable-internetwork
+ --enable-languages=c,c++
+ --enable-long-long
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --libdir=/usr/lib
+ --libexecdir=/usr/lib
+ --prefix=/usr
+ --quiet
+ --target=${_triplet}
+ --with-gmp
+ --with-gnu-as
+ --with-gnu-ld
+ --with-headers=/usr/${_triplet}/include
+ --with-host-libstdcxx='-static-libgcc'
+ --with-isl
+ --with-libelf
+ --with-mpc
+ --with-mpfr
+ --with-multilib-list=rmprofile
+ --with-native-system-header-dir=/include
+ --with-newlib
+ --with-python-dir=share/${pkgname}
+ --with-sysroot=/usr/${_triplet}
+ --with-system-zlib
+"
+make_build_args="INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 -s"
+make_build_target="all-gcc"
+make_install_target="install-gcc"
+hostmakedepends="bison flex perl"
+makedepends="gmp-devel isl16-devel libmpc-devel mpfr-devel zlib-devel"
+short_desc="GNU Compiler Collection"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}/${_pkgname}-${version}.tar.xz"
+checksum=64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
+alternatives="arm-none-eabi-cc:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
+nopie=yes
+
+post_install() {
+	rm -fr ${DESTDIR}/usr/share/info
+	rm -fr ${DESTDIR}/usr/share/man/man7
+}

From c434104ceb638b9d6af4554d06daa7bacfd69ed9 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:00:16 +0300
Subject: [PATCH 3/5] New package: cross-arm-none-eabi-newlib-3.1.0.20181231

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 28 +++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-newlib/template

diff --git a/srcpkgs/cross-arm-none-eabi-newlib/template b/srcpkgs/cross-arm-none-eabi-newlib/template
new file mode 100644
index 00000000000..076c52c93f3
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-newlib/template
@@ -0,0 +1,28 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=newlib
+pkgname=cross-${_triplet}-${_pkgname}
+version=3.1.0.20181231
+revision=1
+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
+"
+hostmakedepends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc"
+short_desc="C library intended for use on embedded systems"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.sourceware.org/${_pkgname}/"
+distfiles="ftp://sources.redhat.com/pub/${_pkgname}/${_pkgname}-${version}.tar.gz"
+checksum=9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0
+nostrip=yes

From 500510526c41c052e6c46f57b77bc2a3d022d851 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:16:24 +0300
Subject: [PATCH 4/5] New package: cross-arm-none-eabi-gdb-8.2.1

---
 srcpkgs/cross-arm-none-eabi-gdb/template | 29 ++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gdb/template

diff --git a/srcpkgs/cross-arm-none-eabi-gdb/template b/srcpkgs/cross-arm-none-eabi-gdb/template
new file mode 100644
index 00000000000..e749f974f1c
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gdb/template
@@ -0,0 +1,29 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gdb
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.2.1
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+pycompile_dirs="/usr/share/${_pkgname}"
+configure_args="
+ --target=${_triplet}
+ --with-expat
+ --with-python3
+ --with-system-readline
+ --with-system-zlib
+"
+hostmakedepends="perl python python3-devel"
+makedepends="ncurses-devel zlib-devel readline-devel expat-devel python3-devel gettext-libs"
+short_desc="GNU Debugger"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202
+
+post_install() {
+	# resolve conflicts with binutils
+	rm -fr ${DESTDIR}/usr/{include,lib,lib64,share/info}
+}

From c1e9c1839f070df5e9ff2e4439733839756659f6 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:21:59 +0300
Subject: [PATCH 5/5] cross-arm-none-eabi: update to 0.4.

---
 srcpkgs/cross-arm-none-eabi/template | 367 +--------------------------
 1 file changed, 5 insertions(+), 362 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index c1c1d674dbb..e1e6542753f 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,367 +1,10 @@
-# Template file for 'cross-arm-none-eabi'
-_binutils_version=2.32
-_gcc_version=7.3.0
-_newlib_version=2.4.0.20161025
-
+# Template file for 'cross-${_triplet}'
 _triplet=arm-none-eabi
-_sysroot="/usr/${_triplet}"
-
 pkgname=cross-${_triplet}
-version=0.3
-revision=2
+version=0.4
+revision=1
+build_style=meta
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Thomas Bernard <thomas@famillebernardgouriou.fr>"
 homepage="https://www.voidlinux.org/"
-license="GPL-3, GPL-2, LGPL-2.1"
-distfiles="
- ${GNU_SITE}/binutils/binutils-${_binutils_version}.tar.xz
- ${GNU_SITE}/gcc/gcc-${_gcc_version}/gcc-${_gcc_version}.tar.xz
- ftp://sources.redhat.com/pub/newlib/newlib-${_newlib_version}.tar.gz"
-
-checksum="0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04
- 832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
- cbecbc637496fcec02829c12babf8441c6500eb1933c776d2fa4e0a9a35f081f"
-
-lib32disabled=yes
-nocross=yes
-nopie=yes
-nostrip=yes
-nodebug=yes
-create_wrksrc=yes
-
-hostmakedepends="perl flex bison"
-makedepends="zlib-devel gmp-devel mpfr-devel libmpc-devel isl16-devel"
-
-_apply_patch() {
-	local args="$1" pname="$(basename $2)"
-
-	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i $2
-		touch .${pname}_done
-	fi
-}
-
-pre_build() {
-	msg_normal "Preparing gcc source tree\n"
-}
-
-_binutils_build() {
-	local _args
-
-	[ -f ${wrksrc}/.binutils_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross binutils\n"
-	[ ! -d binutils-build ] && mkdir binutils-build
-	cd binutils-build
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --enable-multilib"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --enable-ld=default"
-	_args+=" --enable-plugins"
-	_args+=" --enable-deterministic-archives"
-
-	../binutils-${_binutils_version}/configure ${_args}
-
-	make configure-host
-	make ${makejobs}
-	make DESTDIR= install
-
-	touch ${wrksrc}/.binutils_build_done
-}
-
-_gcc_bootstrap() {
-	local _args
-
-	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
-
-	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch -p0 ${FILESDIR}/fix-cxxflags-passing.patch
-	_apply_patch -p1 ${FILESDIR}/enable-with-multilib-list-for-arm.patch
-
-	msg_normal "Building cross gcc bootstrap\n"
-
-	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
-	cd ../gcc-bootstrap
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --without-headers"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-languages=c"
-	_args+=" --with-newlib"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmpx"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libitm"
-	_args+=" --disable-libatomic"
-	_args+=" --disable-threads"
-	_args+=" --disable-sjlj-exceptions"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-gnu-as"
-
-	CFLAGS="-O0 -g0" CXXFLAGS="-O0 -g0" \
-		../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} -s all-gcc
-	make install-gcc
-
-	touch ${wrksrc}/.gcc_bootstrap_done
-}
-
-_newlib_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib\n"
-
-	[ ! -d newlib-build ] && mkdir newlib-build
-	cd newlib-build
-
-	export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --enable-newlib-io-long-long"
-	_args+=" --enable-newlib-register-fini"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-	make install
-
-	touch ${wrksrc}/.newlib_build_done
-}
-
-_newlib_nano_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib nano\n"
-
-	[ ! -d newlib-nano-build ] && mkdir newlib-nano-build
-	cd newlib-nano-build
-
-	export CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --disable-newlib-fvwrite-in-streamio"
-	_args+=" --disable-newlib-fseek-optimization"
-	_args+=" --disable-newlib-wide-orient"
-	_args+=" --enable-newlib-nano-malloc"
-	_args+=" --disable-newlib-unbuf-stream-opt"
-	_args+=" --enable-lite-exit"
-	_args+=" --enable-newlib-global-atexit"
-	_args+=" --enable-newlib-nano-formatted-io"
-	_args+=" --enable-newlib-reent-small"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-
-	touch ${wrksrc}/.newlib_nano_build_done
-}
-
-
-_gcc_build() {
-
-	[ -f ${wrksrc}/.gcc_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib\n"
-
-	[ ! -d gcc-build ] && mkdir gcc-build
-	cd gcc-build
-
-	export CFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_build_done
-}
-
-_gcc_nano_build() {
-
-	[ -f ${wrksrc}/.gcc_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib nano\n"
-
-	[ ! -d gcc-nano-build ] && mkdir gcc-nano-build
-	cd gcc-nano-build
-
-	export CFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_nano_build_done
-}
-
-
-_do_gcc_build() {
-	unset LD AS CPP
-
-	local _args
-
-	export CC="gcc"
-	_args="--prefix=/usr"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --libdir=/usr/lib"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --target=${_triplet}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --quiet"
-	_args+=" --enable-languages=c,c++"
-	_args+=" --with-native-system-header-dir=/include"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --enable-plugins"
-	_args+=" --with-gmp"
-	_args+=" --with-mpfr"
-	_args+=" --with-mpc"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libffi"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libstdcxx-pch"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-threads"
-	_args+=" --disable-tls"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-system-zlib"
-	_args+=" --with-newlib"
-	_args+=" --with-headers=${_sysroot}/include"
-	_args+=" --with-python-dir=share/gcc-arm-none-eabi"
-	_args+=" --with-isl"
-	_args+=" --with-libelf"
-	_args+=" --enable-gnu-indirect-function"
-	_args+=" --with-host-libstdcxx='-static-libgcc'"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-long-long"
-	_args+=" --enable-c99"
-	_args+=" --enable-__cxa_atexit"
-	_args+=" --disable-shared"
-	_args+=" --disable-werror"
-	_args+=" --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r"
-
-	../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
-
-}
-
-do_build() {
-	for f in include lib bin; do
-		if [ ! -d ${_sysroot}/usr/${f} ]; then
-			mkdir -p ${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${_sysroot}/${f} ]; then
-			ln -sfr ${_sysroot}/usr/${f} ${_sysroot}/${f}
-		fi
-	done
-
-	# Ensure we use sane environment
-	unset CC CXX CPP LD AS AR RANLIB OBJDUMP READELF NM
-	unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
-	export CFLAGS="-Os" CXXFLAGS="-Os"
-
-	_binutils_build
-	_gcc_bootstrap
-	_newlib_nano_build
-	_newlib_build
-	_gcc_build
-	_gcc_nano_build
-}
-
-do_install() {
-	for f in include lib bin; do
-		if [ ! -d ${DESTDIR}/${_sysroot}/usr/${f} ]; then
-			echo "Creating directory ${f}"
-			mkdir -p ${DESTDIR}/${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${DESTDIR}/${_sysroot}/${f} ]; then
-			echo "Linking directory ${f}"
-			ln -sfr ${DESTDIR}/${_sysroot}/usr/${f} \
-				${DESTDIR}/${_sysroot}/${f}
-		fi
-	done
-	# install cross binutils
-	cd ${wrksrc}/binutils-build
-	make DESTDIR=${DESTDIR} install
-
-	# install cross gcc
-	cd ${wrksrc}/gcc-build
-	make DESTDIR=${DESTDIR} install
-
-	cd ${wrksrc}/gcc-nano-build
-	make DESTDIR=${DESTDIR}.nano install
-
-	# we need only libstdc nano files
-	multilibs=( $(${DESTDIR}/usr/bin/${_triplet}-gcc -print-multi-lib 2>/dev/null)  )
-	for multilib in "${multilibs[@]}"; do
-		dir="${multilib%%;*}"
-		from_dir=${DESTDIR}.nano/usr/${_triplet}/lib/$dir
-		to_dir=${DESTDIR}/${_sysroot}/lib/$dir
-		cp -f $from_dir/libstdc++.a $to_dir/libstdc++_nano.a
-		cp -f $from_dir/libsupc++.a $to_dir/libsupc++_nano.a
-	done
-
-	# install newlib for target
-	cd ${wrksrc}/newlib-nano-build
-	make DESTDIR=${DESTDIR} install
-	find "$DESTDIR" -regex ".*/lib\(c\|g\|rdimon\)\.a" -exec rename .a _nano.a '{}' \;
-
-	cd ${wrksrc}/newlib-build
-	make DESTDIR=${DESTDIR} install
-
-	# strip target binaries
-	find ${DESTDIR}/${_sysroot}/usr/lib \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-
-	# strip host binaries
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-	find ${DESTDIR}/usr/bin -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-
-	# Remove unnecessary stuff
-	rm -rf ${DESTDIR}.nano
-	rm -f ${DESTDIR}/usr/lib*/libiberty.a
-	rm -rf ${DESTDIR}/usr/share
-	rm -rf ${DESTDIR}/${_sysroot}/{sbin,etc,var}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/{sbin,share,libexec}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/lib/gconv
-	rm -f ${DESTDIR}/usr/lib/libcc1.*
-	rm -f ${DESTDIR}/${_sysroot}/libexec
-}

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
@ 2019-05-09 15:00 ` voidlinux-github
  2019-05-09 15:57 ` voidlinux-github
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 15:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490940951
Comment:
This looks good to me and we have not seen updates for quite some time for this target.
IMHO this won't confuse newcomers. They would probably not look for `cross*` packages at all.
I'm trying to build here and will report (build) problems, if any.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
  2019-05-09 15:00 ` voidlinux-github
@ 2019-05-09 15:57 ` voidlinux-github
  2019-05-09 16:09 ` voidlinux-github
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 15:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

New comment by sirikid on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490963240
Comment:
I built the packages on x86_64-glibc and used them to compile my STM32 project, everything works well. [Binutils build on Trevis.](https://travis-ci.org/sirikid/void-packages/builds/528590834) There are problems with fetching newlib tarballs, which can be fixed by using wget instead of curl, but I don't know what is actually happening.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
  2019-05-09 15:00 ` voidlinux-github
  2019-05-09 15:57 ` voidlinux-github
@ 2019-05-09 16:09 ` voidlinux-github
  2019-05-09 16:12 ` voidlinux-github
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 16:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

New comment by sirikid on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490963240
Comment:
I built the packages on x86_64-glibc and used them to compile my STM32 project, everything works fine. [Binutils build on Trevis.](https://travis-ci.org/sirikid/void-packages/builds/528590834) There are problems with fetching newlib tarballs, which can be fixed by using wget instead of curl, but I don't know what is actually happening.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (2 preceding siblings ...)
  2019-05-09 16:09 ` voidlinux-github
@ 2019-05-09 16:12 ` voidlinux-github
  2019-05-09 16:44 ` voidlinux-github
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 16:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490968961
Comment:
I could build the package for x86_64* and i686* so it seems ok, If you say it also works for you then I'd ask @void-linux/pkg-committers if this is ok to merge?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (3 preceding siblings ...)
  2019-05-09 16:12 ` voidlinux-github
@ 2019-05-09 16:44 ` voidlinux-github
  2019-05-09 17:02 ` [PR PATCH] [Updated] " voidlinux-github
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 16:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

New comment by jnbr on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490979857
Comment:
There is a risk of breaking installations when moving files between packages.
To prevent this, this PR should be merged in two steps, `cross-arm-none-eabi-*` first and then `cross-arm-none-eabi`, so that `cross-arm-none-eabi` has a different timestamp than the remaining packages.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (4 preceding siblings ...)
  2019-05-09 16:44 ` voidlinux-github
@ 2019-05-09 17:02 ` voidlinux-github
  2019-05-09 17:02 ` voidlinux-github
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 17:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

There is an updated pull request by sirikid against master on the void-packages repository

https://github.com/sirikid/void-packages cross-arm-none-eabi
https://github.com/void-linux/void-packages/pull/11571

[WIP] [RFC] cross-arm-none-eabi rework
Why:
- More granular updates — each component of the toolchain can be built and updated separately.
- Extensive use of template system features — less manual work and less mistakes.

Why not:
- Additional points of failure. Possible solution: arm-none-eabi [build helper](https://github.com/void-linux/void-packages/blob/master/Manual.md#build-helper-scripts).
- More packages in the repo with strange prefixes — this can confuse newcomers.

Please write your thoughts if you are interested in this package or in cross compilation in general, because I don’t even know if anyone except me needs this rework.


A patch file from https://github.com/void-linux/void-packages/pull/11571.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cross-arm-none-eabi-11571.patch --]
[-- Type: application/text/x-diff, Size: 17939 bytes --]

From f4962cb9911ba7f365562fd8ec8cb86ba3337e8c Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Tue, 30 Apr 2019 18:25:51 +0300
Subject: [PATCH 1/5] New package: cross-arm-none-eabi-binutils-2.32

---
 srcpkgs/cross-arm-none-eabi-binutils/template | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-binutils/template

diff --git a/srcpkgs/cross-arm-none-eabi-binutils/template b/srcpkgs/cross-arm-none-eabi-binutils/template
new file mode 100644
index 00000000000..bc7da156229
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-binutils/template
@@ -0,0 +1,27 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=binutils
+pkgname=cross-${_triplet}-${_pkgname}
+version=2.32
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-nls
+ --enable-deterministic-archives
+ --enable-interwork
+ --enable-ld=default
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --target=${_triplet}
+ --with-gnu-as
+ --with-gnu-ld
+ --with-sysroot=/usr/${_triplet}
+"
+short_desc="GNU binary utilities"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}/"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04

From 017b5d6aaee5e0ade4f1d7b3ff87e8e8b0403fba Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Mon, 6 May 2019 04:09:29 +0300
Subject: [PATCH 2/5] New package: cross-arm-none-eabi-gcc-8.3.0

---
 srcpkgs/cross-arm-none-eabi-gcc/template | 70 ++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gcc/template

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
new file mode 100644
index 00000000000..d939d902723
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -0,0 +1,70 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gcc
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.3.0
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-decimal-float
+ --disable-libffi
+ --disable-libgomp
+ --disable-libmudflap
+ --disable-libquadmath
+ --disable-libssp
+ --disable-libstdcxx-pch
+ --disable-nls
+ --disable-shared
+ --disable-shared
+ --disable-threads
+ --disable-tls
+ --disable-werror
+ --enable-__cxa_atexit
+ --enable-c99
+ --enable-gnu-indirect-function
+ --enable-internetwork
+ --enable-languages=c,c++
+ --enable-long-long
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --libdir=/usr/lib
+ --libexecdir=/usr/lib
+ --prefix=/usr
+ --quiet
+ --target=${_triplet}
+ --with-gmp
+ --with-gnu-as
+ --with-gnu-ld
+ --with-headers=/usr/${_triplet}/include
+ --with-host-libstdcxx='-static-libgcc'
+ --with-isl
+ --with-libelf
+ --with-mpc
+ --with-mpfr
+ --with-multilib-list=rmprofile
+ --with-native-system-header-dir=/include
+ --with-newlib
+ --with-python-dir=share/${pkgname}
+ --with-sysroot=/usr/${_triplet}
+ --with-system-zlib
+"
+make_build_args="INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 -s"
+make_build_target="all-gcc"
+make_install_target="install-gcc"
+hostmakedepends="bison flex perl"
+makedepends="gmp-devel isl16-devel libmpc-devel mpfr-devel zlib-devel"
+short_desc="GNU Compiler Collection"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}/${_pkgname}-${version}.tar.xz"
+checksum=64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
+alternatives="arm-none-eabi-cc:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
+nopie=yes
+
+post_install() {
+	rm -fr ${DESTDIR}/usr/share/info
+	rm -fr ${DESTDIR}/usr/share/man/man7
+}

From c434104ceb638b9d6af4554d06daa7bacfd69ed9 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:00:16 +0300
Subject: [PATCH 3/5] New package: cross-arm-none-eabi-newlib-3.1.0.20181231

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 28 +++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-newlib/template

diff --git a/srcpkgs/cross-arm-none-eabi-newlib/template b/srcpkgs/cross-arm-none-eabi-newlib/template
new file mode 100644
index 00000000000..076c52c93f3
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-newlib/template
@@ -0,0 +1,28 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=newlib
+pkgname=cross-${_triplet}-${_pkgname}
+version=3.1.0.20181231
+revision=1
+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
+"
+hostmakedepends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc"
+short_desc="C library intended for use on embedded systems"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.sourceware.org/${_pkgname}/"
+distfiles="ftp://sources.redhat.com/pub/${_pkgname}/${_pkgname}-${version}.tar.gz"
+checksum=9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0
+nostrip=yes

From 500510526c41c052e6c46f57b77bc2a3d022d851 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:16:24 +0300
Subject: [PATCH 4/5] New package: cross-arm-none-eabi-gdb-8.2.1

---
 srcpkgs/cross-arm-none-eabi-gdb/template | 29 ++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gdb/template

diff --git a/srcpkgs/cross-arm-none-eabi-gdb/template b/srcpkgs/cross-arm-none-eabi-gdb/template
new file mode 100644
index 00000000000..e749f974f1c
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gdb/template
@@ -0,0 +1,29 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gdb
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.2.1
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+pycompile_dirs="/usr/share/${_pkgname}"
+configure_args="
+ --target=${_triplet}
+ --with-expat
+ --with-python3
+ --with-system-readline
+ --with-system-zlib
+"
+hostmakedepends="perl python python3-devel"
+makedepends="ncurses-devel zlib-devel readline-devel expat-devel python3-devel gettext-libs"
+short_desc="GNU Debugger"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202
+
+post_install() {
+	# resolve conflicts with binutils
+	rm -fr ${DESTDIR}/usr/{include,lib,lib64,share/info}
+}

From ba798d68b496cf5dcccef052fd3901e8a55f084d Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:21:59 +0300
Subject: [PATCH 5/5] cross-arm-none-eabi: update to 0.4.

---
 srcpkgs/cross-arm-none-eabi/template | 368 +--------------------------
 1 file changed, 6 insertions(+), 362 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index c1c1d674dbb..c1e909efad3 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,367 +1,11 @@
-# Template file for 'cross-arm-none-eabi'
-_binutils_version=2.32
-_gcc_version=7.3.0
-_newlib_version=2.4.0.20161025
-
+# Template file for 'cross-${_triplet}'
 _triplet=arm-none-eabi
-_sysroot="/usr/${_triplet}"
-
 pkgname=cross-${_triplet}
-version=0.3
-revision=2
+version=0.4
+revision=1
+build_style=meta
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Thomas Bernard <thomas@famillebernardgouriou.fr>"
+license="metapackage"
 homepage="https://www.voidlinux.org/"
-license="GPL-3, GPL-2, LGPL-2.1"
-distfiles="
- ${GNU_SITE}/binutils/binutils-${_binutils_version}.tar.xz
- ${GNU_SITE}/gcc/gcc-${_gcc_version}/gcc-${_gcc_version}.tar.xz
- ftp://sources.redhat.com/pub/newlib/newlib-${_newlib_version}.tar.gz"
-
-checksum="0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04
- 832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
- cbecbc637496fcec02829c12babf8441c6500eb1933c776d2fa4e0a9a35f081f"
-
-lib32disabled=yes
-nocross=yes
-nopie=yes
-nostrip=yes
-nodebug=yes
-create_wrksrc=yes
-
-hostmakedepends="perl flex bison"
-makedepends="zlib-devel gmp-devel mpfr-devel libmpc-devel isl16-devel"
-
-_apply_patch() {
-	local args="$1" pname="$(basename $2)"
-
-	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i $2
-		touch .${pname}_done
-	fi
-}
-
-pre_build() {
-	msg_normal "Preparing gcc source tree\n"
-}
-
-_binutils_build() {
-	local _args
-
-	[ -f ${wrksrc}/.binutils_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross binutils\n"
-	[ ! -d binutils-build ] && mkdir binutils-build
-	cd binutils-build
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --enable-multilib"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --enable-ld=default"
-	_args+=" --enable-plugins"
-	_args+=" --enable-deterministic-archives"
-
-	../binutils-${_binutils_version}/configure ${_args}
-
-	make configure-host
-	make ${makejobs}
-	make DESTDIR= install
-
-	touch ${wrksrc}/.binutils_build_done
-}
-
-_gcc_bootstrap() {
-	local _args
-
-	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
-
-	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch -p0 ${FILESDIR}/fix-cxxflags-passing.patch
-	_apply_patch -p1 ${FILESDIR}/enable-with-multilib-list-for-arm.patch
-
-	msg_normal "Building cross gcc bootstrap\n"
-
-	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
-	cd ../gcc-bootstrap
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --without-headers"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-languages=c"
-	_args+=" --with-newlib"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmpx"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libitm"
-	_args+=" --disable-libatomic"
-	_args+=" --disable-threads"
-	_args+=" --disable-sjlj-exceptions"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-gnu-as"
-
-	CFLAGS="-O0 -g0" CXXFLAGS="-O0 -g0" \
-		../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} -s all-gcc
-	make install-gcc
-
-	touch ${wrksrc}/.gcc_bootstrap_done
-}
-
-_newlib_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib\n"
-
-	[ ! -d newlib-build ] && mkdir newlib-build
-	cd newlib-build
-
-	export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --enable-newlib-io-long-long"
-	_args+=" --enable-newlib-register-fini"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-	make install
-
-	touch ${wrksrc}/.newlib_build_done
-}
-
-_newlib_nano_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib nano\n"
-
-	[ ! -d newlib-nano-build ] && mkdir newlib-nano-build
-	cd newlib-nano-build
-
-	export CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --disable-newlib-fvwrite-in-streamio"
-	_args+=" --disable-newlib-fseek-optimization"
-	_args+=" --disable-newlib-wide-orient"
-	_args+=" --enable-newlib-nano-malloc"
-	_args+=" --disable-newlib-unbuf-stream-opt"
-	_args+=" --enable-lite-exit"
-	_args+=" --enable-newlib-global-atexit"
-	_args+=" --enable-newlib-nano-formatted-io"
-	_args+=" --enable-newlib-reent-small"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-
-	touch ${wrksrc}/.newlib_nano_build_done
-}
-
-
-_gcc_build() {
-
-	[ -f ${wrksrc}/.gcc_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib\n"
-
-	[ ! -d gcc-build ] && mkdir gcc-build
-	cd gcc-build
-
-	export CFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_build_done
-}
-
-_gcc_nano_build() {
-
-	[ -f ${wrksrc}/.gcc_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib nano\n"
-
-	[ ! -d gcc-nano-build ] && mkdir gcc-nano-build
-	cd gcc-nano-build
-
-	export CFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_nano_build_done
-}
-
-
-_do_gcc_build() {
-	unset LD AS CPP
-
-	local _args
-
-	export CC="gcc"
-	_args="--prefix=/usr"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --libdir=/usr/lib"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --target=${_triplet}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --quiet"
-	_args+=" --enable-languages=c,c++"
-	_args+=" --with-native-system-header-dir=/include"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --enable-plugins"
-	_args+=" --with-gmp"
-	_args+=" --with-mpfr"
-	_args+=" --with-mpc"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libffi"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libstdcxx-pch"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-threads"
-	_args+=" --disable-tls"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-system-zlib"
-	_args+=" --with-newlib"
-	_args+=" --with-headers=${_sysroot}/include"
-	_args+=" --with-python-dir=share/gcc-arm-none-eabi"
-	_args+=" --with-isl"
-	_args+=" --with-libelf"
-	_args+=" --enable-gnu-indirect-function"
-	_args+=" --with-host-libstdcxx='-static-libgcc'"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-long-long"
-	_args+=" --enable-c99"
-	_args+=" --enable-__cxa_atexit"
-	_args+=" --disable-shared"
-	_args+=" --disable-werror"
-	_args+=" --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r"
-
-	../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
-
-}
-
-do_build() {
-	for f in include lib bin; do
-		if [ ! -d ${_sysroot}/usr/${f} ]; then
-			mkdir -p ${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${_sysroot}/${f} ]; then
-			ln -sfr ${_sysroot}/usr/${f} ${_sysroot}/${f}
-		fi
-	done
-
-	# Ensure we use sane environment
-	unset CC CXX CPP LD AS AR RANLIB OBJDUMP READELF NM
-	unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
-	export CFLAGS="-Os" CXXFLAGS="-Os"
-
-	_binutils_build
-	_gcc_bootstrap
-	_newlib_nano_build
-	_newlib_build
-	_gcc_build
-	_gcc_nano_build
-}
-
-do_install() {
-	for f in include lib bin; do
-		if [ ! -d ${DESTDIR}/${_sysroot}/usr/${f} ]; then
-			echo "Creating directory ${f}"
-			mkdir -p ${DESTDIR}/${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${DESTDIR}/${_sysroot}/${f} ]; then
-			echo "Linking directory ${f}"
-			ln -sfr ${DESTDIR}/${_sysroot}/usr/${f} \
-				${DESTDIR}/${_sysroot}/${f}
-		fi
-	done
-	# install cross binutils
-	cd ${wrksrc}/binutils-build
-	make DESTDIR=${DESTDIR} install
-
-	# install cross gcc
-	cd ${wrksrc}/gcc-build
-	make DESTDIR=${DESTDIR} install
-
-	cd ${wrksrc}/gcc-nano-build
-	make DESTDIR=${DESTDIR}.nano install
-
-	# we need only libstdc nano files
-	multilibs=( $(${DESTDIR}/usr/bin/${_triplet}-gcc -print-multi-lib 2>/dev/null)  )
-	for multilib in "${multilibs[@]}"; do
-		dir="${multilib%%;*}"
-		from_dir=${DESTDIR}.nano/usr/${_triplet}/lib/$dir
-		to_dir=${DESTDIR}/${_sysroot}/lib/$dir
-		cp -f $from_dir/libstdc++.a $to_dir/libstdc++_nano.a
-		cp -f $from_dir/libsupc++.a $to_dir/libsupc++_nano.a
-	done
-
-	# install newlib for target
-	cd ${wrksrc}/newlib-nano-build
-	make DESTDIR=${DESTDIR} install
-	find "$DESTDIR" -regex ".*/lib\(c\|g\|rdimon\)\.a" -exec rename .a _nano.a '{}' \;
-
-	cd ${wrksrc}/newlib-build
-	make DESTDIR=${DESTDIR} install
-
-	# strip target binaries
-	find ${DESTDIR}/${_sysroot}/usr/lib \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-
-	# strip host binaries
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-	find ${DESTDIR}/usr/bin -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-
-	# Remove unnecessary stuff
-	rm -rf ${DESTDIR}.nano
-	rm -f ${DESTDIR}/usr/lib*/libiberty.a
-	rm -rf ${DESTDIR}/usr/share
-	rm -rf ${DESTDIR}/${_sysroot}/{sbin,etc,var}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/{sbin,share,libexec}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/lib/gconv
-	rm -f ${DESTDIR}/usr/lib/libcc1.*
-	rm -f ${DESTDIR}/${_sysroot}/libexec
-}

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (5 preceding siblings ...)
  2019-05-09 17:02 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-05-09 17:02 ` voidlinux-github
  2019-05-09 17:26 ` voidlinux-github
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 17:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

There is an updated pull request by sirikid against master on the void-packages repository

https://github.com/sirikid/void-packages cross-arm-none-eabi
https://github.com/void-linux/void-packages/pull/11571

[WIP] [RFC] cross-arm-none-eabi rework
Why:
- More granular updates — each component of the toolchain can be built and updated separately.
- Extensive use of template system features — less manual work and less mistakes.

Why not:
- Additional points of failure. Possible solution: arm-none-eabi [build helper](https://github.com/void-linux/void-packages/blob/master/Manual.md#build-helper-scripts).
- More packages in the repo with strange prefixes — this can confuse newcomers.

Please write your thoughts if you are interested in this package or in cross compilation in general, because I don’t even know if anyone except me needs this rework.


A patch file from https://github.com/void-linux/void-packages/pull/11571.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cross-arm-none-eabi-11571.patch --]
[-- Type: application/text/x-diff, Size: 17939 bytes --]

From f4962cb9911ba7f365562fd8ec8cb86ba3337e8c Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Tue, 30 Apr 2019 18:25:51 +0300
Subject: [PATCH 1/5] New package: cross-arm-none-eabi-binutils-2.32

---
 srcpkgs/cross-arm-none-eabi-binutils/template | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-binutils/template

diff --git a/srcpkgs/cross-arm-none-eabi-binutils/template b/srcpkgs/cross-arm-none-eabi-binutils/template
new file mode 100644
index 00000000000..bc7da156229
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-binutils/template
@@ -0,0 +1,27 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=binutils
+pkgname=cross-${_triplet}-${_pkgname}
+version=2.32
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-nls
+ --enable-deterministic-archives
+ --enable-interwork
+ --enable-ld=default
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --target=${_triplet}
+ --with-gnu-as
+ --with-gnu-ld
+ --with-sysroot=/usr/${_triplet}
+"
+short_desc="GNU binary utilities"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}/"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04

From 017b5d6aaee5e0ade4f1d7b3ff87e8e8b0403fba Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Mon, 6 May 2019 04:09:29 +0300
Subject: [PATCH 2/5] New package: cross-arm-none-eabi-gcc-8.3.0

---
 srcpkgs/cross-arm-none-eabi-gcc/template | 70 ++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gcc/template

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
new file mode 100644
index 00000000000..d939d902723
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -0,0 +1,70 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gcc
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.3.0
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-decimal-float
+ --disable-libffi
+ --disable-libgomp
+ --disable-libmudflap
+ --disable-libquadmath
+ --disable-libssp
+ --disable-libstdcxx-pch
+ --disable-nls
+ --disable-shared
+ --disable-shared
+ --disable-threads
+ --disable-tls
+ --disable-werror
+ --enable-__cxa_atexit
+ --enable-c99
+ --enable-gnu-indirect-function
+ --enable-internetwork
+ --enable-languages=c,c++
+ --enable-long-long
+ --enable-multilib
+ --enable-plugins
+ --host=${XBPS_CROSS_TRIPLET}
+ --libdir=/usr/lib
+ --libexecdir=/usr/lib
+ --prefix=/usr
+ --quiet
+ --target=${_triplet}
+ --with-gmp
+ --with-gnu-as
+ --with-gnu-ld
+ --with-headers=/usr/${_triplet}/include
+ --with-host-libstdcxx='-static-libgcc'
+ --with-isl
+ --with-libelf
+ --with-mpc
+ --with-mpfr
+ --with-multilib-list=rmprofile
+ --with-native-system-header-dir=/include
+ --with-newlib
+ --with-python-dir=share/${pkgname}
+ --with-sysroot=/usr/${_triplet}
+ --with-system-zlib
+"
+make_build_args="INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 -s"
+make_build_target="all-gcc"
+make_install_target="install-gcc"
+hostmakedepends="bison flex perl"
+makedepends="gmp-devel isl16-devel libmpc-devel mpfr-devel zlib-devel"
+short_desc="GNU Compiler Collection"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}/${_pkgname}-${version}.tar.xz"
+checksum=64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
+alternatives="arm-none-eabi-cc:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
+nopie=yes
+
+post_install() {
+	rm -fr ${DESTDIR}/usr/share/info
+	rm -fr ${DESTDIR}/usr/share/man/man7
+}

From c434104ceb638b9d6af4554d06daa7bacfd69ed9 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:00:16 +0300
Subject: [PATCH 3/5] New package: cross-arm-none-eabi-newlib-3.1.0.20181231

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 28 +++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-newlib/template

diff --git a/srcpkgs/cross-arm-none-eabi-newlib/template b/srcpkgs/cross-arm-none-eabi-newlib/template
new file mode 100644
index 00000000000..076c52c93f3
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-newlib/template
@@ -0,0 +1,28 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=newlib
+pkgname=cross-${_triplet}-${_pkgname}
+version=3.1.0.20181231
+revision=1
+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
+"
+hostmakedepends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc"
+short_desc="C library intended for use on embedded systems"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.sourceware.org/${_pkgname}/"
+distfiles="ftp://sources.redhat.com/pub/${_pkgname}/${_pkgname}-${version}.tar.gz"
+checksum=9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0
+nostrip=yes

From 500510526c41c052e6c46f57b77bc2a3d022d851 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:16:24 +0300
Subject: [PATCH 4/5] New package: cross-arm-none-eabi-gdb-8.2.1

---
 srcpkgs/cross-arm-none-eabi-gdb/template | 29 ++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-gdb/template

diff --git a/srcpkgs/cross-arm-none-eabi-gdb/template b/srcpkgs/cross-arm-none-eabi-gdb/template
new file mode 100644
index 00000000000..e749f974f1c
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-gdb/template
@@ -0,0 +1,29 @@
+# Template file for 'cross-${_triplet}-${_pkgname}'
+_triplet=arm-none-eabi
+_pkgname=gdb
+pkgname=cross-${_triplet}-${_pkgname}
+version=8.2.1
+revision=1
+wrksrc="${_pkgname}-${version}"
+build_style=gnu-configure
+pycompile_dirs="/usr/share/${_pkgname}"
+configure_args="
+ --target=${_triplet}
+ --with-expat
+ --with-python3
+ --with-system-readline
+ --with-system-zlib
+"
+hostmakedepends="perl python python3-devel"
+makedepends="ncurses-devel zlib-devel readline-devel expat-devel python3-devel gettext-libs"
+short_desc="GNU Debugger"
+maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
+license="GPL-3.0-or-later"
+homepage="https://www.gnu.org/software/${_pkgname}"
+distfiles="${GNU_SITE}/${_pkgname}/${_pkgname}-${version}.tar.xz"
+checksum=0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202
+
+post_install() {
+	# resolve conflicts with binutils
+	rm -fr ${DESTDIR}/usr/{include,lib,lib64,share/info}
+}

From ba798d68b496cf5dcccef052fd3901e8a55f084d Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Wed, 8 May 2019 23:21:59 +0300
Subject: [PATCH 5/5] cross-arm-none-eabi: update to 0.4.

---
 srcpkgs/cross-arm-none-eabi/template | 368 +--------------------------
 1 file changed, 6 insertions(+), 362 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index c1c1d674dbb..c1e909efad3 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,367 +1,11 @@
-# Template file for 'cross-arm-none-eabi'
-_binutils_version=2.32
-_gcc_version=7.3.0
-_newlib_version=2.4.0.20161025
-
+# Template file for 'cross-${_triplet}'
 _triplet=arm-none-eabi
-_sysroot="/usr/${_triplet}"
-
 pkgname=cross-${_triplet}
-version=0.3
-revision=2
+version=0.4
+revision=1
+build_style=meta
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Thomas Bernard <thomas@famillebernardgouriou.fr>"
+license="metapackage"
 homepage="https://www.voidlinux.org/"
-license="GPL-3, GPL-2, LGPL-2.1"
-distfiles="
- ${GNU_SITE}/binutils/binutils-${_binutils_version}.tar.xz
- ${GNU_SITE}/gcc/gcc-${_gcc_version}/gcc-${_gcc_version}.tar.xz
- ftp://sources.redhat.com/pub/newlib/newlib-${_newlib_version}.tar.gz"
-
-checksum="0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04
- 832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
- cbecbc637496fcec02829c12babf8441c6500eb1933c776d2fa4e0a9a35f081f"
-
-lib32disabled=yes
-nocross=yes
-nopie=yes
-nostrip=yes
-nodebug=yes
-create_wrksrc=yes
-
-hostmakedepends="perl flex bison"
-makedepends="zlib-devel gmp-devel mpfr-devel libmpc-devel isl16-devel"
-
-_apply_patch() {
-	local args="$1" pname="$(basename $2)"
-
-	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i $2
-		touch .${pname}_done
-	fi
-}
-
-pre_build() {
-	msg_normal "Preparing gcc source tree\n"
-}
-
-_binutils_build() {
-	local _args
-
-	[ -f ${wrksrc}/.binutils_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross binutils\n"
-	[ ! -d binutils-build ] && mkdir binutils-build
-	cd binutils-build
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --enable-multilib"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --enable-ld=default"
-	_args+=" --enable-plugins"
-	_args+=" --enable-deterministic-archives"
-
-	../binutils-${_binutils_version}/configure ${_args}
-
-	make configure-host
-	make ${makejobs}
-	make DESTDIR= install
-
-	touch ${wrksrc}/.binutils_build_done
-}
-
-_gcc_bootstrap() {
-	local _args
-
-	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
-
-	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch -p0 ${FILESDIR}/fix-cxxflags-passing.patch
-	_apply_patch -p1 ${FILESDIR}/enable-with-multilib-list-for-arm.patch
-
-	msg_normal "Building cross gcc bootstrap\n"
-
-	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
-	cd ../gcc-bootstrap
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --without-headers"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-languages=c"
-	_args+=" --with-newlib"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmpx"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libitm"
-	_args+=" --disable-libatomic"
-	_args+=" --disable-threads"
-	_args+=" --disable-sjlj-exceptions"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-gnu-as"
-
-	CFLAGS="-O0 -g0" CXXFLAGS="-O0 -g0" \
-		../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} -s all-gcc
-	make install-gcc
-
-	touch ${wrksrc}/.gcc_bootstrap_done
-}
-
-_newlib_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib\n"
-
-	[ ! -d newlib-build ] && mkdir newlib-build
-	cd newlib-build
-
-	export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --enable-newlib-io-long-long"
-	_args+=" --enable-newlib-register-fini"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-	make install
-
-	touch ${wrksrc}/.newlib_build_done
-}
-
-_newlib_nano_build() {
-	local _args
-
-	[ -f ${wrksrc}/.newlib_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross newlib nano\n"
-
-	[ ! -d newlib-nano-build ] && mkdir newlib-nano-build
-	cd newlib-nano-build
-
-	export CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections"
-
-	_args="--prefix=/usr"
-	_args+=" --target=${_triplet}"
-	_args+=" --enable-interwork"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --disable-nls"
-	_args+=" --disable-newlib-supplied-syscalls"
-	_args+=" --disable-newlib-fvwrite-in-streamio"
-	_args+=" --disable-newlib-fseek-optimization"
-	_args+=" --disable-newlib-wide-orient"
-	_args+=" --enable-newlib-nano-malloc"
-	_args+=" --disable-newlib-unbuf-stream-opt"
-	_args+=" --enable-lite-exit"
-	_args+=" --enable-newlib-global-atexit"
-	_args+=" --enable-newlib-nano-formatted-io"
-	_args+=" --enable-newlib-reent-small"
-
-	../newlib-${_newlib_version}/configure ${_args}
-
-	make ${makejobs}
-
-	touch ${wrksrc}/.newlib_nano_build_done
-}
-
-
-_gcc_build() {
-
-	[ -f ${wrksrc}/.gcc_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib\n"
-
-	[ ! -d gcc-build ] && mkdir gcc-build
-	cd gcc-build
-
-	export CFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -O2 -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_build_done
-}
-
-_gcc_nano_build() {
-
-	[ -f ${wrksrc}/.gcc_nano_build_done ] && return 0
-
-	cd ${wrksrc}
-	msg_normal "Building cross gcc newlib nano\n"
-
-	[ ! -d gcc-nano-build ] && mkdir gcc-nano-build
-	cd gcc-nano-build
-
-	export CFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	export CXXFLAGS='-g -Os -pipe -ffunction-sections -fdata-sections'
-	_do_gcc_build
-
-	touch ${wrksrc}/.gcc_nano_build_done
-}
-
-
-_do_gcc_build() {
-	unset LD AS CPP
-
-	local _args
-
-	export CC="gcc"
-	_args="--prefix=/usr"
-	_args+=" --host=${XBPS_CROSS_TRIPLET}"
-	_args+=" --libdir=/usr/lib"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --target=${_triplet}"
-	_args+=" --with-sysroot=${_sysroot}"
-	_args+=" --quiet"
-	_args+=" --enable-languages=c,c++"
-	_args+=" --with-native-system-header-dir=/include"
-	_args+=" --libexecdir=/usr/lib"
-	_args+=" --enable-plugins"
-	_args+=" --with-gmp"
-	_args+=" --with-mpfr"
-	_args+=" --with-mpc"
-	_args+=" --disable-decimal-float"
-	_args+=" --disable-libffi"
-	_args+=" --disable-libgomp"
-	_args+=" --disable-libmudflap"
-	_args+=" --disable-libquadmath"
-	_args+=" --disable-libssp"
-	_args+=" --disable-libstdcxx-pch"
-	_args+=" --disable-nls"
-	_args+=" --disable-shared"
-	_args+=" --disable-threads"
-	_args+=" --disable-tls"
-	_args+=" --with-gnu-as"
-	_args+=" --with-gnu-ld"
-	_args+=" --with-system-zlib"
-	_args+=" --with-newlib"
-	_args+=" --with-headers=${_sysroot}/include"
-	_args+=" --with-python-dir=share/gcc-arm-none-eabi"
-	_args+=" --with-isl"
-	_args+=" --with-libelf"
-	_args+=" --enable-gnu-indirect-function"
-	_args+=" --with-host-libstdcxx='-static-libgcc'"
-	_args+=" --enable-internetwork"
-	_args+=" --enable-multilib"
-	_args+=" --enable-long-long"
-	_args+=" --enable-c99"
-	_args+=" --enable-__cxa_atexit"
-	_args+=" --disable-shared"
-	_args+=" --disable-werror"
-	_args+=" --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r"
-
-	../gcc-${_gcc_version}/configure ${_args}
-
-	make ${makejobs} INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
-
-}
-
-do_build() {
-	for f in include lib bin; do
-		if [ ! -d ${_sysroot}/usr/${f} ]; then
-			mkdir -p ${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${_sysroot}/${f} ]; then
-			ln -sfr ${_sysroot}/usr/${f} ${_sysroot}/${f}
-		fi
-	done
-
-	# Ensure we use sane environment
-	unset CC CXX CPP LD AS AR RANLIB OBJDUMP READELF NM
-	unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
-	export CFLAGS="-Os" CXXFLAGS="-Os"
-
-	_binutils_build
-	_gcc_bootstrap
-	_newlib_nano_build
-	_newlib_build
-	_gcc_build
-	_gcc_nano_build
-}
-
-do_install() {
-	for f in include lib bin; do
-		if [ ! -d ${DESTDIR}/${_sysroot}/usr/${f} ]; then
-			echo "Creating directory ${f}"
-			mkdir -p ${DESTDIR}/${_sysroot}/usr/${f}
-		fi
-		if [ ! -h ${DESTDIR}/${_sysroot}/${f} ]; then
-			echo "Linking directory ${f}"
-			ln -sfr ${DESTDIR}/${_sysroot}/usr/${f} \
-				${DESTDIR}/${_sysroot}/${f}
-		fi
-	done
-	# install cross binutils
-	cd ${wrksrc}/binutils-build
-	make DESTDIR=${DESTDIR} install
-
-	# install cross gcc
-	cd ${wrksrc}/gcc-build
-	make DESTDIR=${DESTDIR} install
-
-	cd ${wrksrc}/gcc-nano-build
-	make DESTDIR=${DESTDIR}.nano install
-
-	# we need only libstdc nano files
-	multilibs=( $(${DESTDIR}/usr/bin/${_triplet}-gcc -print-multi-lib 2>/dev/null)  )
-	for multilib in "${multilibs[@]}"; do
-		dir="${multilib%%;*}"
-		from_dir=${DESTDIR}.nano/usr/${_triplet}/lib/$dir
-		to_dir=${DESTDIR}/${_sysroot}/lib/$dir
-		cp -f $from_dir/libstdc++.a $to_dir/libstdc++_nano.a
-		cp -f $from_dir/libsupc++.a $to_dir/libsupc++_nano.a
-	done
-
-	# install newlib for target
-	cd ${wrksrc}/newlib-nano-build
-	make DESTDIR=${DESTDIR} install
-	find "$DESTDIR" -regex ".*/lib\(c\|g\|rdimon\)\.a" -exec rename .a _nano.a '{}' \;
-
-	cd ${wrksrc}/newlib-build
-	make DESTDIR=${DESTDIR} install
-
-	# strip target binaries
-	find ${DESTDIR}/${_sysroot}/usr/lib \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} \( -name "*.a" -or -name "*.o" \) -exec ${_triplet}-strip '{}' \;
-
-	# strip host binaries
-	find ${DESTDIR}/usr/lib/gcc/${_triplet}/${_gcc_version} -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-	find ${DESTDIR}/usr/bin -type f -and \( -executable \) -exec /usr/bin/strip '{}' \;
-
-	# Remove unnecessary stuff
-	rm -rf ${DESTDIR}.nano
-	rm -f ${DESTDIR}/usr/lib*/libiberty.a
-	rm -rf ${DESTDIR}/usr/share
-	rm -rf ${DESTDIR}/${_sysroot}/{sbin,etc,var}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/{sbin,share,libexec}
-	rm -rf ${DESTDIR}/${_sysroot}/usr/lib/gconv
-	rm -f ${DESTDIR}/usr/lib/libcc1.*
-	rm -f ${DESTDIR}/${_sysroot}/libexec
-}

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (6 preceding siblings ...)
  2019-05-09 17:02 ` voidlinux-github
@ 2019-05-09 17:26 ` voidlinux-github
  2019-05-09 17:29 ` voidlinux-github
  2019-05-09 18:32 ` voidlinux-github
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 17:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490993575
Comment:
@jnbr good point.
@sirikid You should also append `nocross=yes` to cross-arm-none-eabi/template because we cannot cross compile cross compilers.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (7 preceding siblings ...)
  2019-05-09 17:26 ` voidlinux-github
@ 2019-05-09 17:29 ` voidlinux-github
  2019-05-09 18:32 ` voidlinux-github
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 17:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-490993575
Comment:
@jnbr good point.
@sirikid You should also append `nocross=yes` to cross-arm-none-eabi/template because we cannot cross compile cross compilers. And also to cross-arm-none-eabi-gcc. It seems that cross-arm-none-eabi-binutils can be cross built.. but I think it's best to make all nocross=yes in the first place.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [WIP] [RFC] cross-arm-none-eabi rework
  2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
                   ` (8 preceding siblings ...)
  2019-05-09 17:29 ` voidlinux-github
@ 2019-05-09 18:32 ` voidlinux-github
  9 siblings, 0 replies; 11+ messages in thread
From: voidlinux-github @ 2019-05-09 18:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2598 bytes --]

New comment by sirikid on void-packages repository

https://github.com/void-linux/void-packages/pull/11571#issuecomment-491016801
Comment:
Both gcc and binutils should support cross-compiling, their configure scripts support the following flags:
```
~/w/gcc-8.3.0 $ ./configure --help | grep -e HOST -e BUILD -e TARGET
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]
...
```
![image](https://user-images.githubusercontent.com/4840430/57476747-e773c000-729f-11e9-83ab-e325e74f08c5.png)

I also want to draw attention to the fact that I build gcc with different options. I did it because I didn't know how to port the existing patch to the new version of gcc.
Existing gcc:
```
~ $ arm-none-eabi-gcc --print-multi-lib
.;
thumb;@mthumb
fpu;@mfloat-abi=hard
armv6-m;@mthumb@march=armv6s-m
armv7-m;@mthumb@march=armv7-m
armv7e-m;@mthumb@march=armv7e-m
armv7-ar/thumb;@mthumb@march=armv7
armv7e-m/softfp;@mthumb@march=armv7e-m@mfloat-abi=softfp@mfpu=fpv4-sp-d16
armv7e-m/fpu;@mthumb@march=armv7e-m@mfloat-abi=hard@mfpu=fpv4-sp-d16
armv7-ar/thumb/softfp;@mthumb@march=armv7@mfloat-abi=softfp@mfpu=vfpv3-d16
armv7-ar/thumb/fpu;@mthumb@march=armv7@mfloat-abi=hard@mfpu=vfpv3-d16
```
My:
```
~ $ arm-none-eabi-gcc --print-multi-lib
.;
arm/v5te/softfp;@marm@march=armv5te+fp@mfloat-abi=softfp
arm/v5te/hard;@marm@march=armv5te+fp@mfloat-abi=hard
thumb/nofp;@mthumb@mfloat-abi=soft
thumb/v7/nofp;@mthumb@march=armv7@mfloat-abi=soft
thumb/v7+fp/softfp;@mthumb@march=armv7+fp@mfloat-abi=softfp
thumb/v7+fp/hard;@mthumb@march=armv7+fp@mfloat-abi=hard
thumb/v6-m/nofp;@mthumb@march=armv6s-m@mfloat-abi=soft
thumb/v7-m/nofp;@mthumb@march=armv7-m@mfloat-abi=soft
thumb/v7e-m/nofp;@mthumb@march=armv7e-m@mfloat-abi=soft
thumb/v7e-m+fp/softfp;@mthumb@march=armv7e-m+fp@mfloat-abi=softfp
thumb/v7e-m+fp/hard;@mthumb@march=armv7e-m+fp@mfloat-abi=hard
thumb/v7e-m+dp/softfp;@mthumb@march=armv7e-m+fp.dp@mfloat-abi=softfp
thumb/v7e-m+dp/hard;@mthumb@march=armv7e-m+fp.dp@mfloat-abi=hard
thumb/v8-m.base/nofp;@mthumb@march=armv8-m.base@mfloat-abi=soft
thumb/v8-m.main/nofp;@mthumb@march=armv8-m.main@mfloat-abi=soft
thumb/v8-m.main+fp/softfp;@mthumb@march=armv8-m.main+fp@mfloat-abi=softfp
thumb/v8-m.main+fp/hard;@mthumb@march=armv8-m.main+fp@mfloat-abi=hard
thumb/v8-m.main+dp/softfp;@mthumb@march=armv8-m.main+fp.dp@mfloat-abi=softfp
thumb/v8-m.main+dp/hard;@mthumb@march=armv8-m.main+fp.dp@mfloat-abi=hard
```

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-05-09 18:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 21:51 [PR PATCH] [WIP] [RFC] cross-arm-none-eabi rework voidlinux-github
2019-05-09 15:00 ` voidlinux-github
2019-05-09 15:57 ` voidlinux-github
2019-05-09 16:09 ` voidlinux-github
2019-05-09 16:12 ` voidlinux-github
2019-05-09 16:44 ` voidlinux-github
2019-05-09 17:02 ` [PR PATCH] [Updated] " voidlinux-github
2019-05-09 17:02 ` voidlinux-github
2019-05-09 17:26 ` voidlinux-github
2019-05-09 17:29 ` voidlinux-github
2019-05-09 18:32 ` voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).