# Template file for 'gmsh'
pkgname=gmsh
version=4.8.4
revision=2
build_style=cmake
configure_args="-DENABLE_SYSTEM_CONTRIB=ON
 -DENABLE_HXT=$(vopt_if hxt ON OFF)
 -DENABLE_ZIPPER=$(vopt_if zipper ON OFF)"
makedepends="freetype-devel glu-devel gmp-devel $(vopt_if occt occt-devel)
 $(vopt_if fltk fltk-devel) blas-devel lapack-devel"
short_desc="Three-dimensional finite element mesh generator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://gmsh.info"
changelog="http://gmsh.info/CHANGELOG.txt"
distfiles="https://gmsh.info/src/gmsh-${version}-source.tgz"
checksum=760dbdc072eaa3c82d066c5ba3b06eacdd3304eb2a97373fe4ada9509f0b6ace

build_options="fltk occt hxt zipper"
build_options_default="hxt occt"

desc_option_hxt="Enable HXT library"
desc_option_fltk="Enable FLTK GUI support"
desc_option_occt="Enable OpenCASCADE support"
desc_option_zipper="Enable zip file compression/decompression"

CFLAGS="-fcommon"

if [ -z "$CROSS_BUILD" ]; then
	makedepends+=" hdf5-devel"
fi


case "$XBPS_TARGET_MACHINE" in
	aarch64*|i686*|x86_64*|ppc64*) build_options_default+=" fltk";;
esac

post_install() {
	rm -rf builddir/gmsh-$version-source/api
}

gmsh-doc_package() {
	short_desc+=" - document and demo files"
	pkg_install() {
		vmove usr/share/doc
	}
}
