1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-16 04:35:13 +03:00
aports/testing/gdb-esp/APKBUILD
2022-11-22 20:33:36 +01:00

142 lines
4 KiB
Text

# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
_pkgbase=gdb
_targets="
xtensa-esp8266-elf
xtensa-esp32-elf
xtensa-esp32s2-elf
xtensa-esp32s3-elf
"
pkgname="$_pkgbase-esp"
pkgver=12.1
_xtensa_overlay_ver=2021r2-patch4
pkgrel=1
pkgdesc="The GNU Debugger for embedded targets patched for ESP support"
# NOTE: gdb-multiarch replaces all the different cross-platform GDB versions
# and supports architectures ranging from 8 bit microcontrollers
# all the way up to super scalar multicore 64 bit server CPUs. The
# list of supported architectures is long and even includes Xtensa.
# However, the magic ESP MCUs are so illustrious and special, that
# they are not to be spoken to by the common tools of mere mortals. In
# fact, every ESP product list is so special that it needs its own magic
# GDB version sprinkled with its own special stardust-unicorn-Espressif
# patches to be barely worthy enough to interact with the blessed ESP
# MCUs.
#
# tl;dr: Please don't use this as a role model, gdb-multiarch should normally
# be all you need. This is only needed due to crappy upstreaming
# policy of a shitty company.
url="https://www.sourceware.org/gdb/"
# riscv64: ld: BFD (GNU Binutils) 2.39 assertion fail elfnn-riscv.c:4816 segfault
arch="all !riscv64"
license="GPL-2.0-only GPL-2.0-or-later GPL-3.0-only GPL-3.0-or-later LGPL-2.1-only"
depends="gdb"
makedepends="
autoconf
automake
expat-dev
gmp-dev
libtool
linux-headers
ncurses-dev
perl
python3-dev
readline-dev
texinfo
zlib-dev
"
source="
https://ftp.gnu.org/gnu/$_pkgbase/$_pkgbase-$pkgver.tar.xz
xtensa-overlay-$_xtensa_overlay_ver.tar.gz::https://github.com/espressif/xtensa-overlays/archive/refs/tags/esp-$_xtensa_overlay_ver.tar.gz
fix-invalid-implicit-conversion.patch
"
for target in $_targets; do
targetnorm="${target//-/_}"
subpackages="$_pkgbase-$target:$targetnorm $subpackages"
done
options="!check"
builddir="$srcdir"/$_pkgbase-$pkgver
case "$CARCH" in
riscv64)
options="$options textrels"
;;
esac
build() {
for target in $_targets; do
mkdir -p "$srcdir/build/$target"
cd "$srcdir/build/$target"
# copy ESP specific xtensa settings from overlay
dir="${target%%-elf}"
dir="${dir//-/_}"
dir="$srcdir/xtensa-overlays-esp-$_xtensa_overlay_ver/$dir/gdb"
cp -r "$dir"/* "$builddir"/
# add some glue for compatibility with recent GDB
echo "xtensa_gdbarch_tdep xtensa_tdep (rmap);" \
>> "$builddir"/gdb/xtensa-config.c
"$builddir/configure" \
--target=$target \
--prefix=/usr \
--mandir=/deleteme/man \
--infodir=/deleteme/info \
--pdfdir=/deleteme/pdf \
--htmldir=/deleteme/html \
--disable-nls \
--disable-werror \
--enable-interwork \
--enable-languages=c,c++ \
--enable-multilib \
--with-python=/usr/bin/python3 \
--with-system-gdbinit=/etc/gdb/gdbinit \
--with-system-readline \
--with-system-zlib
make
done
}
package() {
for target in $_targets; do
depends="$depends $_pkgbase-$target"
done
mkdir -p "$pkgdir"
}
_install_subpkg() {
target="${subpkgname#$_pkgbase-}"
pkgdesc="The GNU Debugger for $target"
cd "$srcdir/build/$target"
make DESTDIR="$subpkgdir" install
rm -rf "$subpkgdir"/deleteme
# those are provided by gdb
rm -rf "${subpkgdir:?}"/usr/share
# those are provided by binutils
rm -rf "${subpkgdir:?}"/usr/include
rm -rf "${subpkgdir:?}"/usr/lib
}
xtensa_esp8266_elf() {
_install_subpkg
}
xtensa_esp32_elf() {
_install_subpkg
}
xtensa_esp32s2_elf() {
_install_subpkg
}
xtensa_esp32s3_elf() {
_install_subpkg
}
sha512sums="
425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d gdb-12.1.tar.xz
7b872a53b31ad2c02fd2b04e39b8d1c63924437f35433e2495a9dbe341a118b8754fbe087986c335a8b1c588519ad637fa73b7270a28a692ad350d58fe7bac10 xtensa-overlay-2021r2-patch4.tar.gz
97ee00c68d8df2b04a141d4b0489e339a2d64c2c790d336767dbe28bf1510d596ea46142383ce09043a0bfc47f7d262082287448ded99fefa1f7e2b5ddad3df2 fix-invalid-implicit-conversion.patch
"