# Template file for 'gfan'
pkgname=gfan
version=0.7
revision=1
build_style=gnu-makefile
makedepends="gmp-devel cddlib-devel abseil-cpp-devel"
short_desc="Package for computing Groebner fans and tropical varieties"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
license="GPL-2.0-or-later"
homepage="https://math.au.dk/~jensen/software/gfan/gfan.html"
distfiles="https://math.au.dk/~jensen/software/gfan/gfan${version}.tar.gz"
checksum=ab833757e1e4d4a98662f4aa691394013ea9a226f6416b8f8565356d6fcc989e

# Makefile has this but our CFLAGS override it; build fails otherwise
CFLAGS="-DGMPRATIONAL"

post_patch() {
	# remove a failing test
	rm -rf testsuite/0009RenderStairCase
}

if [ -n "$CROSS_BUILD" ]; then
	# depend on host gfan for installlinks
	hostmakedepends+=" gfan"
fi

do_install() {
	if [ -z "$CROSS_BUILD" ]; then
		# Makefile doesn't support DESTDIR so we add it to PREFIX
		make PREFIX=${DESTDIR}/usr install
	else
		vbin gfan
		# use host gfan to install links
		cd ${DESTDIR}/usr/bin && gfan installlinks
	fi
}
