]> Pileus Git - ~andy/sunrise/blob - games-strategy/openra/openra-20120315.ebuild
games-strategy/openra: games eclass always last; remove audio-flag from libsdl
[~andy/sunrise] / games-strategy / openra / openra-20120315.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=3
6
7 EGIT_REPO_URI="git://github.com/OpenRA/OpenRA.git"
8 EGIT_COMMIT="release-${PV}"
9
10 inherit eutils mono gnome2-utils git-2 games
11
12 DESCRIPTION="A Libre/Free RTS engine supporting early Westwood games like Command & Conquer and Red Alert"
13 HOMEPAGE="http://open-ra.org/"
14
15 LICENSE="GPL-3"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="cg"
19
20 DEPEND="dev-dotnet/libgdiplus
21         dev-lang/mono
22         !games-strategy/openra-bin
23         media-libs/freetype:2[X]
24         media-libs/libsdl[X,video]
25         media-libs/openal
26         virtual/jpeg
27         virtual/opengl
28         cg? ( >=media-gfx/nvidia-cg-toolkit-2.1.0017 )"
29 RDEPEND="${DEPEND}"
30
31 src_unpack() {
32         git-2_src_unpack
33 }
34
35 src_prepare() {
36         # fix a few paths and install-rules
37         epatch "${FILESDIR}"/${P}-makefile.patch
38
39         # register game-version
40         sed \
41                 -e "/Version/s/{DEV_VERSION}/${EGIT_COMMIT}/" \
42                 -i mods/{ra,cnc}/mod.yaml || die
43 }
44
45 src_install() {
46         # no configure script
47         emake \
48                 prefix="${GAMES_PREFIX}" \
49                 datarootdir="${GAMES_DATADIR_BASE}" \
50                 datadir="${GAMES_DATADIR}" \
51                 bindir="${GAMES_BINDIR}" \
52                 DESTDIR="${D}" \
53                 install || die
54
55         # icons
56         insinto /usr/share/icons/
57         doins -r packaging/linux/hicolor || die
58
59         # .desktop files
60         domenu "${FILESDIR}"/${PN}-{cnc,editor,ra}.desktop || die
61
62         #docs
63         dodoc README HACKING CHANGELOG || die
64
65         if use cg ; then
66                 # set default renderer to cg
67                 sed \
68                         -e '/Renderer/s/Gl/Cg/' \
69                         -i "${D}"/usr/share/applications/${PN}-{cnc,ra}.desktop \
70                         || die "setting default renderer in desktop file failed"
71         fi
72
73         # file permissions
74         prepgamesdirs
75 }
76
77 pkg_preinst() {
78         games_pkg_preinst
79         gnome2_icon_savelist
80 }
81
82 pkg_postinst() {
83         games_pkg_postinst
84         gnome2_icon_cache_update
85
86         if use cg ; then
87                 elog "If you have problems starting the game consider switching"
88                 elog "back to Graphics.Renderer=Gl in openra*.desktop or pass that"
89                 elog "argument on the command line:"
90                 elog "openra Game.Mods=... Graphics.Renderer=Gl"
91         fi
92 }
93
94 pkg_postrm() {
95         gnome2_icon_cache_update
96 }