# Template build file for 'sudo'.
pkgname=sudo
version=1.8.21p2
revision=1
lib32disabled=yes
build_style=gnu-configure
configure_args="--with-ignore-dot -with-all-insults --with-env-editor
 --enable-shell-sets-home --enable-noargs-shell --without-sendmail
 --with-logfac=auth --disable-root-mailer --enable-pie --with-mdoc
 --sbindir=/usr/bin"
hostmakedepends="groff"
makedepends="zlib-devel pam-devel"
conf_files="/etc/pam.d/sudo /etc/sudoers"
short_desc="Allow others to run commands as root"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://www.sudo.ws/"
license="ISC, BSD, zlib"
distfiles="https://www.sudo.ws/dist/sudo-${version}.tar.gz"
checksum=74c5746cd33a814e2431c39faf0d76f7f8a697379bd073862e3b156cf0d76368

post_configure() {
	case "$XBPS_TARGET_MACHINE" in
		i686-musl) find -type f -exec sed -i "{}" \
				-e "s;-fstack-protector-strong;-fno-stack-protector;g" \;
			;;
	esac
}

pre_install() {
	find ${wrksrc} -type f -name Makefile -exec sed -i 's,$(INSTALL_OWNER),,g' {} \;
}
post_install() {
	vinstall ${FILESDIR}/sudo.pam 644 etc/pam.d sudo
	vmkdir usr/share/licenses/sudo
	mv ${DESTDIR}/usr/share/doc/sudo/LICENSE ${DESTDIR}/usr/share/licenses/sudo
	# remove unused stuff.
	rm -rf ${DESTDIR}/usr/share/doc
	rm -rf ${DESTDIR}/usr/include
}
