pkgname=gdb
pkgver=16.3
pkgdesc='The GNU Debugger'
arch=(x86_64)
homepage='https://www.gnu.org/software/gdb/'
license=(GPL-3.0-or-later LGPL-3.0-or-later)
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}")
md5sums=("f7a7e2d0a6d28622ac69a3623b23876b")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  mkdir build &&
  cd    build &&

  ../configure --prefix=/usr          \
               --with-system-readline \
               --with-system-zlib     \
               --disable-sim          \
               --with-python=/usr/bin/python3 &&
  make &&
  cd ..
}

src_check() {
  :
}

src_install() {
  pushd build
  make -C gdb DESTDIR="$pkgdir" install
  make -C gdbserver DESTDIR="$pkgdir" install
  popd
}

