summaryrefslogtreecommitdiff
blob: 35ff9ef3a29886b8d9b580c392e791dcab0852a6 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-arcade/njam/njam-1.21.ebuild,v 1.3 2005/12/28 06:42:07 mr_bones_ Exp $

inherit eutils flag-o-matic games

MY_P="${P}-src"
DESCRIPTION="Multi or single-player network Pacman-like game in SDL"
HOMEPAGE="http://njam.sourceforge.net/"
SRC_URI="mirror://sourceforge/njam/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc ~amd64"
IUSE=""

DEPEND=">=media-libs/sdl-mixer-1.2.5
	>=media-libs/sdl-image-1.2.2
	>=media-libs/libsdl-1.2.5
	>=media-libs/sdl-net-1.2.4"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# store the conf file in the user's home directory.
	epatch "${FILESDIR}/${PV}-conf.patch"

	sed -i \
		-e "s:\"data:\"${GAMES_DATADIR}/${PN}/data:" njam.cpp njamgame.cpp \
		|| die "sed njam.cpp and njamgame.cpp failed"
	sed -i \
		-e "s:\"hiscore.dat:\"${GAMES_STATEDIR}/${PN}/hiscore.dat:" \
		-e "s:\"skins:\"${GAMES_DATADIR}/${PN}/skins:" njam.cpp \
		|| die "sed njam.cpp failed"
	sed -i \
		-e "s:\"levels:\"${GAMES_DATADIR}/${PN}/levels:" njamedit.cpp \
		|| die "sed njamedit.cpp failed"
	sed -i \
		-e "s:\"log.txt:\"/dev/null:" njamutils.cpp \
		|| die "sed njamutils.cpp failed"

	# njam segfaults on startup with -Os
	replace-flags "-Os" "-O2"

	sed -i \
		-e '/^PREFIX/s:=.*:=/usr/share:' \
		-e "s:-O3:${CFLAGS}:" Makefile \
		|| die "sed Makefile failed"
}

src_install() {
	dogamesbin njam || die "dogamesbin failed"
	dodoc CHANGES README TODO
	dohtml html/*
	dodir "${GAMES_DATADIR}/njam"
	cp -r data/ skins/ levels/ "${D}${GAMES_DATADIR}/njam" || die "cp failed"
	dodir "${GAMES_STATEDIR}/${PN}"
	touch "${D}/${GAMES_STATEDIR}/${PN}/hiscore.dat"
	fperms 664 "${GAMES_STATEDIR}/${PN}/hiscore.dat"
	prepgamesdirs
}