# Template file for 'monkey'
pkgname=monkey
version=1.6.9
revision=7
build_style=cmake
configure_args="-DINSTALL_SYSCONFDIR=/etc/monkey/ -DWITH_PLUGINS=mbedtls
 -DWITH_SYSTEM_MALLOC=ON -DINSTALL_WEBROOTDIR=/srv/www/monkey
 -DCMAKE_INSTALL_LIBDIR=/usr/lib$XBPS_TARGET_WORDSIZE/monkey
 -DDEFAULT_USER=_monkey -DPID_FILE=/var/run/monkey.pid
 -DINSTALL_LOGDIR=/var/log/monkey"
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"

if [ $XBPS_TARGET_LIBC = musl ]; then
	configure_args+=" -DWITH_MUSL=ON -DWITH_BACKTRACE=OFF"
fi

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
	}
}
