# Template file for 'dar'
pkgname=dar
version=2.8.4
revision=1
build_style=gnu-configure
configure_args="--disable-upx --disable-build-html --disable-dar-static"
conf_files="/etc/darrc"
hostmakedepends="automake gettext-devel libtool pkg-config which"
makedepends="acl-devel bzip2-devel e2fsprogs-devel libgcrypt-devel liblzma-devel
 lzo-devel librsync-devel libcurl-devel libargon2-devel gpgme-devel"
short_desc="Shell command that backs up directory trees and files"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://dar.linux.free.fr/"
distfiles="${SOURCEFORGE_SITE}/dar/dar-${version}.tar.gz"
checksum=8e1ba552fd8b0783076d42ac1c2eeda57781c89f9bcc119f9d00ff1326e95e13

if [ "$CROSS_BUILD" ]; then
	configure_args+=" --with-gpgme-prefix=${XBPS_CROSS_BASE}/usr
	 ac_cv_lib_gcrypt_gcry_check_version=false"
	LDFLAGS="-L${XBPS_CROSS_BASE}/usr/lib -lgcrypt"
fi

post_extract() {
	if [ "$CROSS_BUILD" ]; then
		# skip building checks, its trying to execute a target
		# binary and we don't run the checks for cross builds
		# anywyas.
		vsed -e '/SUBDIRS =/s/check//g' -i src/Makefile.in
	fi
}

do_check() {
	# need to be run as root
	:
}

post_install() {
	# Prevent writing memory pages to disk,
	# which gives "Warning: using insecure memory"
	chmod u+s ${DESTDIR}/usr/bin/dar
}

libdar_package() {
	short_desc+=" - runtime library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}
libdar-devel_package() {
	short_desc+=" - development files"
	depends="libdar>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}
