# st - The suckless simple terminal
name=st
version=0.9.3
release=1
desc="The suckless simple terminal"
url="https://st.suckless.org/"
license="MIT"
depend="glibc libx11 libxft freetype fontconfig"
makedepend=""
source="https://dl.suckless.org/st/st-0.9.3.tar.gz"
sha256="SKIP"

build() {
	cd "st-0.9.3"
	# Suckless software is configured in the source. ScrapLinux ships a config.h
	# with the ScrapLinux palette; replace it and rebuild to change anything.
	[ -f config.def.h ] && cp -f config.def.h config.h
	# "tic -sx st.info" compiles the terminfo entry into the host's
	# /usr/share/terminfo, which the build sandbox refuses ("Operation not
	# permitted") and which fails the whole install. $TERMINFO is not enough
	# - tic only consults it for a *user* database - so point it at the
	# package explicitly with -o, where the entry belongs anyway.
	sed -i 's|tic -sx st.info|tic -sx -o "$(DESTDIR)$(PREFIX)/share/terminfo" st.info|' Makefile
	make -j"$JOBS" PREFIX=/usr
}

package() {
	cd "st-0.9.3"
	make PREFIX=/usr DESTDIR="$pkgdir" install
	[ -f config.h ] && install -Dm644 config.h "$pkgdir/usr/share/st/config.h"
	true
}
