# Template file for 'monkey'
pkgname=monkey
version=1.6.9
revision=5
build_style=configure
configure_args="--prefix=/usr --sbindir=/usr/bin
 --libdir=/usr/lib$XBPS_TARGET_WORDSIZE/$pkgname
 --sysconfdir=/etc/monkey/ --enable-plugins=mbedtls --malloc-libc
 --webroot=/srv/www/$pkgname --mandir=/usr/share/man --default-user=_monkey
 --pidfile=/var/run/monkey.pid --logdir=/var/log/monkey"
hostmakedepends="cmake"
makedepends="mbedtls2-devel"
short_desc="Cross-arch embeddable lightweight HTTP server"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://github.com/monkey/monkey"
distfiles="https://github.com/monkey/monkey/archive/refs/tags/v${version}.tar.gz"
checksum=8b795f605bfa544d3a57afd580bf6970aac72fb6b7aba338bd3012768b30e587

conf_files="
 /etc/monkey/plugins/*/*.conf
 /etc/monkey/plugins/dirlisting/themes/*/*.theme
 /etc/monkey/sites/default
 /etc/monkey/monkey.conf
 /etc/monkey/plugins.load
 /etc/monkey/monkey.mime"

system_accounts="_monkey"
_monkey_homedir="/srv/www/_monkey"

make_dirs="
 /srv/www/monkey 0755 _monkey _monkey
 /var/log/monkey/htdocs 0755 _monkey _monkey"

CFLAGS="-fcommon"

case $XBPS_TARGET_MACHINE in
	*-musl) configure_args+=" --musl-mode --no-backtrace ";;
esac

post_install() {
	vmkdir usr/share/monkey/webroot
	mv ${DESTDIR}/srv/www/$pkgname/* ${DESTDIR}/usr/share/monkey/webroot
	vsv monkey
}

monkey-devel_package() {
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
	}
}
