Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
@ 2019-12-27 22:56 voidlinux-github
  2019-12-28  1:19 ` [PR PATCH] [Updated] " voidlinux-github
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-27 22:56 UTC (permalink / raw)
  To: ml

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

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

https://github.com/q66/void-packages arm-none-eabi
https://github.com/void-linux/void-packages/pull/17827

cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
For `cross-arm-none-eabi-gcc`:

I've reworked this to make it possible to include `libgcc.a`, rather than just the compiler itself. However, as `libstdc++` requires `newlib` to be built and present (which requires the gcc to build), skip building `libstdc++` at this stage. Instead, move it into a separate package.

I figured out the necessary changes mostly by reading the Arch pkgbuild.

For `cross-arm-none-eabi-libstdc++`:

As the gcc cannot include libstdc++ because of its newlib requirement, build it as a separate package. This is achieved by taking the gcc source tree, installing our previously built gcc as well as newlib (which was already packaged) and building libstdc++ on its own. I've successfully compiled things with this.

Currently doing one more rebuild and test of everything.

@sirikid 

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

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

From 3431827866c57d1118f91c4a5ca699a27ab5227d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:40:18 +0100
Subject: [PATCH 1/3] cross-arm-none-eabi-gcc: update to 9.2.0 + build libgcc

This does other reworking, such as building in a separate directory
like is recommended by the project.

By importing some changes from Arch, I managed to fix building of
libgcc, which further enables building the rest of the toolchain.

However, building libstdc++ is skipped, as that requires newlib
to build, which itself is not available at this point. Newlib on
the other hand requires a built toolchain to compile. We solve
this by building gcc (complete but without libstdc++) first,
followed by building newlib, followed by building just libstdc++
on its own.
---
 srcpkgs/cross-arm-none-eabi-gcc/template | 117 +++++++++++++----------
 1 file changed, 67 insertions(+), 50 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
index 0e636b75773..e32e89f0c81 100644
--- a/srcpkgs/cross-arm-none-eabi-gcc/template
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -1,55 +1,13 @@
-# Template file for 'cross-${_triplet}-${_pkgname}'
+# Template file for 'cross-${_triplet}-gcc'
 _triplet=arm-none-eabi
 _pkgname=gcc
-pkgname=cross-${_triplet}-${_pkgname}
-version=9.1.0
+pkgname=cross-${_triplet}-gcc
+version=9.2.0
 revision=1
-wrksrc="${_pkgname}-${version}"
+wrksrc="gcc-${version}"
+build_wrksrc=build
 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-threads
- --disable-tls
- --disable-werror
- --enable-__cxa_atexit
- --enable-c99
- --enable-gnu-indirect-function
- --enable-interwork
- --enable-languages=c,c++
- --enable-long-long
- --enable-multilib
- --enable-plugins
- --host=${XBPS_CROSS_TRIPLET}
- --libdir=/usr/lib
- --libexecdir=/usr/lib
- --prefix=/usr
- --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}-${_triplet}
- --with-sysroot=/usr/${_triplet}
- --with-system-zlib
-"
-make_build_target="all-gcc"
-make_install_target="install-gcc"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
 hostmakedepends="autoconf automake cross-arm-none-eabi-binutils bison flex perl"
 makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
 depends="cross-arm-none-eabi-binutils"
@@ -57,11 +15,70 @@ 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=79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
 alternatives="arm-none-eabi:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
 nocross=yes
 nopie=yes
+nostrip_files="libgcc.a libgcov.a"
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+}
+
+do_configure() {
+	../configure \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-libstdc__-v3 \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--enable-__cxa_atexit \
+		--enable-c99 \
+		--enable-gnu-indirect-function \
+		--enable-interwork \
+		--enable-languages=c,c++ \
+		--enable-long-long \
+		--enable-multilib \
+		--enable-plugins \
+		--host=${XBPS_CROSS_TRIPLET} \
+		--libdir=/usr/lib \
+		--libexecdir=/usr/lib \
+		--prefix=/usr \
+		--target=${_triplet} \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-headers=/usr/${_triplet}/include \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-multilib-list=rmprofile \
+		--with-native-system-header-dir=/include \
+		--with-newlib \
+		--with-python-dir=share/gcc-${_triplet} \
+		--with-sysroot=/usr/${_triplet} \
+		--with-system-zlib
+}
+
+pre_build() {
+	pre_configure
+}
 
 post_install() {
 	rm -fr ${DESTDIR}/usr/share/{info,man/man7}

From 666361c662ebaf158c3ab52765ecd9480facf818 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:42:08 +0100
Subject: [PATCH 2/3] New package: cross-arm-none-eabi-libstdc++

This completes the basic bare metal C/C++ toolchain by adding
libstdc++. As this requires newlib to build, we need to make it
into a separate package in order to avoid a dependency cycle.
---
 .../cross-arm-none-eabi-libstdc++/template    | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-libstdc++/template

diff --git a/srcpkgs/cross-arm-none-eabi-libstdc++/template b/srcpkgs/cross-arm-none-eabi-libstdc++/template
new file mode 100644
index 00000000000..c9d8318ff16
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-libstdc++/template
@@ -0,0 +1,49 @@
+# Template file for 'cross-${_triplet}-libstdc++'
+_triplet=arm-none-eabi
+pkgname=cross-${_triplet}-libstdc++
+version=9.2.0
+revision=1
+wrksrc="gcc-${version}"
+build_wrksrc=build
+# gnu-configure implicitly passes stuff we don't want
+build_style=configure
+configure_args="
+ --disable-libstdcxx-pch --disable-libstdcxx-threads
+ --disable-nls --disable-shared --disable-tls --disable-werror
+ --enable-multilib --host=${_triplet} --target=${_triplet}
+ --libdir=/usr/${_triplet}/lib --prefix=/usr/${_triplet}
+ --with-gnu-ld --with-gxx-include-dir=/usr/${_triplet}/include/${version}
+ --with-newlib --with-python-dir=share/gcc-${_triplet}"
+configure_script="../libstdc++-v3/configure"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
+hostmakedepends="autoconf automake cross-arm-none-eabi-binutils
+ cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib bison flex perl"
+makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
+depends="cross-arm-none-eabi-gcc"
+short_desc="GNU Compiler Collection - Standard C++ Library"
+maintainer="q66 <daniel@octaforge.org>"
+license="GPL-3.0-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
+nocross=yes
+nopie=yes
+nostrip=yes
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CC=arm-none-eabi-gcc
+	export CXX=arm-none-eabi-g++
+	export CPP=arm-none-eabi-cpp
+	export AR=arm-none-eabi-ar
+	export AS=arm-none-eabi-as
+}
+
+pre_build() {
+	pre_configure
+}

From c0bc8ad05c8f82f41eae77001420ff38e00a3418 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:43:03 +0100
Subject: [PATCH 3/3] cross-arm-none-eabi: add libstdc++ dependency

[ci skip]
---
 srcpkgs/cross-arm-none-eabi/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index 4cae46f9b08..8a6b7573ebe 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,10 +1,11 @@
 # Template file for 'cross-arm-none-eabi'
 _triplet=arm-none-eabi
 pkgname=cross-arm-none-eabi
-version=0.4
+version=0.5
 revision=1
 build_style=meta
-depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc
+ cross-arm-none-eabi-libstdc++ cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
 license="metapackage"

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

* Re: [PR PATCH] [Updated] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
@ 2019-12-28  1:19 ` voidlinux-github
  2019-12-28  1:22 ` voidlinux-github
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28  1:19 UTC (permalink / raw)
  To: ml

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

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

https://github.com/q66/void-packages arm-none-eabi
https://github.com/void-linux/void-packages/pull/17827

cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
For `cross-arm-none-eabi-gcc`:

I've reworked this to make it possible to include `libgcc.a`, rather than just the compiler itself. However, as `libstdc++` requires `newlib` to be built and present (which requires the gcc to build), skip building `libstdc++` at this stage. Instead, move it into a separate package.

I figured out the necessary changes mostly by reading the Arch pkgbuild.

For `cross-arm-none-eabi-libstdc++`:

As the gcc cannot include libstdc++ because of its newlib requirement, build it as a separate package. This is achieved by taking the gcc source tree, installing our previously built gcc as well as newlib (which was already packaged) and building libstdc++ on its own. I've successfully compiled things with this.

Currently doing one more rebuild and test of everything.

@sirikid 

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

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

From 3431827866c57d1118f91c4a5ca699a27ab5227d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:40:18 +0100
Subject: [PATCH 1/4] cross-arm-none-eabi-gcc: update to 9.2.0 + build libgcc

This does other reworking, such as building in a separate directory
like is recommended by the project.

By importing some changes from Arch, I managed to fix building of
libgcc, which further enables building the rest of the toolchain.

However, building libstdc++ is skipped, as that requires newlib
to build, which itself is not available at this point. Newlib on
the other hand requires a built toolchain to compile. We solve
this by building gcc (complete but without libstdc++) first,
followed by building newlib, followed by building just libstdc++
on its own.
---
 srcpkgs/cross-arm-none-eabi-gcc/template | 117 +++++++++++++----------
 1 file changed, 67 insertions(+), 50 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
index 0e636b75773..e32e89f0c81 100644
--- a/srcpkgs/cross-arm-none-eabi-gcc/template
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -1,55 +1,13 @@
-# Template file for 'cross-${_triplet}-${_pkgname}'
+# Template file for 'cross-${_triplet}-gcc'
 _triplet=arm-none-eabi
 _pkgname=gcc
-pkgname=cross-${_triplet}-${_pkgname}
-version=9.1.0
+pkgname=cross-${_triplet}-gcc
+version=9.2.0
 revision=1
-wrksrc="${_pkgname}-${version}"
+wrksrc="gcc-${version}"
+build_wrksrc=build
 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-threads
- --disable-tls
- --disable-werror
- --enable-__cxa_atexit
- --enable-c99
- --enable-gnu-indirect-function
- --enable-interwork
- --enable-languages=c,c++
- --enable-long-long
- --enable-multilib
- --enable-plugins
- --host=${XBPS_CROSS_TRIPLET}
- --libdir=/usr/lib
- --libexecdir=/usr/lib
- --prefix=/usr
- --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}-${_triplet}
- --with-sysroot=/usr/${_triplet}
- --with-system-zlib
-"
-make_build_target="all-gcc"
-make_install_target="install-gcc"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
 hostmakedepends="autoconf automake cross-arm-none-eabi-binutils bison flex perl"
 makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
 depends="cross-arm-none-eabi-binutils"
@@ -57,11 +15,70 @@ 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=79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
 alternatives="arm-none-eabi:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
 nocross=yes
 nopie=yes
+nostrip_files="libgcc.a libgcov.a"
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+}
+
+do_configure() {
+	../configure \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-libstdc__-v3 \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--enable-__cxa_atexit \
+		--enable-c99 \
+		--enable-gnu-indirect-function \
+		--enable-interwork \
+		--enable-languages=c,c++ \
+		--enable-long-long \
+		--enable-multilib \
+		--enable-plugins \
+		--host=${XBPS_CROSS_TRIPLET} \
+		--libdir=/usr/lib \
+		--libexecdir=/usr/lib \
+		--prefix=/usr \
+		--target=${_triplet} \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-headers=/usr/${_triplet}/include \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-multilib-list=rmprofile \
+		--with-native-system-header-dir=/include \
+		--with-newlib \
+		--with-python-dir=share/gcc-${_triplet} \
+		--with-sysroot=/usr/${_triplet} \
+		--with-system-zlib
+}
+
+pre_build() {
+	pre_configure
+}
 
 post_install() {
 	rm -fr ${DESTDIR}/usr/share/{info,man/man7}

From a6e9d0672cf11cfab0df0d81f0d23b8a7e736736 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 28 Dec 2019 02:18:41 +0100
Subject: [PATCH 2/4] cross-arm-none-eabi-newlib: rebuild with gcc 9.2

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/cross-arm-none-eabi-newlib/template b/srcpkgs/cross-arm-none-eabi-newlib/template
index 076c52c93f3..c00e167a0c7 100644
--- a/srcpkgs/cross-arm-none-eabi-newlib/template
+++ b/srcpkgs/cross-arm-none-eabi-newlib/template
@@ -3,7 +3,7 @@ _triplet=arm-none-eabi
 _pkgname=newlib
 pkgname=cross-${_triplet}-${_pkgname}
 version=3.1.0.20181231
-revision=1
+revision=2
 wrksrc="${_pkgname}-${version}"
 build_style=gnu-configure
 configure_args="

From 79c371aada869456f34ac16358092ea473416b36 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:42:08 +0100
Subject: [PATCH 3/4] New package: cross-arm-none-eabi-libstdc++

This completes the basic bare metal C/C++ toolchain by adding
libstdc++. As this requires newlib to build, we need to make it
into a separate package in order to avoid a dependency cycle.
---
 .../cross-arm-none-eabi-libstdc++/template    | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-libstdc++/template

diff --git a/srcpkgs/cross-arm-none-eabi-libstdc++/template b/srcpkgs/cross-arm-none-eabi-libstdc++/template
new file mode 100644
index 00000000000..c9d8318ff16
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-libstdc++/template
@@ -0,0 +1,49 @@
+# Template file for 'cross-${_triplet}-libstdc++'
+_triplet=arm-none-eabi
+pkgname=cross-${_triplet}-libstdc++
+version=9.2.0
+revision=1
+wrksrc="gcc-${version}"
+build_wrksrc=build
+# gnu-configure implicitly passes stuff we don't want
+build_style=configure
+configure_args="
+ --disable-libstdcxx-pch --disable-libstdcxx-threads
+ --disable-nls --disable-shared --disable-tls --disable-werror
+ --enable-multilib --host=${_triplet} --target=${_triplet}
+ --libdir=/usr/${_triplet}/lib --prefix=/usr/${_triplet}
+ --with-gnu-ld --with-gxx-include-dir=/usr/${_triplet}/include/${version}
+ --with-newlib --with-python-dir=share/gcc-${_triplet}"
+configure_script="../libstdc++-v3/configure"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
+hostmakedepends="autoconf automake cross-arm-none-eabi-binutils
+ cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib bison flex perl"
+makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
+depends="cross-arm-none-eabi-gcc"
+short_desc="GNU Compiler Collection - Standard C++ Library"
+maintainer="q66 <daniel@octaforge.org>"
+license="GPL-3.0-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
+nocross=yes
+nopie=yes
+nostrip=yes
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CC=arm-none-eabi-gcc
+	export CXX=arm-none-eabi-g++
+	export CPP=arm-none-eabi-cpp
+	export AR=arm-none-eabi-ar
+	export AS=arm-none-eabi-as
+}
+
+pre_build() {
+	pre_configure
+}

From 2b7f857a51defe2a72334ea8b2fb30a8905cf11a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:43:03 +0100
Subject: [PATCH 4/4] cross-arm-none-eabi: add libstdc++ dependency

[ci skip]
---
 srcpkgs/cross-arm-none-eabi/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index 4cae46f9b08..8a6b7573ebe 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,10 +1,11 @@
 # Template file for 'cross-arm-none-eabi'
 _triplet=arm-none-eabi
 pkgname=cross-arm-none-eabi
-version=0.4
+version=0.5
 revision=1
 build_style=meta
-depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc
+ cross-arm-none-eabi-libstdc++ cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
 license="metapackage"

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
  2019-12-28  1:19 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-12-28  1:22 ` voidlinux-github
  2019-12-28 15:24 ` [PR PATCH] [Updated] [wip] " voidlinux-github
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28  1:22 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569372901

Comment:
ok, TODO: update newlib package to include libc_nano, update libstdc++ to also include nano

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

* Re: [PR PATCH] [Updated] [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
  2019-12-28  1:19 ` [PR PATCH] [Updated] " voidlinux-github
  2019-12-28  1:22 ` voidlinux-github
@ 2019-12-28 15:24 ` voidlinux-github
  2019-12-28 16:28 ` [PR PATCH] [Updated] [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano voidlinux-github
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 15:24 UTC (permalink / raw)
  To: ml

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

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

https://github.com/q66/void-packages arm-none-eabi
https://github.com/void-linux/void-packages/pull/17827

[wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++
For `cross-arm-none-eabi-gcc`:

I've reworked this to make it possible to include `libgcc.a`, rather than just the compiler itself. However, as `libstdc++` requires `newlib` to be built and present (which requires the gcc to build), skip building `libstdc++` at this stage. Instead, move it into a separate package.

I figured out the necessary changes mostly by reading the Arch pkgbuild.

For `cross-arm-none-eabi-libstdc++`:

As the gcc cannot include libstdc++ because of its newlib requirement, build it as a separate package. This is achieved by taking the gcc source tree, installing our previously built gcc as well as newlib (which was already packaged) and building libstdc++ on its own. I've successfully compiled things with this.

Currently doing one more rebuild and test of everything.

@sirikid 

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

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

From 9cd50cb0f9dac27c8c03e3eb85e6470d8fd28ed5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:40:18 +0100
Subject: [PATCH 1/4] cross-arm-none-eabi-gcc: update to 9.2.0 + build libgcc

This does other reworking, such as building in a separate directory
like is recommended by the project.

By importing some changes from Arch, I managed to fix building of
libgcc, which further enables building the rest of the toolchain.

However, building libstdc++ is skipped, as that requires newlib
to build, which itself is not available at this point. Newlib on
the other hand requires a built toolchain to compile. We solve
this by building gcc (complete but without libstdc++) first,
followed by building newlib, followed by building just libstdc++
on its own.
---
 srcpkgs/cross-arm-none-eabi-gcc/template | 118 +++++++++++++----------
 1 file changed, 68 insertions(+), 50 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
index 0e636b75773..f082fdcb39c 100644
--- a/srcpkgs/cross-arm-none-eabi-gcc/template
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -1,55 +1,13 @@
-# Template file for 'cross-${_triplet}-${_pkgname}'
+# Template file for 'cross-${_triplet}-gcc'
 _triplet=arm-none-eabi
 _pkgname=gcc
-pkgname=cross-${_triplet}-${_pkgname}
-version=9.1.0
+pkgname=cross-${_triplet}-gcc
+version=9.2.0
 revision=1
-wrksrc="${_pkgname}-${version}"
+wrksrc="gcc-${version}"
+build_wrksrc=build
 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-threads
- --disable-tls
- --disable-werror
- --enable-__cxa_atexit
- --enable-c99
- --enable-gnu-indirect-function
- --enable-interwork
- --enable-languages=c,c++
- --enable-long-long
- --enable-multilib
- --enable-plugins
- --host=${XBPS_CROSS_TRIPLET}
- --libdir=/usr/lib
- --libexecdir=/usr/lib
- --prefix=/usr
- --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}-${_triplet}
- --with-sysroot=/usr/${_triplet}
- --with-system-zlib
-"
-make_build_target="all-gcc"
-make_install_target="install-gcc"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
 hostmakedepends="autoconf automake cross-arm-none-eabi-binutils bison flex perl"
 makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
 depends="cross-arm-none-eabi-binutils"
@@ -57,12 +15,72 @@ 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=79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
 alternatives="arm-none-eabi:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
 nocross=yes
 nopie=yes
+nostrip_files="libgcc.a libgcov.a"
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+}
+
+do_configure() {
+	../configure \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-libstdc__-v3 \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--enable-__cxa_atexit \
+		--enable-c99 \
+		--enable-gnu-indirect-function \
+		--enable-interwork \
+		--enable-languages=c,c++ \
+		--enable-long-long \
+		--enable-multilib \
+		--enable-plugins \
+		--host=${XBPS_CROSS_TRIPLET} \
+		--libdir=/usr/lib \
+		--libexecdir=/usr/lib \
+		--prefix=/usr \
+		--target=${_triplet} \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-headers=/usr/${_triplet}/include \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-multilib-list=rmprofile \
+		--with-native-system-header-dir=/include \
+		--with-newlib \
+		--with-python-dir=share/gcc-${_triplet} \
+		--with-sysroot=/usr/${_triplet} \
+		--with-system-zlib
+}
+
+pre_build() {
+	pre_configure
+}
 
 post_install() {
 	rm -fr ${DESTDIR}/usr/share/{info,man/man7}
+	rm -fr ${DESTDIR}/usr/lib/libcc1.*
 }

From 8a88885c54062f303d5c29c7aadf27d8851923d5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 28 Dec 2019 02:18:41 +0100
Subject: [PATCH 2/4] cross-arm-none-eabi-newlib: build a nano variant

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 73 +++++++++++++++++----
 1 file changed, 61 insertions(+), 12 deletions(-)

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

From d9ec45b0f1a218bdeb32d4b33ec8cddda3ceb723 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:42:08 +0100
Subject: [PATCH 3/4] New package: cross-arm-none-eabi-libstdc++

This completes the basic bare metal C/C++ toolchain by adding
libstdc++. As this requires newlib to build, we need to make it
into a separate package in order to avoid a dependency cycle.
---
 .../cross-arm-none-eabi-libstdc++/template    | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-libstdc++/template

diff --git a/srcpkgs/cross-arm-none-eabi-libstdc++/template b/srcpkgs/cross-arm-none-eabi-libstdc++/template
new file mode 100644
index 00000000000..c9d8318ff16
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-libstdc++/template
@@ -0,0 +1,49 @@
+# Template file for 'cross-${_triplet}-libstdc++'
+_triplet=arm-none-eabi
+pkgname=cross-${_triplet}-libstdc++
+version=9.2.0
+revision=1
+wrksrc="gcc-${version}"
+build_wrksrc=build
+# gnu-configure implicitly passes stuff we don't want
+build_style=configure
+configure_args="
+ --disable-libstdcxx-pch --disable-libstdcxx-threads
+ --disable-nls --disable-shared --disable-tls --disable-werror
+ --enable-multilib --host=${_triplet} --target=${_triplet}
+ --libdir=/usr/${_triplet}/lib --prefix=/usr/${_triplet}
+ --with-gnu-ld --with-gxx-include-dir=/usr/${_triplet}/include/${version}
+ --with-newlib --with-python-dir=share/gcc-${_triplet}"
+configure_script="../libstdc++-v3/configure"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
+hostmakedepends="autoconf automake cross-arm-none-eabi-binutils
+ cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib bison flex perl"
+makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
+depends="cross-arm-none-eabi-gcc"
+short_desc="GNU Compiler Collection - Standard C++ Library"
+maintainer="q66 <daniel@octaforge.org>"
+license="GPL-3.0-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
+nocross=yes
+nopie=yes
+nostrip=yes
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS="-g -Os -ffunction-sections -fdata-sections"
+	export CC=arm-none-eabi-gcc
+	export CXX=arm-none-eabi-g++
+	export CPP=arm-none-eabi-cpp
+	export AR=arm-none-eabi-ar
+	export AS=arm-none-eabi-as
+}
+
+pre_build() {
+	pre_configure
+}

From 5e9cd1c3b9533ac985e47673c1b34ab09d7f26c4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:43:03 +0100
Subject: [PATCH 4/4] cross-arm-none-eabi: add libstdc++ dependency

[ci skip]
---
 srcpkgs/cross-arm-none-eabi/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index 4cae46f9b08..8a6b7573ebe 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,10 +1,11 @@
 # Template file for 'cross-arm-none-eabi'
 _triplet=arm-none-eabi
 pkgname=cross-arm-none-eabi
-version=0.4
+version=0.5
 revision=1
 build_style=meta
-depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc
+ cross-arm-none-eabi-libstdc++ cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
 license="metapackage"

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

* Re: [PR PATCH] [Updated] [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (2 preceding siblings ...)
  2019-12-28 15:24 ` [PR PATCH] [Updated] [wip] " voidlinux-github
