mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-09-21 05:31:25 +02:00
The default the RISC-V ISA version used by GNU binutils >= 2.38 is 20191213 while gcc-cross-embedded still uses the older 2.2 version of the RISC-V ISA. These two upstream patches ensure that gcc-cross-embedded will always explicitly pass the utilized ISA version to the assembler. Fixes #13657
197 lines
5.6 KiB
Plaintext
197 lines
5.6 KiB
Plaintext
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
|
|
# Based upon Alpine's avr-gcc and Arch Linux's arm-none-eabi-gcc, to which
|
|
# the following people contributed:
|
|
# Contributor: Pedro Filipe <xpecex@outlook.com>
|
|
# Contributor: Stefan Wagner <stw@bit-strickerei.de>
|
|
# Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
|
|
# Contributor: Martin Schmölzer <mschmoelzer@gmail.com>
|
|
|
|
# mips-mti-elf fails to build newlib right now
|
|
_targets="
|
|
aarch64-none-elf
|
|
arm-none-eabi
|
|
mips-mti-elf
|
|
msp430-elf
|
|
riscv-none-elf
|
|
"
|
|
# or1k-elf fails to build on 32-bit architectures
|
|
case "$CARCH" in
|
|
x86_64|aarch64|ppc64le) _targets="$_targets or1k-elf"
|
|
esac
|
|
pkgname=gcc-cross-embedded
|
|
pkgver=11.2.0
|
|
pkgrel=2
|
|
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 !riscv64" # fails on s390x 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"
|
|
done
|
|
|
|
source="https://mirrors.kernel.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
|
|
0001-RISC-V-Fixing-misa-spec-PR-target-104853.patch
|
|
0002-RISC-V-Always-pass-misa-spec-to-assembler-PR104219.patch"
|
|
|
|
options="!check"
|
|
|
|
builddir="$srcdir/gcc-$pkgver"
|
|
|
|
prepare() {
|
|
default_prepare
|
|
|
|
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
|
|
for dir in libiberty gcc; do
|
|
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" $dir/configure
|
|
done
|
|
}
|
|
|
|
_build_gcc() {
|
|
case "$target" in
|
|
# Support M and R architecture profiles for ARM
|
|
arm-none-eabi) _target_specific_flags="--with-multilib-list=rmprofile" ;;
|
|
*) _target_specific_flags="" ;;
|
|
esac
|
|
|
|
msg "Running ./configure for $target"
|
|
"$builddir"/configure \
|
|
--target=$target \
|
|
--prefix=/usr \
|
|
--with-sysroot=/usr/$target \
|
|
--with-native-system-header-dir=/include \
|
|
--with-headers=/usr/$target/include \
|
|
--with-python-dir=share/gcc-$target \
|
|
--libexecdir=/usr/lib \
|
|
--infodir=/deleteme/info \
|
|
--htmldir=/deleteme/html \
|
|
--pdfdir=/deleteme/pdf \
|
|
--mandir=/deleteme/man \
|
|
--enable-languages=c,c++ \
|
|
--enable-lto \
|
|
--enable-plugins \
|
|
--enable-gnu-indirect-function \
|
|
--disable-decimal-float \
|
|
--disable-libffi \
|
|
--disable-libgomp \
|
|
--disable-libmudflap \
|
|
--disable-libquadmath \
|
|
--disable-libssp \
|
|
--disable-libstdcxx-pch \
|
|
--disable-nls \
|
|
--disable-shared \
|
|
--disable-threads \
|
|
--disable-werror \
|
|
--with-gmp \
|
|
--with-gnu-as \
|
|
--with-gnu-ld \
|
|
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
|
|
--with-isl \
|
|
--with-libelf \
|
|
--with-mpc \
|
|
--with-mpfr \
|
|
--with-newlib \
|
|
--with-system-zlib \
|
|
--with-pkgversion='Alpine Linux' \
|
|
$_target_specific_flags
|
|
|
|
msg "Running make for $target"
|
|
make INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
|
|
}
|
|
|
|
build() {
|
|
for target in $_targets; do
|
|
# Build "regular" variant
|
|
workingdir="$srcdir/build-$target"
|
|
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'
|
|
_build_gcc
|
|
done
|
|
}
|
|
|
|
package() {
|
|
for target in $_targets; do
|
|
depends="$depends gcc-$target"
|
|
done
|
|
mkdir -p "$pkgdir"
|
|
}
|
|
|
|
_install_subpkg() {
|
|
target="${subpkgname#gcc-}"
|
|
pkgdesc="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
|
|
rm -f "$subpkgdir"/usr/lib/libcc1.so*
|
|
|
|
# Strip libs using target binutils
|
|
find "$subpkgdir"/usr/lib -type f -name "*.a" -exec /usr/bin/$target-strip --strip-debug '{}' \;
|
|
|
|
# Strip executables using host binutils
|
|
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="
|
|
d53a0a966230895c54f01aea38696f818817b505f1e2bfa65e508753fcd01b2aedb4a61434f41f3a2ddbbd9f41384b96153c684ded3f0fa97c82758d9de5c7cf gcc-11.2.0.tar.xz
|
|
834c3a0e6163e91d485eceb7c3438a25e43d8be888ed3d6b96f50e5386926ba1443c5fe5f0b731ecd6dad809359952bd543cd22124deccc476ae6f6945b8f2bc 0001-RISC-V-Fixing-misa-spec-PR-target-104853.patch
|
|
0dcf680dec1989685073c7123278c0bb335d1caae75e4a226a490f26f5a0502c511e60f5a2a269f565a172fb8f5b5d96a13f5bf507d9c354c37f7e332d7bd3ed 0002-RISC-V-Always-pass-misa-spec-to-assembler-PR104219.patch
|
|
"
|