# Template file for 'cegui'
pkgname=cegui
version=0.8.7
revision=6
build_style=cmake
hostmakedepends="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=b351e8957716d9c170612c13559e49530ef911ae4bac2feeb2dacd70b430e518

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 ogre"

if [ -z "$CROSS_BUILD" ]; then
	# XXX: boost-python is not available when cross building
	build_options_default+=" python"
fi

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"

	# cmake sets standard to c++03 (which doesn’t know int16_t)
	sed -i -e "s/-std=c++03//" CMakeLists.txt
}
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"
	}
}