From cc0c7dba6853e22d129bbd836b509b1d290efed9 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 27 Dec 2019 23:42:08 +0100 Subject: [PATCH] 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 0000000000..d1e1936a54 --- /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 " +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 +}