### this file is sourced not run
## source: step

# Build [1] master commit or [2] official release

repo=tmux
pkgname=$repo # for SLACKDESC

# -----------------
# [1] Master commit
# -----------------

# hash=46cbbe3d4566885b8ad4235598389936f63c2c01
# MD5SUM=f281fc2e168779f89cbb33ff3bc3708d
# # get hash_delta_ncommits by reading the number of commits at https://github.com/tmux/tmux/compare/3.2rc...master
# hash_delta_ncommits=1042
# # get hash_commit_date by reading the commit date on GitHub
# hash_commit_date=2021.03.11
# hash7=${hash#???????}; hash7=${hash%$hash7}

# PKGVER=3.1_${hash_delta_ncommits}_g${hash7}_${hash_commit_date}
# TARBALL=$pkgname-$hash.tar.gz
# SRC_URL=https://github.com/tmux/$repo/archive/$hash.tar.gz

# --------------------
# [2] Official release
# --------------------

MD5SUM=da674e061c9a1f5a14d4ecdd75210c16
PKGVER=3.2
TARBALL=$pkgname-$PKGVER.tar.gz
SRC_URL=https://github.com/$pkgname/$pkgname/releases/download/$PKGVER/$TARBALL

# --- common ---

PKGARCH=x86_64
PKGBUILD=1
BUNDLE=

SLACKREQ='libevent libncurses'
SLACKDESC="$pkgname: $pkgname $PKGVER (terminal mux)
$pkgname: tmux is a terminal multiplexer, it enables a number of terminals
$pkgname: (or windows) to be accessed and controlled from a single terminal.
$pkgname: It is an alternative to programs such as GNU screen.
$pkgname:
$pkgname:
$pkgname: License: BSD
$pkgname:
$pkgname:
$pkgname: https://github.com/tmux/tmux
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/$pkgname-${hash:-$PKGVER} &&
	if [ "$hash" ]; then
		sed -e "s@AC_INIT(tmux, master)@AC_INIT(tmux, ${PKGVER//_/ })@" -i configure.ac
	fi
}
### build
pkg_build() {
	export MAKE="make $MAKEFLAGS"
	cd tmp/$pkgname-${hash:-$PKGVER} &&
	if [ "$hash" ]; then ./autogen.sh; fi &&
	./configure --prefix=/usr --libdir=/usr/lib64 &&
	make &&
	make PREFIX=/usr install INSTALLLIB=/usr/lib64 &&
	# add tmux terminfo - same path as pkg/clfs/libncurses/recipe::--with-default-terminfo-dir=...
	# note that this exact tmux terminfo is included in the devx
	cp -a ../pkg/terminfo/* /usr/share/terminfo/ &&
	pkg_build_slackdesc &&
	cp -a ../pkg/install/* /install/
}

pkg_package() {
	# in $CHROOT_DIR
	: sample rm -r usr/local
}
# vim: fdm=marker ft=sh:
