]> Pileus Git - ~andy/sunrise/blob - games-fps/assaultcube/assaultcube-1.0.4.ebuild
1365e98a5f19893cb73cc998d20c83b2f77c54cc
[~andy/sunrise] / games-fps / assaultcube / assaultcube-1.0.4.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=2
6
7 inherit eutils games multilib toolchain-funcs
8
9 DESCRIPTION="Fast and fun first-person-shooter based on the Cube fps"
10 HOMEPAGE="http://assault.cubers.net"
11 MY_PN="AssaultCube"
12 MY_PV_BASE=1.0.2
13 SRC_URI="mirror://sourceforge/actiongame/${MY_PN}_v${MY_PV_BASE}.tar.bz2
14         mirror://sourceforge/actiongame/${MY_PN}_v${PV}-Update.tar.bz2
15         https://sourceforge.net/tracker/download.php?group_id=123597&atid=697091&file_id=372520&aid=2995297 -> ${P}-Makefile.patch
16         https://sourceforge.net/tracker/download.php?group_id=123597&atid=697091&file_id=372519&aid=2995297 -> ${P}-enet.patch"
17
18 LICENSE="ZLIB"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="dedicated doc opengl"
22
23 RDEPEND="opengl? (
24                 media-libs/libsdl
25                 media-libs/libogg
26                 media-libs/libvorbis
27                 media-libs/openal
28                 media-libs/sdl-image
29                 virtual/opengl
30                 x11-libs/libX11
31         )"
32 DEPEND="${RDEPEND}
33         media-libs/netpbm
34         net-libs/enet"
35
36 S=${WORKDIR}/${MY_PN}_v${MY_PV_BASE}
37
38 pkg_setup() {
39         if ! use dedicated && ! use opengl ; then
40                 eerror "You need to set USE=dedicated for game server or USE=opengl for game client."
41                 die
42         fi
43 }
44
45 src_unpack() {
46         unpack ${MY_PN}_v${MY_PV_BASE}.tar.bz2
47         cd "${S}" || die
48         unpack ${MY_PN}_v${PV}-Update.tar.bz2
49 }
50
51 src_prepare() {
52         rm -r bin_unix/* source/include source/enet || die
53         find packages -name readme.txt -delete || die
54         winicontoppm icon.ico | ppmtoxpm > ${PN}.xpm || die
55
56         epatch "${DISTDIR}"/${P}-Makefile.patch
57         epatch "${DISTDIR}"/${P}-enet.patch
58
59         sed -i -e "/^CUBE_DIR=/d ; 2iCUBE_DIR=${GAMES_DATADIR}/${PN}" ${PN}.sh server.sh || die
60         sed -i -e "s:\${CUBE_DIR}/bin_unix/\${SYSTEM_NAME}\${MACHINE_NAME}:$(games_get_libdir)/${PN}/ac_:" ${PN}.sh server.sh || die
61 }
62
63 src_compile() {
64         emake -C source/src \
65                 CC="$(tc-getCXX)" \
66                 CXXOPTFLAGS="${CXXFLAGS}" \
67                 $(use opengl && echo client) \
68                 $(use dedicated && echo server) || die
69 }
70
71 src_install() {
72         insinto "${GAMES_DATADIR}/${PN}"
73         doins -r bot config packages || die
74
75         exeinto "$(games_get_libdir)/${PN}"
76         if use opengl ; then
77                 doexe source/src/ac_client || die
78                 newgamesbin ${PN}.sh ${PN} || die
79                 make_desktop_entry ${PN} ${MY_PN} ${PN}
80         fi
81         if use dedicated ; then
82                 doexe source/src/ac_server || die
83                 newgamesbin server.sh ${PN}-server || die
84                 make_desktop_entry ${PN}-server "${MY_PN} Server" ${PN}
85         fi
86         insinto /usr/share/pixmaps
87         doins ${PN}.xpm || die
88
89         if use doc ; then
90                 dohtml -r docs/* || die
91         fi
92
93         prepgamesdirs
94 }