# Template file for 'ogre'
pkgname=libogre
version=1.10.11
revision=2
build_style=cmake
configure_args="-DCMAKE_INSTALL_PREFIX=/usr \
	-DOGRE_INSTALL_PLUGINS_HEADERS=TRUE \
	-DOGRE_INSTALL_SAMPLES=TRUE \
	-DOGRE_INSTALL_DOCS=TRUE \
	-DOGRE_INSTALL_MEDIA=TRUE \
	-DOGRE_INSTALL_SAMPLES_SOURCE=TRUE \
	-DCMAKE_BUILD_TYPE=Release"
hostmakedepends="pkg-config graphviz doxygen dejavu-fonts-ttf"
makedepends="boost-devel freetype-devel libXaw-devel libXrandr-devel
 MesaLib-devel zziplib-devel libcppunit-devel glu-devel libatomic-devel
 freeimage-devel python3-devel"
short_desc="Scene-oriented, flexible 3D engine"
maintainer="Enno Boland <gottox@voidlinux.eu>"
homepage="http://www.ogre3d.org"
license="MIT"
distfiles="https://github.com/OGRECave/ogre/archive/v$version.tar.gz"
checksum=ff2e666201c1dfddee2fe53ba4825f19385eb3b0d4ad8c3872d8084076826d8d
make_build_target="all OgreDoc"
wrksrc=ogre-$version

CXXFLAGS="-fcheck-new -fno-delete-null-pointer-checks -fno-lifetime-dse"
case "$XBPS_TARGET_MACHINE" in
	armv[56]*) makedepends+=" libatomic-devel" ;;
esac

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
		armv[56]*) find -name CMakeLists.txt -exec sed -i "{}" \
			-e "/target_link_libraries/s/)/ atomic)/" \;
			;;
	esac
}

post_install() {
	vmkdir /usr/share/doc
	vcopy build/Docs /usr/share/doc/libogre
	vlicense LICENSE
}

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

libogre-doc_package() {
	depends="libogre>=${version}_${revision}"
	short_desc+=" - documentation"
	pkg_install() {
		vmove /usr/share/doc/libogre
	}
}
