summaryrefslogtreecommitdiff
path: root/dev-games/cegui/cegui-0.7.1.ebuild
blob: 9224608717d6138bebbec7d1dd05308626bdbd44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 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
}