### this file is sourced not run
PKGVER=2.2.1.2025.04 # pull date
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=nvi2-$PKGVER.tar.gz
MD5SUM=c422e911ea055039567a0b6ff32b2288
SRC_URL=https://github.com/lichray/nvi2/archive/16de509a8b44fb50acd475473f6829baf2b3ef2c.tar.gz
BUNDLE=

SLACKREQ='libbsd' # build-time: libdb1 
SLACKDESC="nvi2: nvi2 $PKGVER (Console text editor)
nvi2: 
nvi2: This is version 2.2.1 (2023-09-25) of nex/nvi, a reimplementation of 
nvi2: the ex/vi text editors originally distributed as part of the Fourth 
nvi2: Berkeley Software Distribution (4BSD), by the University of 
nvi2: California, Berkeley.
nvi2: 
nvi2: https://github.com/lichray/nvi2/
nvi2: 
nvi2: 
nvi2: 
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/nvi2* &&

	# patch - remove the annoying keypad mode
	# keypad mode only works with xterm and nothing else
	sed -i -e '/keypad/ s/TRUE/FALSE/' cl/cl_funcs.c cl/cl_screen.c &&

	# build
	cmake -G "Ninja Multi-Config" -B build &&
	ninja -C build -f build-Release.ninja &&

	# install
	install -m644 man/vi.1 /usr/share/man/man1/nvi2.1 &&
	install -m755 build/Release/nvi /usr/bin/nvi2 &&
	ln -s nvi2 /usr/bin/ex2 &&
	
	pkg_build_slackdesc
}


