summaryrefslogtreecommitdiff
blob: c0cf7efd53c0c9f3f57d434c74c9bc5e09247814 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-arcade/koules/koules-1.4-r2.ebuild,v 1.7 2010/05/11 10:06:15 tupone Exp $
EAPI=2

inherit eutils games

DESCRIPTION="fast action arcade-style game w/sound and network support"
HOMEPAGE="http://www.ucw.cz/~hubicka/koules/English/"
SRC_URI="http://www.ucw.cz/~hubicka/koules/packages/koules${PV}-src.tar.gz
	mirror://gentoo/${P}-gcc3.patch.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ppc x86"
IUSE="joystick svga tk"

RDEPEND="svga? ( media-libs/svgalib )
	!svga? (
		x11-libs/libX11
		x11-libs/libXext
		media-fonts/font-schumacher-misc
	)
	tk? (
		dev-lang/tk
		dev-lang/tcl
	)
	!tk? ( dev-util/dialog )"
DEPEND="${RDEPEND}
	!svga? (
		x11-proto/xextproto
		x11-proto/xproto
		x11-misc/gccmakedep
		x11-misc/imake
		app-text/rman
	)"

S=${WORKDIR}/${PN}${PV}

src_prepare() {
	epatch "${WORKDIR}"/${P}-gcc3.patch \
		"${FILESDIR}"/${P}-sndsrv.patch \
		"${FILESDIR}"/${P}-io_h.patch
	sed -i \
		-e "/^KOULESDIR/s:=.*:=${GAMES_BINDIR}:" \
		-e "/^SOUNDDIR/s:=.*:=${GAMES_DATADIR}/${PN}:" Iconfig \
			|| die "sed Iconfig failed"
	sed -i \
		-e 's:-c -o $*.o:-c:' \
		-e 's:-S -o $*.s:-S:' \
		-e 's:$(ARCH)::' \
		-e "s:-fomit-frame-pointer -O3 -ffast-math:${CFLAGS}:" \
		Makefile.svgalib || die "sed Makefile.svgalib failed"
	use joystick && echo '#define JOYSTICK' >> Iconfig
	sed -i \
		-e "s:/usr/local/bin:${GAMES_BINDIR}:" koules \
			|| die "sed koules failed"
	if use tk ; then
		sed -i \
			-e "s:/usr/bin/X11:${GAMES_BINDIR}:" \
			-e "s:/usr/local/bin:${GAMES_BINDIR}:" \
			-e "s:/usr/local/lib/koules:${GAMES_DATADIR}/${PN}:" koules.tcl \
				|| die "sed koules.tcl failed"
	else
		sed -i \
			-e 's:exec.*tcl:exec xkoules "$@":' koules \
				|| die "sed koules failed"
	fi
	ln -s xkoules.6 xkoules.man
	ln -s xkoules.6 xkoules._man
}

src_configure() {
	if ! use svga ; then
		xmkmf -a
		sed -i \
			-e '/SYSDEFS =/d' \
			-e "/^ *CFLAGS =/s:$: ${CFLAGS}:" \
			-e "/xkoules/s:^all:all1:" \
			Makefile \
			|| die "sed Makefile failed"
	fi
}

src_compile() {
	mkdir bins
	if ! use svga ; then
		emake || die "emake X failed"
		emake all1 || die "emake X failed"
		mv xkoules bins/
	fi
	if use svga ; then
		emake -f Makefile.svgalib || die "emake svga failed"
		mv koules.svga bins/
	fi
}

src_install() {
	dogamesbin koules koules.sndsrv.linux bins/* || die "dogamesbin failed"
	exeinto "${GAMES_DATADIR}/${PN}"
	if use tk ; then
		dogamesbin koules.tcl || die "dogamebin failed (tcl)"
	fi
	insinto "${GAMES_DATADIR}/${PN}"
	doins sounds/* || die "doins failed (sounds)"

	doman xkoules.6
	use svga && doman koules.svga.6
	dodoc README ChangeLog BUGS ANNOUNCE TODO Koules.FAQ

	prepgamesdirs
}