summaryrefslogtreecommitdiff
blob: 909fcf4644a643d15bba5cd172273de4e592f7c7 (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/cube/cube-20021020-r2.ebuild,v 1.1 2003/09/09 18:10:14 vapier Exp $

inherit eutils games

MY_P="cube_2002_10_20"
DESCRIPTION="Landscape-style engine that pretends to be an indoor first person shooter engine"
HOMEPAGE="http://wouter.fov120.com/cube/"
SRC_URI="http://ludo.uib.no/cube/${MY_P}.zip
	http://www.idi.ntnu.no/~jonasf/cube/${MY_P}.zip
	http://tunes.org/~eihrul/${MY_P}.zip
	http://tunes.org/~eihrul/enet_2002_10_28.tar.gz"

LICENSE="ZLIB"
SLOT="0"
KEYWORDS="x86 ppc"

DEPEND="virtual/opengl
	media-libs/libsdl
	media-libs/sdl-mixer
	media-libs/sdl-image
	sys-libs/zlib
	media-libs/libpng"

S=${WORKDIR}
CUBE_DATADIR=${GAMES_DATADIR}/${PN}/

src_unpack() {
	unpack ${A}

	cd source
	unzip -qn ${MY_P}_src.zip || die

	# enet_2002_10_28.tar.gz patch
	rm -rf enet
	mv ../enet .

	cd src
	epatch ${FILESDIR}/${P}-add-custom-paths.patch || die
	echo "#define GAMES_DATADIR \"${CUBE_DATADIR}\"" >> tools.h
	echo "#define GAMES_DATADIR_LEN ${#CUBE_DATADIR}" >> tools.h
	for f in sound worldio ; do
		f="${f}.cpp"
		cp ${f} ${f}.old
		sed -e "s:packages/:${CUBE_DATADIR}packages/:" ${f}.old > ${f}
	done
	edos2unix *.cpp
}

src_compile() {
	cd source/src
	make || die
}

src_install() {
	dogamesbin source/src/cube_{client,server}
	if [ "${ARCH}" == "x86" ] ; then
		newgamesbin bin_unix/linux_client cube_client-bin
		newgamesbin bin_unix/linux_server cube_server-bin
	elif [ "${ARCH}" == "ppc" ] ; then
		newgamesbin bin_unix/ppc_linux_client cube_client-bin
		newgamesbin bin_unix/ppc_linux_server cube_server-bin
	fi
	echo "#!/bin/bash"$'\n'"cd ${CUBE_DATADIR}"$'\n'"cube_client-bin $@" > ${T}/client
	echo "#!/bin/bash"$'\n'"cd ${CUBE_DATADIR}"$'\n'"cube_server-bin $@" > ${T}/server
	newgamesbin ${T}/client playcubeclient
	newgamesbin ${T}/server playcubeserver

	dodir ${CUBE_DATADIR}
	mv *.cfg data packages ${D}/${CUBE_DATADIR}

	dodoc source/src/CUBE_TODO.txt
	dohtml -r docs/

	prepgamesdirs
}

pkg_postinst() {
	einfo "You now have 3 clients and 3 servers:"
	einfo "cube_client-bin      prebuilt version (needed to play on public multiplayer servers)"
	einfo "playcubeclient       wrapper to setup path's for the prebuilt binary"
	einfo "cube_client          custom client built from source"
	einfo "Parallel versions of the server have been installed"
	games_pkg_postinst
}