# Contributor: Harry
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cgdb
pkgver=0.8.0
pkgrel=3
pkgdesc="The Curses Debugger"
arch="all"
license="GPL-2.0-or-later"
url="https://cgdb.github.io/"
depends="gdb"
makedepends="flex bison texinfo help2man ncurses-dev readline-dev"
source="http://cgdb.me/files/cgdb-$pkgver.tar.gz"
subpackages="$pkgname-doc"

prepare() {
 	default_prepare
	update_config_sub
}

build() {
	CFLAGS="$CFLAGS -std=c11 -fpermissive" \
	CXXFLAGS="$CXXFLAGS -std=c++11" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libdir=/usr/lib
	make
}

check() {
	make check
}

package() {
	make install \
		pkgconfigdir="/usr/lib/pkgconfig" \
		DESTDIR="$pkgdir"
	mkdir -p "$pkgdir"/usr/share/doc
	mv "$pkgdir"/usr/share/cgdb "$pkgdir"/usr/share/doc/
}

sha512sums="
0f53798707f20508a8ea564d5ed3f82e223edf4b246468c9a99c929c043b2b2eb333e96395b66672a38da1e517efb7c7dec011a29ea774d873ddf81fb56e4d9a  cgdb-0.8.0.tar.gz
"
