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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit desktop flag-o-matic gnome2-utils toolchain-funcs versionator
# 2.5.0 requires several patches
COMMIT="8b4533e85fdc0665889ff285e1521432084ee784"
# UFO:AI v2.5.0 was uploaded to SourceForge as 2.5
DIST_VERSION=$(get_version_component_range 1-2)
# Install game data here
DATADIR="/usr/share/${PN}"
DESCRIPTION="UFO: Alien Invasion - X-COM inspired strategy game"
HOMEPAGE="https://ufoai.org/"
SRC_URI="
https://dev.gentoo.org/~chewi/distfiles/${PN}-code-${COMMIT}.zip
mirror://sourceforge/${PN}/${PN}-${DIST_VERSION}-data.tar
editor? ( mirror://sourceforge/${PN}/${PN}-${DIST_VERSION}-mappack.tar.bz2 )
"
# https://ufoai.org/licenses/
LICENSE="GPL-2 GPL-3 public-domain CC-BY-3.0 CC-BY-SA-3.0 MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+client cpu_flags_x86_sse debug editor server"
REQUIRED_USE="|| ( client editor server )"
RDEPEND="
net-misc/curl
sys-libs/zlib
client? (
media-libs/libogg
media-libs/libpng:0=
media-libs/libsdl2[joystick,opengl,sound,threads,video]
media-libs/libtheora
media-libs/libvorbis
media-libs/sdl2-mixer
media-libs/sdl2-ttf
media-libs/xvid
virtual/jpeg:0
virtual/opengl
)
editor? (
dev-libs/glib:2
dev-libs/libxml2:2
media-libs/libogg
media-libs/libpng:0=
media-libs/libsdl2[joystick,opengl,sound,threads,video]
media-libs/libvorbis
media-libs/openal
virtual/glu
virtual/jpeg:0
x11-libs/gdk-pixbuf:2
x11-libs/gtk+:2
x11-libs/gtkglext
x11-libs/gtksourceview:2.0
)
server? (
media-libs/libsdl2[threads]
)
"
DEPEND="
${RDEPEND}
app-arch/unzip
sys-devel/gettext
virtual/pkgconfig
"
S="${WORKDIR}/${PN}-code-${COMMIT}"
PATCHES=( "${FILESDIR}"/${P}-install.patch )
src_unpack() {
use editor && unpack ${PN}-${DIST_VERSION}-mappack.tar.bz2
unpack ${PN}-code-${COMMIT}.zip
cd "${S}" || die
unpack ${PN}-${DIST_VERSION}-data.tar
}
src_prepare() {
default
# Make the build system a bit happier, will be fixed upstream
mkdir -p base/{maps,models} contrib/installer/mojosetup/scripts || die
}
src_configure() {
# Avoid noise, will be present in 2.6
append-cxxflags -Wno-expansion-to-defined
# The configure script of UFO:AI is hand crafted and a bit special
# econf does not work: "invalid option --build=x86_64-pc-linux-gnu"
local config=(
--prefix="${EPREFIX}"/usr
--datadir="${EPREFIX}${DATADIR}"
--libdir="${EPREFIX}"/usr/$(get_libdir)/${PN}
--localedir="${EPREFIX}"/usr/share/locale
--disable-dependency-tracking
--disable-paranoid
--disable-memory
--disable-testall
--disable-ufomodel
--disable-ufoslicer
$(use_enable cpu_flags_x86_sse sse)
$(use_enable !debug release)
$(use_enable server ufoded)
$(use_enable client ufo)
$(use_enable editor uforadiant)
$(use_enable editor ufo2map)
)
if use client || use server; then
config+=( --enable-game )
else
config+=( --disable-game )
fi
echo ./configure "${config[@]}"
CC=$(tc-getCC) CXX=$(tc-getCXX) \
./configure "${config[@]}" || die "configure failed"
}
src_compile() {
emake all lang Q=
}
src_install() {
newicon -s 32 src/ports/linux/ufo.png ${PN}.png
emake install Q= DESTDIR="${D}"
if use client; then
doman debian/ufo.6
make_desktop_entry ufo "UFO: Alien Invasion" ${PN}
fi
if use server; then
doman debian/ufoded.6
make_desktop_entry ufoded "UFO: Alien Invasion Server" ${PN} "Game;StrategyGame" "Terminal=true"
fi
if use editor; then
doman debian/ufo{2map,radiant}.6
make_desktop_entry uforadiant "UFO: Alien Invasion Map editor" ${PN}
# Install map editor data (without the binary)
rm radiant/uforadiant || die
insinto "${DATADIR}"
doins -r radiant
# Install map sources
insinto "${DATADIR}"/base/maps
doins -r "${WORKDIR}"/${PN}-${DIST_VERSION}-mappack/*
fi
}
pkg_preinst() { gnome2_icon_savelist; }
pkg_postinst() { gnome2_icon_cache_update; }
pkg_postrm() { gnome2_icon_cache_update; }
|