# tmux - Terminal multiplexer
# 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=tmux
version=3.6a
release=1
desc="Terminal multiplexer"
url="https://tmux.github.io/"
license="ISC"
depend="glibc libevent netbsd-curses"
makedepend=""
source="https://github.com/tmux/tmux/releases/download/3.6a/tmux-3.6a.tar.gz"
sha256="SKIP"

build() {
	cd "tmux-3.6a"
	# 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.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib"
	# libevent and netbsd-curses live in the Arctic staging prefix during a
	# build, not in the host's default search path.
	_D=${ARCTIC_DEPS:-/home/apiwo/arctic-build/stage/deps/usr}
	export CPPFLAGS="-I$_D/include ${CPPFLAGS:-}"
	export LDFLAGS="-L$_D/lib ${LDFLAGS:-}"
	export PKG_CONFIG_PATH="$_D/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
	_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 "tmux-3.6a"
	make DESTDIR="$pkgdir" install
}
