# Template file for 'coin3'
pkgname=coin3
version=4.0.3
revision=1
build_style=cmake
configure_args="-DCMAKE_INSTALL_INCLUDEDIR=include/Coin3
 -DCOIN_BUILD_TESTS=OFF -DCOIN_BUILD_DOCUMENTATION=ON"
hostmakedepends="doxygen graphviz"
makedepends="boost-devel glu-devel"
short_desc="High-level 3D graphics toolkit"
maintainer="yopito <pierre.bourgin@free.fr>"
license="BSD-3-Clause"
homepage="https://coin3d.github.io/"
distfiles="https://github.com/coin3d/coin/archive/refs/tags/v${version}.tar.gz"
checksum=086ecf84479e4bc59397568638488c2e6c08d8aa811779bab93cda5509f79d59

CFLAGS=-DNDEBUG
CXXFLAGS=-DNDEBUG

if [ "$CROSS_BUILD" ]; then
	# bypass runtime test (quote hashing is fine with gcc 9.3)
	configure_args+=" -DHAVE_HASH_QUOTING_EXITCODE=0"
	configure_args+=" -DHAVE_HASH_QUOTING_EXITCODE__TRYRUN_OUTPUT=''"
fi

post_install() {
	# coin-config is superseeded by cmake support
	rm $DESTDIR/usr/bin/coin-config
	vlicense COPYING
}

coin3-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}

coin3-doc_package() {
	short_desc+=" - documentation"
	pkg_install() {
		vmove usr/share/doc
	}
}
