summaryrefslogtreecommitdiff
blob: 945435456c2450d0dbb75f6d9e2ac38d1c0937dc (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-strategy/ufo-ai/ufo-ai-2.1.1.ebuild,v 1.2 2007/08/21 19:04:06 mr_bones_ Exp $

inherit eutils autotools games

MY_PV=${PV/_rc/-RC}
MY_P="ufoai-${MY_PV}"

DESCRIPTION="UFO: Alien Invasion - X-COM inspired strategy game"
HOMEPAGE="http://www.ufoai.net/"
SRC_URI="mirror://sourceforge/ufoai/music.tar.bz2
	mirror://sourceforge/ufoai/${MY_P}-data.tar
	mirror://sourceforge/ufoai/${MY_P}-source.tar.bz2
	mirror://sourceforge/ufoai/${MY_P}-i18n.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="alsa arts debug dedicated dga doc ipv6 jack master oss paranoid"

UIRDEPEND="virtual/opengl
	virtual/glu
	>=media-libs/libsdl-1.2.7
	>=media-libs/sdl-ttf-2.0.7
	dga? ( x11-libs/libXxf86dga )
	x11-libs/libX11"
UIDEPEND="x11-proto/xf86vidmodeproto
	x11-proto/xproto"
RDEPEND="${UIRDEPEND}
	alsa? ( media-libs/alsa-lib )
	arts? ( kde-base/arts )
	>=media-libs/jpeg-6b-r7
	media-libs/libpng
	>=media-libs/libogg-1.1
	>=media-libs/libvorbis-1.1
	jack? ( >=media-sound/jack-0.100.0 )
	sys-devel/gettext
	>=sys-libs/glibc-2.4
	>=sys-libs/zlib-1.2.3"
DEPEND="${RDEPEND}
	${UIDEPEND}
	doc? ( app-doc/doxygen )"

S=${WORKDIR}/${MY_P}-source
dir=${GAMES_DATADIR}/${PN}

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

	local libdir=$(games_get_libdir)/${PN}
	# Set libdir
	sed -i \
		-e "s:libPath, \"\.\":libPath, \"${libdir}\":" \
		src/{client,ports/linux}/*.c || die "sed *.c failed"

	sed -i \
		-e "s:\"s_libdir\", \"\":\"s_libdir\", \"${libdir}\":" \
		src/client/snd_ref.c || die "sed snd_ref.c failed"

	sed -i \
		-e "s:game\.so\", path:game\.so\", \"${libdir}\":" \
		src/ports/linux/sys_linux.c || die "sed sys_linux.c failed"

	# Set basedir
	sed -i \
		-e "s:\"fs_basedir\", \"\.\":\"fs_basedir\", \"${dir}\":" \
		src/qcommon/files.c || die "sed files.c failed"

	sed -i \
		-e "s:/usr/local/games/ufoai:${dir}:" \
		src/tools/gtkradiant/games/ufoai.game || die "sed ufoai.game failed"

	# Fixes bug in finding text files - it should use fs_basedir
	sed -i \
		-e "s:FS_GetCwd():\"${dir}\":" \
		src/qcommon/common.c || die "sed common.c failed"

	eautoreconf
}

src_compile() {
# Forces building of client.
# gettext is required to show the intro text.
# egamesconf fails with openal.
#		$(use_with openal)
	egamesconf \
		$(use_enable dedicated) \
		$(use_enable master) \
		$(use_enable !debug release) \
		$(use_enable paranoid) \
		--with-vid-glx \
		--with-vid-vidmode \
		--with-sdl \
		--with-snd-sdl \
		$(use_with alsa snd-alsa) \
		$(use_with arts snd-arts) \
		$(use_with jack snd-jack) \
		$(use_with oss snd-oss) \
		$(use_with dga vid-dga) \
		$(use_with ipv6) \
		--with-gettext \
		--without-openal \
		|| die "egamesconf failed"

	emake || die "emake failed"

	if use doc ; then
		emake docs || die "emake docs failed"
	fi
}

src_install() {
	# ufo is usually started by a "ufoai" wrapper script.
	# Might as well standardize on the ebuild name, for minimum confusion.
	newgamesbin ufo ${PN} || die
	newicon src/ports/linux/installer/data/ufo.xpm ${PN}.xpm || die
	make_desktop_entry ${PN} "UFO: Alien Invasion" ${PN}.xpm

	if use dedicated ; then
		dogamesbin ufoded || die
	fi

	if use master ; then
		dogamesbin ufomaster || die
	fi

	if [[ -f ufo2map ]] ; then
		dogamesbin ufo2map || die
	fi

	exeinto "$(games_get_libdir)/${PN}"
	doexe *.so base/game.so || die "doexe ${f} failed"

	insinto "${dir}"
	doins -r "${WORKDIR}"/{base,music} || die "doins -r failed"

	if use doc ; then
		dohtml -r "${WORKDIR}"/docs/html/*
	fi

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst

	elog "To play the game, run:  ${PN}"
	echo
}