1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit desktop flag-o-matic toolchain-funcs xdg
8 # 2.5.0 requires several patches
9 COMMIT="8b4533e85fdc0665889ff285e1521432084ee784"
11 # UFO:AI v2.5.0 was uploaded to SourceForge as 2.5
12 DIST_VERSION=$(ver_cut 1-2)
14 # Install game data here
15 DATADIR="/usr/share/${PN}"
17 DESCRIPTION="UFO: Alien Invasion - X-COM inspired strategy game"
18 HOMEPAGE="https://ufoai.org/"
20 https://dev.gentoo.org/~chewi/distfiles/${PN}-code-${COMMIT}.zip
21 mirror://sourceforge/${PN}/${PN}-${DIST_VERSION}-data.tar
24 # https://ufoai.org/licenses/
25 LICENSE="GPL-2 GPL-3 public-domain CC-BY-3.0 CC-BY-SA-3.0 MIT"
27 KEYWORDS="~amd64 ~x86"
28 IUSE="+client cpu_flags_x86_sse debug server"
29 REQUIRED_USE="|| ( client server )"
39 media-libs/libsdl2[joystick,opengl,sound,threads,video]
50 media-libs/libsdl2[threads]
61 S="${WORKDIR}/${PN}-code-${COMMIT}"
64 "${FILESDIR}"/${P}-install.patch
65 "${FILESDIR}"/${P}-mxml3.patch
69 unpack ${PN}-code-${COMMIT}.zip
71 unpack ${PN}-${DIST_VERSION}-data.tar
77 # Make the build system a bit happier, will be fixed upstream
78 mkdir -p base/{maps,models} contrib/installer/mojosetup/scripts || die
81 rm -r src/libs/mxml/ || die
85 # Avoid noise, will be present in 2.6
86 append-cxxflags -Wno-expansion-to-defined
88 # The configure script of UFO:AI is hand crafted and a bit special
89 # econf does not work: "invalid option --build=x86_64-pc-linux-gnu"
91 --prefix="${EPREFIX}"/usr
92 --datadir="${EPREFIX}${DATADIR}"
93 --libdir="${EPREFIX}"/usr/$(get_libdir)/${PN}
94 --localedir="${EPREFIX}"/usr/share/locale
95 --disable-dependency-tracking
101 $(use_enable cpu_flags_x86_sse sse)
102 $(use_enable !debug release)
103 $(use_enable server ufoded)
104 $(use_enable client ufo)
109 if use client || use server; then
110 config+=( --enable-game )
112 config+=( --disable-game )
115 echo ./configure "${config[@]}"
117 CC=$(tc-getCC) CXX=$(tc-getCXX) \
118 ./configure "${config[@]}" || die "configure failed"
126 newicon -s 32 src/ports/linux/ufo.png ${PN}.png
127 emake install Q= DESTDIR="${D}"
131 make_desktop_entry ufo "UFO: Alien Invasion" ${PN}
135 doman debian/ufoded.6
136 make_desktop_entry ufoded "UFO: Alien Invasion Server" ${PN} "Game;StrategyGame" "Terminal=true"