# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=cgdb
pkgver=0.8.0
pkgrel=2
pkgdesc="Curses-based interface to the GNU Debugger"
arch=('i686' 'x86_64')
url="https://cgdb.github.io/"
license=('spdx:GPL-2.0-or-later')
depends=('libreadline' 'ncurses' 'gdb')
makedepends=('help2man' 'libreadline-devel' 'ncurses-devel' 'autotools' 'gcc')
source=("https://cgdb.me/files/${pkgname}-${pkgver}.tar.gz")
sha256sums=('0d38b524d377257b106bad6d856d8ae3304140e1ee24085343e6ddf1b65811f1')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  echo "$pkgver" > VERSION
  autoreconf -vfi -I config
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  export MSYSTEM=CYGWIN

  CFLAGS+=" -D_GNU_SOURCE"
  CXXFLAGS+="   -D_GNU_SOURCE"
  ./configure \
    --prefix=/usr \
    --build=${CHOST} \
    --with-readline=/usr \
    --with-ncurses=/usr
  
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}/" install
}
