# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=newt
pkgver=0.52.25
pkgrel=0
pkgdesc="Redhat's Newt windowing toolkit development files"
options="!check" # No testsuite
url="https://pagure.io/newt/"
arch="all"
license="LGPL-2.0-only"
makedepends="slang-dev popt-dev python3-dev ncurses-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang py3-$pkgname:py3"
source="https://releases.pagure.org/newt/newt-$pkgver.tar.gz"

prepare() {
	default_prepare

	sed -i -e 's:-lslang:-lslang -lncurses:g' \
		-e 's:instroot:DESTDIR:g' Makefile.in
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--without-tcl \
		--disable-nls
	make RPM_OPT_FLAGS="$CFLAGS"
}

package() {
	make DESTDIR="$pkgdir" prefix="/usr" RPM_OPT_FLAGS="ERROR" install
	rm -f "$pkgdir"/usr/lib/*.a
}

py3() {
	pkgdesc="Python3 bindings for Newt windowing toolkit"
	depends="$pkgname=$pkgver-r$pkgrel python3"
	amove '/usr/lib/python*'
}

sha512sums="
23f239ff599f63fdfec83ba32256a4b4e081d84fe7844a32a9770a0776df7e200315f794d031bca0f7c3526a9730fb3f62973bad40bf96618de6e336e97a8096  newt-0.52.25.tar.gz
"
