# Template file for 'vsftpd'
pkgname=vsftpd
version=3.0.3
revision=3
build_style=gnu-makefile
makedepends="pam-devel libcap-devel libressl-devel"
short_desc="FTP deamon with focus on security"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="GPL-3"
homepage="https://security.appspot.com/vsftpd.html"
distfiles="https://security.appspot.com/downloads/$pkgname-$version.tar.gz"
checksum=9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7
system_accounts="ftp"
ftp_pgroup="nogroup"
CFLAGS="-Wno-error"
conf_files="/etc/vsftpd.conf"

do_configure() {
	local _nlsstring='-lcrypt -lnsl';
	case "$XBPS_TARGET_MACHINE" in
		*-musl) _nlsstring=-lcrypt ;;
	esac

	sed -i 's/#undef VSF_BUILD_SSL/#define VSF_BUILD_SSL/' builddefs.h
	sed -i "s/-lcrypt -lnsl/${_nlsstring} -lssl -lcrypto/" Makefile
}

do_install() {
	vbin $pkgname
	vconf $pkgname.conf
	vman $pkgname.8
	vman $pkgname.conf.5
	vinstall EXAMPLE/INTERNET_SITE/$pkgname.xinetd 644 $pkgdir/etc/xinetd.d/$pkgname
	vinstall RedHat/$pkgname.log 644 etc/logrotate.d/$pkgname
	vsv vsftpd
	vsv vsftpd-ipv6

	for i in BENCHMARKS BUGS Changelog FAQ INSTALL README README.ssl REFS \
		REWARD SPEED TODO TUNING; do
		vinstall $i 644 usr/share/doc/$pkgname/$i
	done
}