@ 2019-12-28 16:28 ` voidlinux-github
  2019-12-28 16:39 ` voidlinux-github
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 16:28 UTC (permalink / raw)
  To: ml

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

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

https://github.com/q66/void-packages arm-none-eabi
https://github.com/void-linux/void-packages/pull/17827

[wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
For `cross-arm-none-eabi-gcc`:

I've reworked this to make it possible to include `libgcc.a`, rather than just the compiler itself. However, as `libstdc++` requires `newlib` to be built and present (which requires the gcc to build), skip building `libstdc++` at this stage. Instead, move it into a separate package.

I figured out the necessary changes mostly by reading the Arch pkgbuild.

For `cross-arm-none-eabi-libstdc++`:

As the gcc cannot include libstdc++ because of its newlib requirement, build it as a separate package. This is achieved by taking the gcc source tree, installing our previously built gcc as well as newlib (which was already packaged) and building libstdc++ on its own. I've successfully compiled things with this.

For `cross-arm-none-eabi-newlib`:

We now build a nano variant.

@sirikid 

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

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

From 9cd50cb0f9dac27c8c03e3eb85e6470d8fd28ed5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:40:18 +0100
Subject: [PATCH 1/4] cross-arm-none-eabi-gcc: update to 9.2.0 + build libgcc

This does other reworking, such as building in a separate directory
like is recommended by the project.

By importing some changes from Arch, I managed to fix building of
libgcc, which further enables building the rest of the toolchain.

However, building libstdc++ is skipped, as that requires newlib
to build, which itself is not available at this point. Newlib on
the other hand requires a built toolchain to compile. We solve
this by building gcc (complete but without libstdc++) first,
followed by building newlib, followed by building just libstdc++
on its own.
---
 srcpkgs/cross-arm-none-eabi-gcc/template | 118 +++++++++++++----------
 1 file changed, 68 insertions(+), 50 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi-gcc/template b/srcpkgs/cross-arm-none-eabi-gcc/template
index 0e636b75773..f082fdcb39c 100644
--- a/srcpkgs/cross-arm-none-eabi-gcc/template
+++ b/srcpkgs/cross-arm-none-eabi-gcc/template
@@ -1,55 +1,13 @@
-# Template file for 'cross-${_triplet}-${_pkgname}'
+# Template file for 'cross-${_triplet}-gcc'
 _triplet=arm-none-eabi
 _pkgname=gcc
-pkgname=cross-${_triplet}-${_pkgname}
-version=9.1.0
+pkgname=cross-${_triplet}-gcc
+version=9.2.0
 revision=1
-wrksrc="${_pkgname}-${version}"
+wrksrc="gcc-${version}"
+build_wrksrc=build
 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-threads
- --disable-tls
- --disable-werror
- --enable-__cxa_atexit
- --enable-c99
- --enable-gnu-indirect-function
- --enable-interwork
- --enable-languages=c,c++
- --enable-long-long
- --enable-multilib
- --enable-plugins
- --host=${XBPS_CROSS_TRIPLET}
- --libdir=/usr/lib
- --libexecdir=/usr/lib
- --prefix=/usr
- --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}-${_triplet}
- --with-sysroot=/usr/${_triplet}
- --with-system-zlib
-"
-make_build_target="all-gcc"
-make_install_target="install-gcc"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
 hostmakedepends="autoconf automake cross-arm-none-eabi-binutils bison flex perl"
 makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
 depends="cross-arm-none-eabi-binutils"
