void-packages/srcpkgs/cross-arm-none-eabi-libstdc++/template

85 lines
2.6 KiB
Bash

# Template file for 'cross-${_triplet}-libstdc++'
_triplet=arm-none-eabi
pkgname=cross-${_triplet}-libstdc++
version=9.3.0
revision=2
# 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/c++/${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="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-or-later"
homepage="https://gcc.gnu.org"
distfiles="${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz"
checksum=71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1
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
}