# Template file for 'osg'
pkgname=osg
version=3.6.5
revision=1
build_style=cmake
build_helper="qemu"
# don't use /usr/lib64 on 64bit platforms
configure_args="-DLIB_POSTFIX="
hostmakedepends="pkg-config xrandr"
makedepends="MesaLib-devel gtkglext-devel libcurl-devel giflib-devel librsvg-devel
 jasper-devel tiff-devel libgdal-devel libgta-devel ffmpeg-devel xine-lib-devel
 SDL2-devel gst-plugins-base1-devel
 $(vopt_if openexr libopenexr-devel)
 $(vopt_if poppler poppler-glib-devel)
 $(vopt_if vnc libvncserver-devel)"
depends="xrandr"
short_desc="OpenSceneGraph: high performance real-time graphics toolkit"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later, WxWindows-exception-3.1, custom:OpenSceneGraph"
homepage="https://www.openscenegraph.org"
changelog="https://raw.githubusercontent.com/openscenegraph/OpenSceneGraph/master/NEWS.txt"
distfiles="https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-${version}.tar.gz"
checksum=aea196550f02974d6d09291c5d83b51ca6a03b3767e234a8c0e21322927d1e12

build_options="openexr poppler vnc"
build_options_default="openexr poppler vnc"
desc_option_openexr="Enable support for high dynamic range images"
desc_option_poppler="Enable support for creating PDF"
desc_option_vnc="Enable support for VNC server"

if [ -n "$CROSS_BUILD" ]; then
	# cmake can't check this when cross compiling
	configure_args+=" -DPOPPLER_HAS_CAIRO_EXITCODE=0"
	configure_args+=" -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE=0"
fi

post_install() {
	# Also install the cmake script FindOSG.cmake for developers to use
	vinstall CMakeModules/FindOSG.cmake 644 usr/lib/cmake/OSG
	vlicense LICENSE.txt
}

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