@@ -57,12 +15,72 @@ 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=79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
 alternatives="arm-none-eabi:/usr/bin/arm-none-eabi-cc:/usr/bin/arm-none-eabi-gcc"
 nocross=yes
 nopie=yes
+nostrip_files="libgcc.a libgcov.a"
+
+post_extract() {
+	mkdir -p build
+}
+
+pre_configure() {
+	export CFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+	export CXXFLAGS_FOR_TARGET="-g -Os -ffunction-sections -fdata-sections"
+}
+
+do_configure() {
+	../configure \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-libstdc__-v3 \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--enable-__cxa_atexit \
+		--enable-c99 \
+		--enable-gnu-indirect-function \
+		--enable-interwork \
+		--enable-languages=c,c++ \
+		--enable-long-long \
+		--enable-multilib \
+		--enable-plugins \
+		--host=${XBPS_CROSS_TRIPLET} \
+		--libdir=/usr/lib \
+		--libexecdir=/usr/lib \
+		--prefix=/usr \
+		--target=${_triplet} \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-headers=/usr/${_triplet}/include \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-multilib-list=rmprofile \
+		--with-native-system-header-dir=/include \
+		--with-newlib \
+		--with-python-dir=share/gcc-${_triplet} \
+		--with-sysroot=/usr/${_triplet} \
+		--with-system-zlib
+}
+
+pre_build() {
+	pre_configure
+}
 
 post_install() {
 	rm -fr ${DESTDIR}/usr/share/{info,man/man7}
+	rm -fr ${DESTDIR}/usr/lib/libcc1.*
 }

