# Template file for 'netbsd-curses'
pkgname=netbsd-curses
version=0.3.2
revision=4
build_style=gnu-makefile
short_desc="Drop in replacement ported from netbsd. Smaller than ncurses"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="BSD-3-Clause"
homepage="https://github.com/sabotage-linux/netbsd-curses"
distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz"
checksum=9d3ebd651e5f70b87b1327b01cbd7e0c01a0f036b4c1371f653b7704b11daf23
subpackages="netbsd-curses netbsd-curses-libs netbsd-curses-devel"

do_build() {
	make CC=$CC CFLAGS+=" -fPIC"
}

post_install() {
	cp COPYING LICENSE
	vlicense LICENSE
	cd ${DESTDIR}/usr/bin
	ln -sf tic captoinfo
	ln -sf tic infotocap
}

netbsd-curses-libs_package() {
	short_desc+=" -- shared libraries"
	shlib_provides="libcurses.so libform.so libmenu.so libpanel.so libterminfo.so"
	pkg_install() {
		vinstall ${DESTDIR}/usr/lib/libcurses.so 755 usr/lib/${pkgname} libcurses.so
		vinstall ${DESTDIR}/usr/lib/libform.so 755 usr/lib/${pkgname} libform.so
		vinstall ${DESTDIR}/usr/lib/libmenu.so 755 usr/lib/${pkgname} libmenu.so
		vinstall ${DESTDIR}/usr/lib/libpanel.so 755 usr/lib/${pkgname} libpanel.so
		vinstall ${DESTDIR}/usr/lib/libterminfo.so 755 usr/lib/${pkgname} libterminfo.so
	}
}

netbsd-curses-devel_package() {
	short_desc+=" -- development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib
		vmove usr/share/man/man3
	}
}
