# vim - Vi improved
# Generated from manifest.tsv by gen-ports.py. Edit the manifest, not this file,
# unless the package needs something the template cannot express - in which case
# drop a `recipe.local` beside it and it will be preserved.
name=vim
version=9.2.0100
release=1
desc="Vi improved"
url="https://www.vim.org/"
license="Vim"
depend="glibc netbsd-curses libxcrypt"
makedepend=""
source="https://github.com/vim/vim/archive/refs/tags/v9.2.0100.tar.gz"
sha256="SKIP"

build() {
	cd "vim-9.2.0100"
	# Not every configure script accepts the same options - sqlite rejects
	# --disable-nls outright, for instance - so only pass the ones this one
	# actually advertises. Guessing wrong fails the whole build.
	#
	# vim's own configure auto-detects a GUI toolkit off the build host
	# (gtk2/gtk3/motif/X11) rather than the target - on a host with a real
	# desktop installed it happily found GTK3, glib, pango, dbus and elogind
	# and linked against all of them, none of which Arctic builds or ships.
	# This is a terminal editor here; --enable-gui=no and --without-x rule
	# out the whole GUI path regardless of what the build host happens to
	# have lying around.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib \
		--enable-gui=no --without-x"
	_help=$(./configure --help 2>/dev/null)
	case "$_help" in *--disable-static*)  _opts="$_opts --disable-static" ;; esac
	case "$_help" in *--disable-nls*)     _opts="$_opts --disable-nls" ;; esac
	# shellcheck disable=SC2086
	./configure $_opts
	make -j"$JOBS"
}

package() {
	cd "vim-9.2.0100"
	make DESTDIR="$pkgdir" install
}