From 8a88885c54062f303d5c29c7aadf27d8851923d5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 28 Dec 2019 02:18:41 +0100
Subject: [PATCH 2/4] cross-arm-none-eabi-newlib: build a nano variant

---
 srcpkgs/cross-arm-none-eabi-newlib/template | 73 +++++++++++++++++----
 1 file changed, 61 insertions(+), 12 deletions(-)

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

From 54d343b25d4cf19d88613a38c5a13080a8f8f6dc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:42:08 +0100
Subject: [PATCH 3/4] New package: cross-arm-none-eabi-libstdc++

This completes the basic bare metal C/C++ toolchain by adding
libstdc++. As this requires newlib to build, we need to make it
into a separate package in order to avoid a dependency cycle.

Two variants are added, a full one and a nano one (-Os, no
exceptions).
---
 .../cross-arm-none-eabi-libstdc++/template    | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 srcpkgs/cross-arm-none-eabi-libstdc++/template

diff --git a/srcpkgs/cross-arm-none-eabi-libstdc++/template b/srcpkgs/cross-arm-none-eabi-libstdc++/template
new file mode 100644
index 00000000000..d1e1936a545
--- /dev/null
+++ b/srcpkgs/cross-arm-none-eabi-libstdc++/template
@@ -0,0 +1,85 @@
+# Template file for 'cross-${_triplet}-libstdc++'
+_triplet=arm-none-eabi
+pkgname=cross-${_triplet}-libstdc++
+version=9.2.0
+revision=1
+wrksrc="gcc-${version}"
+# gnu-configure implicitly passes stuff we don't want
+build_style=configure
+configure_args="
+ --disable-libstdcxx-pch --disable-libstdcxx-threads
+ --disable-nls --disable-shared --disable-tls --disable-werror
+ --enable-multilib --host=${_triplet} --target=${_triplet}
+ --libdir=/usr/${_triplet}/lib --prefix=/usr/${_triplet}
+ --with-gnu-ld --with-gxx-include-dir=/usr/${_triplet}/include/${version}
+ --with-newlib --with-python-dir=share/gcc-${_triplet}"
+make_build_args="INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'"
+hostmakedepends="autoconf automake cross-arm-none-eabi-binutils
+ cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib bison flex perl"
+makedepends="gmp-devel isl15-devel libmpc-devel mpfr-devel zlib-devel"
+depends="cross-arm-none-eabi-gcc"
+short_desc="GNU Compiler Collection - Standard C++ Library"
+maintainer="q66 <daniel@octaforge.org>"
+license="GPL-3.0-or-later"
+homepage="https://gcc.gnu.org"
+distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
+checksum=ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
+nocross=yes
+nopie=yes
+nostrip=yes
+
+post_extract() {
+	mkdir -p build-{regular,nano}
+}
+
+do_configure() {
+	export CC=arm-none-eabi-gcc
+	export CXX=arm-none-eabi-g++
+	export CPP=arm-none-eabi-cpp
+	export AR=arm-none-eabi-ar
+	export AS=arm-none-eabi-as
+
+	pushd build-regular
+	export CFLAGS="-g -O2 -ffunction-sections -fdata-sections"
+	export CXXFLAGS="-g -O2 -ffunction-sections -fdata-sections"
+	../libstdc++-v3/configure ${configure_args}
+	popd
+
+	pushd build-nano
+	export CFLAGS="-g -Os -ffunction-sections -fdata-sections -fno-exceptions"
+	export CXXFLAGS="-g -Os -ffunction-sections -fdata-sections -fno-exceptions"
+	../libstdc++-v3/configure ${configure_args}
+	popd
+}
+
+do_build() {
+	unset CC CXX CPP AR AS CFLAGS CXXFLAGS
+
+	pushd build-regular
+	make ${makejobs} ${make_build_args}
+	popd
+
+	pushd build-nano
+	make ${makejobs} ${make_build_args}
+	popd
+}
+
+do_install() {
+	pushd build-regular
+	make DESTDIR=${DESTDIR} install
+	popd
+
+	pushd build-nano
+	mkdir -p dest-nano
+	make DESTDIR=$(pwd)/dest-nano install
+	# only install the static libs for nano, no headers
+	local multilibs=( $(${_triplet}-gcc -print-multi-lib 2>/dev/null) )
+	for multilib in "${multilibs[@]}"; do
+		local dir="${multilib%%;*}"
+		local from_dir=dest-nano/usr/${_triplet}/lib/${dir}
+		local to_dir=${DESTDIR}/usr/${_triplet}/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
+	popd
+}

