]> Pileus Git - ~andy/sunrise/blob - games-strategy/openra/openra-20120315.ebuild
games-strategy/openra: older versions of nvidia-cg-toolkit don't work
[~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 games git-2
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,audio,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_prepare() {
32         # fix a few paths and install-rules
33         epatch "${FILESDIR}"/${P}-makefile.patch
34
35         # register game-version
36         sed \
37                 -e "/Version/s/{DEV_VERSION}/${EGIT_COMMIT}/" \
38                 -i mods/{ra,cnc}/mod.yaml || die
39 }
40
41 src_install() {
42         # no configure script
43         emake \
44                 prefix="${GAMES_PREFIX}" \
45                 datarootdir="${GAMES_DATADIR_BASE}" \
46                 datadir="${GAMES_DATADIR}" \
47                 bindir="${GAMES_BINDIR}" \
48                 DESTDIR="${D}" \
49                 install || die
50
51         # icons
52         insinto /usr/share/icons/
53         doins -r packaging/linux/hicolor || die
54
55         # .desktop files
56         domenu "${FILESDIR}"/${PN}-{cnc,editor,ra}.desktop || die
57
58         #docs
59         dodoc README HACKING CHANGELOG || die
60
61         if use cg ; then
62                 # set default renderer to cg
63                 sed \
64                         -e '/Renderer/s/Gl/Cg/' \
65                         -i "${D}"/usr/share/applications/${PN}-{cnc,ra}.desktop \
66                         || die "setting default renderer in desktop file failed"
67         fi
68
69         # file permissions
70         prepgamesdirs
71 }
72
73 pkg_preinst() {
74         games_pkg_preinst
75         gnome2_icon_savelist
76 }
77
78 pkg_postinst() {
79         games_pkg_postinst
80         gnome2_icon_cache_update
81
82         if use cg ; then
83                 elog "If you have problems starting the game consider switching"
84                 elog "back to Graphics.Renderer=Gl in openra*.desktop or pass that"
85                 elog "argument on the command line:"
86                 elog "openra Game.Mods=... Graphics.Renderer=Gl"
87         fi
88 }
89
90 pkg_postrm() {
91         gnome2_icon_cache_update
92 }