f6844ab0cf13013aef9e8a99e999eada430d633b
[gentoo.git] / games-fps / gzdoom / gzdoom-4.2.4.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake desktop xdg
7
8 DESCRIPTION="A modder-friendly OpenGL source port based on the DOOM engine"
9 HOMEPAGE="https://zdoom.org"
10 SRC_URI="https://github.com/coelckers/${PN}/archive/g${PV}.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="BSD BZIP2 DUMB-0.9.3 GPL-3 LGPL-3 MIT
13         nonfree? ( Activision ChexQuest3 DOOM-COLLECTORS-EDITION freedist )"
14 SLOT="0"
15 KEYWORDS="~amd64 ~arm ~x86"
16 IUSE="gtk gtk2 +nonfree openmp"
17
18 DEPEND="
19         media-libs/libsdl2[opengl]
20         media-libs/libsndfile
21         media-libs/openal
22         media-sound/fluidsynth:=
23         media-sound/mpg123
24         sys-libs/zlib
25         virtual/jpeg:0
26         gtk? (
27                 gtk2? ( x11-libs/gtk+:2 )
28                 !gtk2? ( x11-libs/gtk+:3 )
29         )"
30 RDEPEND="${DEPEND}"
31
32 S="${WORKDIR}/${PN}-g${PV}"
33
34 PATCHES=(
35         "${FILESDIR}/${PN}-4.2.1-install_soundfonts.patch"
36         "${FILESDIR}/${PN}-4.2.1-Introduce-the-BUILD_NONFREE-option.patch"
37 )
38
39 src_prepare() {
40         rm -rf docs/licenses || die
41         if ! use nonfree ; then
42                 rm -rf wadsrc_bm wadsrc_extra || die
43         fi
44
45         cmake_src_prepare
46 }
47
48 src_configure() {
49         local mycmakeargs=(
50                 -DINSTALL_DOCS_PATH="${EPREFIX}/usr/share/doc/${PF}"
51                 -DINSTALL_PK3_PATH="${EPREFIX}/usr/share/doom"
52                 -DINSTALL_SOUNDFONT_PATH="${EPREFIX}/usr/share/doom"
53                 -DDYN_FLUIDSYNTH=OFF
54                 -DDYN_OPENAL=OFF
55                 -DDYN_SNDFILE=OFF
56                 -DDYN_MPG123=OFF
57                 -DNO_GTK="$(usex !gtk)"
58                 -DNO_OPENAL=OFF
59                 -DNO_OPENMP="$(usex !openmp)"
60                 -DBUILD_NONFREE="$(usex nonfree)"
61         )
62         cmake_src_configure
63 }
64
65 src_install() {
66         newicon src/posix/zdoom.xpm "${PN}.xpm"
67         make_desktop_entry "${PN}" "GZDoom" "${PN}" "Game;ActionGame"
68         cmake_src_install
69 }
70
71 pkg_postinst() {
72         xdg_pkg_postinst
73
74         if ! use nonfree ; then
75                 ewarn
76                 ewarn "GZDoom installed without nonfree components."
77                 ewarn "Note: The nonfree game_support.pk3 file is needed to play"
78                 ewarn "      games natively supported by GZDoom."
79                 ewarn "A list of games natively supported by GZDoom is available"
80                 ewarn "on the ZDoom wiki: https://zdoom.org/wiki/IWAD"
81                 ewarn
82         fi
83 }