From bb96b551b52e3eb8f6c6a21a57f4a31437a246b2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 27 Dec 2019 23:43:03 +0100
Subject: [PATCH 4/4] cross-arm-none-eabi: add libstdc++ dependency

[ci skip]
---
 srcpkgs/cross-arm-none-eabi/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/cross-arm-none-eabi/template b/srcpkgs/cross-arm-none-eabi/template
index 4cae46f9b08..8a6b7573ebe 100644
--- a/srcpkgs/cross-arm-none-eabi/template
+++ b/srcpkgs/cross-arm-none-eabi/template
@@ -1,10 +1,11 @@
 # Template file for 'cross-arm-none-eabi'
 _triplet=arm-none-eabi
 pkgname=cross-arm-none-eabi
-version=0.4
+version=0.5
 revision=1
 build_style=meta
-depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib"
+depends="cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc
+ cross-arm-none-eabi-libstdc++ cross-arm-none-eabi-newlib"
 short_desc="GNU cross bare metal toolchain"
 maintainer="Ivan Sokolov <ivan-p-sokolov@ya.ru>"
 license="metapackage"

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

* Re: [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (3 preceding siblings ...)
  2019-12-28 16:28 ` [PR PATCH] [Updated] [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano voidlinux-github
@ 2019-12-28 16:39 ` voidlinux-github
  2019-12-28 16:39 ` voidlinux-github
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 16:39 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569372901

Comment:
~~ok, TODO: update newlib package to include libc_nano, update libstdc++ to also include nano~~ done

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (4 preceding siblings ...)
  2019-12-28 16:39 ` voidlinux-github
@ 2019-12-28 16:39 ` voidlinux-github
  2019-12-28 20:51 ` voidlinux-github
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 16:39 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569431311

Comment:
requesting testing from @lemmi 

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (5 preceding siblings ...)
  2019-12-28 16:39 ` voidlinux-github
@ 2019-12-28 20:51 ` voidlinux-github
  2019-12-28 21:55 ` voidlinux-github
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 20:51 UTC (permalink / raw)
  To: ml

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

New comment by lemmi on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569450232

Comment:
@q66 my project running stm32f0 with nano libc works now, thx a lot! 

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (6 preceding siblings ...)
  2019-12-28 20:51 ` voidlinux-github
@ 2019-12-28 21:55 ` voidlinux-github
  2019-12-28 22:02 ` voidlinux-github
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 21:55 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569454134

Comment:
perfect, i'll leave this open for a while more in case there are any more concerns or comments, and after some waiting period, merge it or have someone else merge it.

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (7 preceding siblings ...)
  2019-12-28 21:55 ` voidlinux-github
@ 2019-12-28 22:02 ` voidlinux-github
  2019-12-28 23:49 ` voidlinux-github
  2020-01-04  1:21 ` [PR PATCH] [Merged]: " voidlinux-github
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 22:02 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569454526

Comment:
the only changes i can think of would be separating the target debug info in separate `-dbg` packages for `libstdc++` and `newlib`, however besides saving some space locally, the benefit of that is questionable and needs manual work in the template (as host `strip`/`objcopy` cannot be used) - so I probably won't bother for the time being. For the final target hardware executable, you can just strip the final thing, which will get rid of all the intermediate debug info with the same effect.

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

* Re: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (8 preceding siblings ...)
  2019-12-28 22:02 ` voidlinux-github
@ 2019-12-28 23:49 ` voidlinux-github
  2020-01-04  1:21 ` [PR PATCH] [Merged]: " voidlinux-github
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2019-12-28 23:49 UTC (permalink / raw)
  To: ml

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

New comment by sirikid on void-packages repository

https://github.com/void-linux/void-packages/pull/17827#issuecomment-569460212

Comment:
These are really good changes. I am very glad that someone took the time to figure out how to fix the toolchain. Thanks for you work.

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

* Re: [PR PATCH] [Merged]: cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
  2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
                   ` (9 preceding siblings ...)
  2019-12-28 23:49 ` voidlinux-github
@ 2020-01-04  1:21 ` voidlinux-github
  10 siblings, 0 replies; 12+ messages in thread
From: voidlinux-github @ 2020-01-04  1:21 UTC (permalink / raw)
  To: ml

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

There's a merged pull request on the void-packages repository

cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano
https://github.com/void-linux/void-packages/pull/17827

Description:
For `cross-arm-none-eabi-gcc`:

I've reworked this to make it possible to include `libgcc.a`, rather than just the compiler itself. However, as `libstdc++` requires `newlib` to be built and present (which requires the gcc to build), skip building `libstdc++` at this stage. Instead, move it into a separate package.

I figured out the necessary changes mostly by reading the Arch pkgbuild.

For `cross-arm-none-eabi-libstdc++`:

As the gcc cannot include libstdc++ because of its newlib requirement, build it as a separate package. This is achieved by taking the gcc source tree, installing our previously built gcc as well as newlib (which was already packaged) and building libstdc++ on its own. I've successfully compiled things with this.

Two versions are provided, regular and nano. The nano version is built with -Os and no exceptions. You'd presumably use it with nano newlib.

For `cross-arm-none-eabi-newlib`:

We now build a nano variant.

@sirikid 

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

end of thread, other threads:[~2020-01-04  1:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 22:56 [PR PATCH] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++ voidlinux-github
2019-12-28  1:19 ` [PR PATCH] [Updated] " voidlinux-github
2019-12-28  1:22 ` voidlinux-github
2019-12-28 15:24 ` [PR PATCH] [Updated] [wip] " voidlinux-github
2019-12-28 16:28 ` [PR PATCH] [Updated] [wip] cross-arm-none-eabi*: update to 9.2, rework to include libgcc.a and libstdc++, newlib: build nano voidlinux-github
2019-12-28 16:39 ` voidlinux-github
2019-12-28 16:39 ` voidlinux-github
2019-12-28 20:51 ` voidlinux-github
2019-12-28 21:55 ` voidlinux-github
2019-12-28 22:02 ` voidlinux-github
2019-12-28 23:49 ` voidlinux-github
2020-01-04  1:21 ` [PR PATCH] [Merged]: " 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).