NAME="gdb"
DESC="GNU Project debugger"
VERSION="13.2"

FILES=("https://ftp.gnu.org/gnu/gdb/gdb-${VERSION}.tar.xz")
HASHES=("fbd3cdae16c581e8a742cb766ba35076")

DEPENDS=("guile" "gcc-libs" "pypi-six" "python3")

PACKAGE() {
  tar xf "${NAME}-${VERSION}.tar.xz"
  cd "${NAME}-${VERSION}"

  mkdir build
  cd    build

  ../configure --prefix=/usr        \
             --with-system-readline \
             --with-python=/usr/bin/python3
  make && make -C gdb/doc doxy 

  make -C gdb DESTDIR="${ROOTDIR}" install
  make -C gdbserver DESTDIR="${ROOTDIR}" install

  install -d "${ROOTDIR}/usr/share/doc/gdb-${VERSION}"
  rm -rf gdb/doc/doxy/xml
  cp -Rv gdb/doc/doxy "${ROOTDIR}/usr/share/doc/gdb-${VERSION}"

  cd ../.. && rm -r "${NAME}-${VERSION}"
}
