games-strategy/ufoai: Drop USE=editor to avoid dead gtkglext dependency
[gentoo.git] / games-strategy / ufoai / ufoai-2.5.0_p20180603-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit desktop flag-o-matic toolchain-funcs xdg
7
8 # 2.5.0 requires several patches
9 COMMIT="8b4533e85fdc0665889ff285e1521432084ee784"
10
11 # UFO:AI v2.5.0 was uploaded to SourceForge as 2.5
12 DIST_VERSION=$(ver_cut 1-2)
13
14 # Install game data here
15 DATADIR="/usr/share/${PN}"
16
17 DESCRIPTION="UFO: Alien Invasion - X-COM inspired strategy game"
18 HOMEPAGE="https://ufoai.org/"
19 SRC_URI="
20         https://dev.gentoo.org/~chewi/distfiles/${PN}-code-${COMMIT}.zip
21         mirror://sourceforge/${PN}/${PN}-${DIST_VERSION}-data.tar
22 "
23
24 # https://ufoai.org/licenses/
25 LICENSE="GPL-2 GPL-3 public-domain CC-BY-3.0 CC-BY-SA-3.0 MIT"
26 SLOT="0"
27 KEYWORDS="~amd64 ~x86"
28 IUSE="+client cpu_flags_x86_sse debug server"
29 REQUIRED_USE="|| ( client server )"
30
31 RDEPEND="
32         dev-libs/mxml
33         net-misc/curl
34         sys-libs/zlib
35
36         client? (
37                 media-libs/libogg
38                 media-libs/libpng:0=
39                 media-libs/libsdl2[joystick,opengl,sound,threads,video]
40                 media-libs/libtheora
41                 media-libs/libvorbis
42                 media-libs/sdl2-mixer
43                 media-libs/sdl2-ttf
44                 media-libs/xvid
45                 virtual/jpeg:0
46                 virtual/opengl
47         )
48
49         server? (
50                 media-libs/libsdl2[threads]
51         )
52 "
53
54 DEPEND="
55         ${RDEPEND}
56         app-arch/unzip
57         sys-devel/gettext
58         virtual/pkgconfig
59 "
60
61 S="${WORKDIR}/${PN}-code-${COMMIT}"
62
63 PATCHES=(
64         "${FILESDIR}"/${P}-install.patch
65         "${FILESDIR}"/${P}-mxml3.patch
66 )
67
68 src_unpack() {
69         unpack ${PN}-code-${COMMIT}.zip
70         cd "${S}" || die
71         unpack ${PN}-${DIST_VERSION}-data.tar
72 }
73
74 src_prepare() {
75         default
76
77         # Make the build system a bit happier, will be fixed upstream
78         mkdir -p base/{maps,models} contrib/installer/mojosetup/scripts || die
79
80         # Remove bundled mxml
81         rm -r src/libs/mxml/ || die
82 }
83
84 src_configure() {
85         # Avoid noise, will be present in 2.6
86         append-cxxflags -Wno-expansion-to-defined
87
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"
90         local config=(
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
96                 --disable-paranoid
97                 --disable-memory
98                 --disable-testall
99                 --disable-ufomodel
100                 --disable-ufoslicer
101                 $(use_enable cpu_flags_x86_sse sse)
102                 $(use_enable !debug release)
103                 $(use_enable server ufoded)
104                 $(use_enable client ufo)
105                 --disable-uforadiant
106                 --disable-ufo2map
107         )
108
109         if use client || use server; then
110                 config+=( --enable-game )
111         else
112                 config+=( --disable-game )
113         fi
114
115         echo ./configure "${config[@]}"
116
117         CC=$(tc-getCC) CXX=$(tc-getCXX) \
118           ./configure "${config[@]}" || die "configure failed"
119 }
120
121 src_compile() {
122         emake all lang Q=
123 }
124
125 src_install() {
126         newicon -s 32 src/ports/linux/ufo.png ${PN}.png
127         emake install Q= DESTDIR="${D}"
128
129         if use client; then
130                 doman debian/ufo.6
131                 make_desktop_entry ufo "UFO: Alien Invasion" ${PN}
132         fi
133
134         if use server; then
135                 doman debian/ufoded.6
136                 make_desktop_entry ufoded "UFO: Alien Invasion Server" ${PN} "Game;StrategyGame" "Terminal=true"
137         fi
138 }