# Template file for 'autogen'
pkgname=autogen
version=5.18.16
revision=3
build_style=gnu-configure
configure_args="--disable-static --disable-dependency-tracking --without-libregex ag_cv_run_strcspn=false"
hostmakedepends="automake guile libtool perl pkg-config tar which"
makedepends="guile guile-devel libatomic_ops-devel libxml2-devel gc-devel"
depends="guile perl"
short_desc="Automated Program Generator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-or-later"
homepage="https://autogen.sourceforge.net/"
distfiles="${GNU_SITE}/${pkgname}/rel${version}/${pkgname}-${version}.tar.gz"
checksum=e23c5bbd0ac83079ae2ef6eb3fd1948fecce718ac853025607a3ab0395538406
replaces="autogen-docs>=0 autogen-devel>=0"
_libopts=libopts-42.1.17.tar.gz
CFLAGS="-Wno-error=format-truncation -Wno-error=format-overflow
	-Wno-error=unused-parameter"

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" autogen guile-devel"
fi

pre_configure() {
	autoreconf -fi
}

post_install() {
	if [ "$SOURCE_DATE_EPOCH" ]; then
		# repackaging libopts to apply correct mtimes
		mkdir libopts
		tar xf $DESTDIR/usr/share/autogen/${_libopts} -C libopts
		find libopts -print0 | xargs -0 touch --date "@$SOURCE_DATE_EPOCH"
		cd libopts
		tar cf $DESTDIR/usr/share/autogen/${_libopts} *
	fi
}

libopts_package() {
	short_desc+=" - argument parsing library"
	pkg_install() {
		vmove "usr/lib/libopts.so.*"
	}
}
