diff options
Diffstat (limited to 'community/gcc-cross-embedded/APKBUILD')
-rw-r--r-- | community/gcc-cross-embedded/APKBUILD | 138 |
1 files changed, 62 insertions, 76 deletions
diff --git a/community/gcc-cross-embedded/APKBUILD b/community/gcc-cross-embedded/APKBUILD index 989e072def4..2d4bdc20876 100644 --- a/community/gcc-cross-embedded/APKBUILD +++ b/community/gcc-cross-embedded/APKBUILD @@ -5,40 +5,66 @@ # Contributor: Stefan Wagner <stw@bit-strickerei.de> # Contributor: Anatol Pomozov <anatol.pomozov@gmail.com> # Contributor: Martin Schmölzer <mschmoelzer@gmail.com> +pkgname=gcc-cross-embedded +pkgver=13.2.0 +pkgrel=0 +pkgdesc="C compilers from the GNU Compiler Collection for embedded targets" +url="https://gcc.gnu.org/" +depends="gcc" +makedepends="bash linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev isl-dev python3" +arch="aarch64 armv7 ppc64le x86_64 x86" +license="GPL-3.0-or-later" +source="https://mirrors.kernel.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz + newlib-getentropy.patch" +options="!check" +builddir="$srcdir/gcc-$pkgver" -# mips-mti-elf fails to build newlib right now -_targets=" +# classify targets as exotic or mainstream. Only build support for +# exotic targets on typical developer / CI hardware (x86_86, aarach64). +_targets_mainstream=" arm-none-eabi - msp430-elf riscv-none-elf + " + +_targets_exotic=" + msp430-elf + or1k-elf aarch64-none-elf " -# or1k-elf fails to build on 32-bit architectures + +# This specifies the supported RISC-V multilib ISA extensions. +# For more information on the syntax, see the comment in gcc/config/riscv/multilib-generator. +# +# The selected ISA extensions are modeled after the Debian package. +# See: https://salsa.debian.org/debian/gcc-riscv64-unknown-elf/-/blob/4a1de76060cb8721c06bcfb4c846bc82ee6b3fc3/debian/patches/0002-Add-more-multi-lib-for-rv32-and-rv64.patch +_riscv_multilib="rv32e-ilp32e--c;rv32ea-ilp32e--m;\ +rv32em-ilp32e--c;rv32eac-ilp32e--;rv32emac-ilp32e--;\ +rv32i-ilp32--c;rv32ia-ilp32--m;rv32im-ilp32--c;\ +rv32if-ilp32f-rv32ifd-c;rv32iaf-ilp32f-rv32imaf,rv32iafc-d;\ +rv32imf-ilp32f-rv32imfd-c;rv32iac-ilp32--;rv32imac-ilp32--;\ +rv32imafc-ilp32f-rv32imafdc-;rv32ifd-ilp32d--c;rv32imfd-ilp32d--c;\ +rv32iafd-ilp32d-rv32imafd,rv32iafdc-;rv32imafdc-ilp32d--;rv64i-lp64--c;\ +rv64ia-lp64--m;rv64im-lp64--c;rv64if-lp64f-rv64ifd-c;\ +rv64iaf-lp64f-rv64imaf,rv64iafc-d;rv64imf-lp64f-rv64imfd-c;\ +rv64iac-lp64--;rv64imac-lp64--;rv64imafc-lp64f-rv64imafdc-;\ +rv64ifd-lp64d--m,c;rv64iafd-lp64d-rv64imafd,rv64iafdc-;rv64imafdc-lp64d--" + case "$CARCH" in - x86_64|aarch64|ppc64le|mips64) _targets="$_targets or1k-elf" +x86_64|aarch64) + # support all targets on typical workstation / notebook / CI servers + _targets="$_targets_mainstream $_targets_exotic" + ;; +*) + # support only mainstream targets on exotic hosts + _targets="$_targets_mainstream" + ;; esac -pkgname=gcc-cross-embedded -pkgver=10.3.0 -pkgrel=0 -pkgdesc="The GNU Compiler Collection for embedded targets" -url="https://gcc.gnu.org/" -depends="gcc" -makedepends="bash linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev isl-dev" -arch="all !s390x !mips !mips64 !riscv64" # fails on s390x and mips with error message: -# 'internal compiler error: Segmentation fault' -license="GPL-3.0-or-later" + for target in $_targets; do - targetnorm="${target//-/_}" - subpackages="gcc-$target:$targetnorm $subpackages" - makedepends="$makedepends binutils-$target newlib-$target-stage1" + subpackages="gcc-$target:_install_subpkg $subpackages" + makedepends="$makedepends binutils-$target" done -source="https://mirrors.kernel.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz" - -options="!check" - -builddir="$srcdir/gcc-$pkgver" - prepare() { default_prepare @@ -52,9 +78,15 @@ _build_gcc() { case "$target" in # Support M and R architecture profiles for ARM arm-none-eabi) _target_specific_flags="--with-multilib-list=rmprofile" ;; + riscv-none-elf) _target_specific_flags="--with-multilib-generator=$_riscv_multilib" ;; *) _target_specific_flags="" ;; esac + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + export CFLAGS="$CFLAGS -Wno-error=format-security" + export CXXFLAGS="$CXXFLAGS -Wno-error=format-security" + export CPPFLAGS="$CPPFLAGS -Wno-error=format-security" + msg "Running ./configure for $target" "$builddir"/configure \ --target=$target \ @@ -68,7 +100,8 @@ _build_gcc() { --htmldir=/deleteme/html \ --pdfdir=/deleteme/pdf \ --mandir=/deleteme/man \ - --enable-languages=c,c++ \ + --enable-languages=c \ + --enable-lto \ --enable-plugins \ --enable-gnu-indirect-function \ --disable-decimal-float \ @@ -81,7 +114,6 @@ _build_gcc() { --disable-nls \ --disable-shared \ --disable-threads \ - --disable-tls \ --disable-werror \ --with-gmp \ --with-gnu-as \ @@ -107,15 +139,7 @@ build() { mkdir "$workingdir" cd "$workingdir" export CFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections' - export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections' - _build_gcc - - # Rebuild without exceptions to generate nano variant of libstc++ - workingdir="$srcdir/build-$target-nano" - mkdir "$workingdir" - cd "$workingdir" - export CFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections -fno-exceptions' - export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections -fno-exceptions' + export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections -fno-use-cxa-atexit' _build_gcc done } @@ -129,27 +153,12 @@ package() { _install_subpkg() { target="${subpkgname#gcc-}" - pkgdesc="The GNU Compiler Collection for $target targets" + pkgdesc="C compiler of the GNU Compiler Collection for $target targets" depends="$depends binutils-$target" workingdir="$srcdir/build-$target" cd "$workingdir" make install DESTDIR="$subpkgdir" -j1 - # install nano-variant into temporary folder to obtain libstdc++ from there - workingdir="$srcdir/build-$target-nano" - cd "$workingdir" - make install DESTDIR="$subpkgdir-nano" -j1 - - # Fetch libstdc++ from nano variant - multilibs=$($subpkgdir/usr/bin/$target-gcc -print-multi-lib 2>/dev/null) - for multilib in $multilibs; do - dir="${multilib%%;*}" - from_dir=$subpkgdir-nano/usr/$target/lib/$dir - to_dir=$subpkgdir/usr/$target/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 - # Delete documentation. (The user can use the host GCC doc instead) rm -rf "$subpkgdir"/deleteme # Delete libcc1.so*, which is already part of the host's gcc @@ -162,30 +171,7 @@ _install_subpkg() { find "$subpkgdir"/usr/bin -type f -executable -exec strip '{}' \; } -arm_none_eabi() { - _install_subpkg -} - -mips_mti_elf() { - _install_subpkg -} - -msp430_elf() { - _install_subpkg -} - -or1k_elf() { - _install_subpkg -} - -riscv_none_elf() { - _install_subpkg -} - -aarch64_none_elf() { - _install_subpkg -} - sha512sums=" -2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86 gcc-10.3.0.tar.xz +d99e4826a70db04504467e349e9fbaedaa5870766cda7c5cab50cdebedc4be755ebca5b789e1232a34a20be1a0b60097de9280efe47bdb71c73251e30b0862a2 gcc-13.2.0.tar.xz +52e45ba12be74ce6f740eff3a79e3da87c80b06275fd00b2a1193b052fd0891e7c4c09fd6a9c204a82178c135318d69db3e250f12c37eca72edb1e3c0b0be2db newlib-getentropy.patch " |