# Template file for 'osg'
pkgname=osg
reverts=3.6.0_1
version=3.4.1
revision=12
wrksrc=OpenSceneGraph-OpenSceneGraph-${version}
build_style=cmake
build_helper="qemu"
# don't use /usr/lib64 on 64bit platforms
configure_args="-DLIB_POSTFIX= $(vopt_if qt '-DOSG_USE_QT=1' '-DOSG_USE_QT=0')"
hostmakedepends="pkg-config unzip 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 qt qt5-devel)
 $(vopt_if vnc libvncserver-devel)"
depends="xrandr"
short_desc="OpenSceneGraph: high performance real-time graphics toolkit"
maintainer="Orphaned <orphan@voidlinux.org>"
license="OSGPL-2.0-or-later"
homepage="http://www.openscenegraph.org"
distfiles="https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-${version}.tar.gz"
checksum=930eb46f05781a76883ec16c5f49cfb29a059421db131005d75bec4d78401fd5

# Append CFLAGS and CXXFLAGS to set work around code which gcc6 would
# otherwise regard as out-of-specification and allow it to produce a
# working program.
CFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2 -Wno-deprecated-declarations"

build_options="openexr poppler qt 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 [ -z "$CROSS_BUILD" ]; then
	build_options_default+=" qt"
else
	# 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
	}
}
