summaryrefslogtreecommitdiff
blob: 8fe9ea578b5c29f987f19bcff4755c3887e4a071 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-strategy/defcon-demo/defcon-demo-1.42.ebuild,v 1.2 2008/12/08 02:50:46 darkside Exp $

EAPI=1
inherit eutils toolchain-funcs games

MY_PN=defcon
MY_PV=${PV/_/-}
MY_P=defcon-v${MY_PV}

DESCRIPTION="Global thermonuclear war simulation with multiplayer support"
HOMEPAGE="http://www.introversion.co.uk/defcon/"
SRC_URI="http://download.introversion.co.uk/defcon/linux/${MY_P}.tar.gz"

LICENSE="defcon"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+system-libs"
RESTRICT="strip"

# glibc discussion:
# http://forums.introversion.co.uk/defcon/viewtopic.php?t=4016
RDEPEND=">=sys-libs/glibc-2.3
		system-libs? (
			media-libs/libogg
			media-libs/libsdl
			media-libs/libvorbis )
		x11-libs/libX11
		x11-libs/libXau
		x11-libs/libXext
		x11-libs/libXdmcp"
DEPEND=""

S=${WORKDIR}/${MY_P}

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

	# FindPath scripts are ugly and unnecessary
	rm -f defcon doc/README-SDL.txt
	if use system-libs ; then
		rm -f lib/lib*
	fi
	sed \
		-e "s:GAMEDIR:${GAMES_PREFIX_OPT}/${PN}:g" \
		"${FILESDIR}"/defcon > "${T}"/defcon \
		|| die "sed failed"
	echo "int chdir(const char *d) { return 0; }" > chdir.c \
		|| die "echo failed"
}

src_compile() {
	$(tc-getCC) -fPIC -shared -ldl -o lib/chdir.so chdir.c || die
}

src_install() {
	local dir=${GAMES_PREFIX_OPT}/${PN}

	insinto "${dir}/lib"
	doins lib/*.dat || die

	exeinto "${dir}"/lib
	doexe lib/*.{sh,x86,so} || die

	dodoc manual.pdf doc/*txt
	doicon doc/defcon.ico

	# Can be upgraded to full version, so is not installed as "demo"
	dogamesbin "${T}"/defcon || die "dogamesbin failed"
	make_desktop_entry ${MY_PN} "Defcon" /usr/share/pixmaps/defcon.ico

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst
	elog "Screenshots will appear in ~/.defcon/lib"
}