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).
This commit is contained in:
q66 2019-12-27 23:42:08 +01:00 committed by Daniel Kolesa
parent d8c12f40e2
commit cc0c7dba68

View file

@ -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
}