# Template file for 'graphviz'
pkgname=graphviz
version=15.0.0
revision=1
build_style=gnu-configure
configure_args="--with-gts --with-ann=no PYTHON3=python3"
make_build_args="HOSTCC=$BUILD_CC"
hostmakedepends="automake flex libltdl-devel libtool perl pkg-config python3"
makedepends="gd-devel gtk+3-devel gts-devel libXaw-devel libltdl-devel
 libpng-devel librsvg-devel"
depends="liberation-fonts-ttf"
checkdepends="${depends}"
short_desc="Graph Visualization Software"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="EPL-2.0"
homepage="https://www.graphviz.org"
changelog="https://gitlab.com/graphviz/graphviz/-/raw/main/CHANGELOG.md"
distfiles="https://gitlab.com/graphviz/graphviz/-/archive/${version}/graphviz-${version}.tar.gz"
checksum=dfa5be5c311f760aa9c88273c8f8101bb11f50b0de8b29bbd54acff3adc2d563

# `make check` is broken:
# https://gitlab.com/graphviz/graphviz/-/issues/2112
#
# Testing is via pytest:
# https://gitlab.com/graphviz/graphviz/-/blob/main/DEVELOPERS.md#testing
#
# They expect graphviz already installed before testing, disable
make_check=no

pre_configure() {
	./autogen.sh NOCONFIG
}

post_install() {
	vlicense EPL-2.0.txt LICENSE

	rm -rf ${DESTDIR}/usr/share/graphviz/doc
	# dot_builtins is just dot with preloaded plugins (for testing?)
	rm -f ${DESTDIR}/usr/bin/dot_builtins
}

graphviz-libs_package() {
	short_desc+=" - runtime libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

graphviz-devel_package() {
	depends="graphviz-libs>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/share/man/man3
	}
}
