# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit autotools eutils multilib EAPI="2" MY_P=CEGUI-${PV} MY_D=CEGUI-DOCS-${PV} DESCRIPTION="Crazy Eddie's GUI System is a free library providing windowing and widgets for graphics APIs / engines where such functionality is not natively available, or severely lacking. The library is object orientated, written in C++, and targeted at games developers who should be spending their time creating great games, not building GUI sub-systems!" HOMEPAGE="http://www.cegui.org.uk/" SRC_URI="mirror://sourceforge/crayzedsgui/${MY_P}.tar.gz doc? ( mirror://sourceforge/crayzedsgui/${MY_D}.tar.gz )" LICENSE="MIT" SLOT="0.7" KEYWORDS="~amd64 ~x86" IUSE="debug devil doc examples expat freeimage gtk irrlicht libxml lua ogre opengl tinyxml xerces-c" #static RDEPEND="dev-libs/libpcre media-libs/freetype:2 tinyxml? ( dev-libs/tinyxml ) devil? ( media-libs/devil ) doc? ( app-doc/doxygen ) expat? ( dev-libs/expat ) freeimage? ( media-libs/freeimage ) irrlicht? ( dev-games/irrlicht ) lua? ( dev-lang/lua ) ogre? ( dev-games/ogre ) opengl? ( virtual/opengl virtual/glu media-libs/glew ) xerces-c? ( dev-libs/xerces-c ) libxml? ( dev-libs/libxml2 )" DEPEND="${RDEPEND} dev-util/pkgconfig" S=${WORKDIR}/${MY_P} src_prepare() { epatch "${FILESDIR}/${P}-pkgconfig.patch" epatch "${FILESDIR}/${P}-tinyxml.patch" if use examples ; then cp -r Samples Samples.clean rm -f $(find Samples.clean -name 'Makefile*') fi #fix Makefiles for sloting ... some aren't using --includedir= sed -e "s/prefix)\/include/includedir)/g" \ -i $(grep -lr "\$(prefix)/include" --include=Makefile.am .) &> /dev/null if use freeimage; then einfo "Patching freeimage dynamic linking" sed -e "s:\(FreeImage_LIBS=\).*:\1\"`pkg-config --static --libs freeimage`\":" \ -e "s:AC_SEARCH_LIBS(FreeImage_GetVersion, freeimage, \[cegui_with_freeimage_lib=yes\], \[cegui_with_freeimage_lib=no\]):cegui_with_freeimage_lib=yes:" \ acinclude.m4 -i ||\ die 'freeimage patch failed' eend $? fi eautomake } src_configure() { econf \ --libdir="/usr/$(get_libdir)/${P}" \ --includedir="/usr/include/${P}" \ --datarootdir="/usr/share/${P}" \ --datadir="/usr/share/${P}" \ $(use_enable debug) \ $(use_enable devil) \ $(use_enable expat) \ $(use_enable freeimage) \ $(use_enable irrlicht irrlicht-renderer) \ $(use_enable lua external-toluapp) \ $(use_enable lua lua-module) \ $(use_enable lua toluacegui) \ $(use_enable opengl external-glew) \ $(use_enable opengl opengl-renderer) \ $(use_enable xerces-c) \ $(use_enable libxml) \ $(use_enable ogre ogre-renderer) \ $(use_enable tinyxml) \ $(use_enable tinyxml external-tinyxml) \ --enable-tga \ --disable-corona \ --disable-dependency-tracking \ --disable-samples \ --disable-silly \ $(use_with gtk gtk2) # $(use_enable static) \ # $(use_enable !static shared) } src_install() { emake DESTDIR="${D}" install || die "emake install failed" #remove .la files rm -f $(find ${D}/usr/$(get_libdir)/${P} -name *.la) #rename binarys find ${D}/usr/bin -type f -print0 | xargs -0 -I \{\} mv \{\} \{\}-${PV} #move and rename pkgconfig files mv "${D}/usr/$(get_libdir)/${P}/pkgconfig" "${D}/usr/$(get_libdir)" cd "${D}/usr/$(get_libdir)/pkgconfig" find -type f -print0 | xargs -0 -I \{\} basename \{\} .pc | \ xargs -I \{\} mv \{\}.pc \{\}-${PV}.pc cd ${S} if use doc ; then emake html || die "emake html failed" dohtml -r doc/doxygen/html/* || die "dohtml failed" fi if use examples ; then insinto /usr/share/doc/${PF}/Samples doins -r Samples.clean/* || die "doins failed" fi if use freeimage; then PKG_FILE="${D}/usr/$(get_libdir)/pkgconfig/CEGUI-${PV}.pc" awk '$0 ~ /^Requires:/ { if (split($0, req, ":") == 2) old_req=req[2] } \ $0 !~ /^Requires:/ { print $0 } \ END { print "Requires: freeimage " old_req }' \ "${PKG_FILE}" > "${PKG_FILE}.new" mv "${PKG_FILE}"{.new,} fi }