# Template file for 'monkey'
pkgname=monkey
version=1.6.9
revision=1
build_style=configure
hostmakedepends="cmake"
makedepends="mbedtls-devel"
configure_args+="--prefix=/usr --sbindir=/usr/bin --libdir=/usr/lib "
configure_args+="--sysconfdir=/etc/monkey/ --enable-plugins=mbedtls "
configure_args+="--webroot=/srv/www/$pkgname --mandir=/usr/share/man "
configure_args+="--pidfile=/var/run/monkey.pid --logdir=/var/log/monkey "
configure_args+="--malloc-libc --default-user=_$pkgname "
short_desc="Cross-arch embeddable lightweight HTTP server"
maintainer="necrophcodr <necrophcodr@necrophcodr.me>"
license="Apache-2.0"
homepage="http://monkey-project.com"
distfiles="${homepage}/releases/${version%.*}/${pkgname}-${version}.tar.gz"
checksum=f1122e89cda627123286542b0a18fcaa131cbe9d4f5dd897d9455157289148fb

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="_$pkgname"
_monkey_homedir="/srv/www/$pkgname"

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
		vmove "usr/lib/*.so"
	}
}
