# Template file for 'cegui'
pkgname=cegui
version=0.8.4
revision=4
build_style=cmake
hostmakedepends="cmake graphviz doxygen dejavu-fonts-ttf gd glm perl pkg-config"
makedepends="libxml2-devel boost-devel glu-devel glew-devel glfw-devel
 devil-devel ois-devel silly-devel fribidi-devel lua51-devel minizip-devel
 $(vopt_if irrlicht irrlicht-devel)
 $(vopt_if ogre libogre-devel)
 $(vopt_if python 'python-devel boost-python')
 $(vopt_if gtk gtk+-devel)"
depends="${pkgname}-data"
make_build_args="all html"
short_desc="Crazy Eddie's Graphical User Interface"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="MIT"
homepage="http://cegui.org.uk/"
distfiles="${SOURCEFORGE_SITE}/crayzedsgui/${pkgname}-${version}.tar.bz2"
checksum=b5fcbd548b83045e92c4da413928113be77ebee0117368925e1904b3b957a388

build_options="gtk irrlicht ogre python"
desc_option_gtk="Enable support for GTK2"
desc_option_irrlicht="Enable support for Irrlicht"
desc_option_ogre="Enable support for Ogre"
build_options_default="gtk irrlicht"

if [ -z "$CROSS_BUILD" ]; then
	# XXX: boost-python is not available when cross building
	build_options_default+=" python"
fi
case "$XBPS_TARGET_MACHINE" in
	arm*)	# No ogre support for arm* (libogre for armv6l is broken)
		;;
	*)	build_options_default+=" ogre"
		;;
esac

pre_configure() {
	# Use /usr/lib instead of /usr/lib64 or /usr/lib32
	sed -i ${wrksrc}/CMakeLists.txt \
		-e "s;lib64;lib;g" \
		-e "s;lib32;lib;g"
}
post_install() {
	vlicense COPYING
}
cegui-data_package() {
	short_desc+=" - data files"
	noarch=yes
	pkg_install() {
		vmove usr/share/cegui-${version%%.*}
	}
}
cegui-doc_package() {
	short_desc+=" - documentation"
	noarch=yes
	pkg_install() {
		vmkdir usr/share/doc/${sourcepkg}
		vcopy ${wrksrc}/build/doc/doxygen/html usr/share/doc/${sourcepkg}
	}
}
cegui-sample_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - example"
	pkg_install() {
		vmove usr/bin
		vmove "usr/lib/cegui-0.8/libCEGUI*Demo.so"
	}
}
cegui-devel_package() {
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
