Debian Codegraph @

contrib/gentoo/games-action/dxx-rebirth/dxx-rebirth-9999.ebuild

raw
1 # Copyright 2017-2020 Rebirth contributors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # This file is part of the DXX-Rebirth project.
5 #
6 # It is copyright by its individual contributors, as recorded in the
7 # project's Git history. See COPYING.txt at the top level for license
8 # terms and a link to the Git history.
9
10 EAPI=8
11 DESCRIPTION="Descent Rebirth - enhanced Descent 1 & 2 engine"
12
13 # Python is only used to execute SCons. It is not used by any of the installed
14 # components.
15 PYTHON_COMPAT=( python3_11 python3_12 )
16
17 inherit desktop eutils python-any-r1 scons-utils toolchain-funcs xdg
18 if [[ "$PV" = 9999 ]]; then
19 inherit git-r3
20 EGIT_REPO_URI="https://github.com/dxx-rebirth/dxx-rebirth"
21 # Live ebuilds have blank keywords.
22 KEYWORDS=
23 else
24 MY_COMMIT=''
25 S="$WORKDIR/$PN-$MY_COMMIT"
26 SRC_URI="https://codeload.github.com/dxx-rebirth/dxx-rebirth/tar.gz/$MY_COMMIT -> $PN-$PVR.tar.gz"
27 unset MY_COMMIT
28
29 # Other architectures are reported to work, but not tested regularly by
30 # the core team.
31 #
32 # Raspberry Pi support is tested by an outside contributor, and his
33 # fixes are merged into the main source by upstream.
34 #
35 # Cross-compilation to Windows is also supported.
36 KEYWORDS="~amd64 ~x86"
37
38 # Restriction only for use in private overlays. When this is added to a
39 # public tree, post the sources to a mirror and remove this restriction.
40 RESTRICT='mirror'
41 fi
42
43 HOMEPAGE="https://www.dxx-rebirth.com/"
44
45 LICENSE="DXX-Rebirth GPL-3"
46 SLOT="0"
47
48 # Default to building both game engines. The total size is relatively
49 # small.
50 IUSE="+d1x +d2x +data debug editor +flac ipv6 +joystick l10n_de +midi +mp3 +music +opengl opl3-musicpack +png sc55-musicpack sdl2 tracker valgrind +vorbis"
51
52 # Game data is stored in HOG files.
53 # Game movies are in MVL files.
54 # Various add-ons use zip files to bundle their content together.
55 #
56 # PNG support enables writing screenshots as PNG instead of TGA (for
57 # USE=opengl) or PCX (for USE=-opengl).
58 DEPEND=">=dev-games/physfs-3[hog,mvl,zip]
59 opengl? (
60 virtual/opengl
61 virtual/glu )
62 png? ( media-libs/libpng )
63 "
64
65 # As of this writing, there is no Portage shorthand syntax to express:
66 # "
67 # flag1? ( package[flag1] )
68 # flag2? ( package[flag2] )
69 # ...
70 # flagN? ( package[flagN] )
71 # ", such that unsetting all flags removes the dependency on package.
72 # Fake it by using a text fragment that is repeatedly expanded with
73 # differing substitutions.
74 #
75 # The use of single quotes is intentional here. The ${word} is a
76 # placeholder to be matched by text substitution when the fragment is
77 # expanded, not a shell variable reference.
78 #
79 # For each flag, depend on freedata using the same flag. If none of the
80 # flags are set, freedata is not needed.
81 DXX_RDEPEND_USE_FREEDATA_FRAGMENT='
82 ${USE}? ( games-action/descent${ENGINE}-freedata[${USE}] )
83 '
84 # If USE=data, then require a game data package.
85 # The build process does not use the game data, nor change how the game
86 # is built based on what game data will be used. At startup, the game
87 # will search for both types of game data and use what it finds. Users
88 # can switch between shareware/retail data at any time by
89 # adding/removing the appropriate data packages. A rebuild is _not_
90 # required after swapping the data files.
91 #
92 # USE-depend on freedata for various extras, but only if any of those
93 # extras are enabled.
94 DXX_RDEPEND_ENGINE_FRAGMENT='
95 d${ENGINE}x? (
96 data? (
97 || (
98 games-action/descent${ENGINE}-data
99 games-action/descent${ENGINE}-demodata
100 )
101 )
102 '"
103 ${DXX_RDEPEND_USE_FREEDATA_FRAGMENT//\$\{USE\}/l10n_de}
104 ${DXX_RDEPEND_USE_FREEDATA_FRAGMENT//\$\{USE\}/opl3-musicpack}
105 ${DXX_RDEPEND_USE_FREEDATA_FRAGMENT//\$\{USE\}/sc55-musicpack}
106 "'
107 )
108 '
109
110 DXX_DEPEND_USE_SDL_VERSION_FRAGMENT='
111 media-libs/lib${SDL_version}[joystick?,opengl?,sound,video]
112 media-libs/${SDL_version}-image
113 music? ( media-libs/${SDL_version}-mixer )
114 '
115 DXX_RDEPEND_USE_SDL_VERSION_FRAGMENT='
116 music? ( media-libs/${SDL_version}-mixer[flac?,midi?,mp3?,vorbis?] )
117 '
118 DEPEND="${DEPEND}
119 !sdl2? ( ${DXX_DEPEND_USE_SDL_VERSION_FRAGMENT//\$\{SDL_version\}/sdl} )
120 sdl2? ( ${DXX_DEPEND_USE_SDL_VERSION_FRAGMENT//\$\{SDL_version\}/sdl2} )
121 "
122 unset DXX_DEPEND_USE_SDL_VERSION_FRAGMENT
123
124 unset DXX_RDEPEND_USE_FREEDATA_FRAGMENT
125 RDEPEND="${DEPEND}
126 !sdl2? ( ${DXX_RDEPEND_USE_SDL_VERSION_FRAGMENT//\$\{SDL_version\}/sdl} )
127 sdl2? ( ${DXX_RDEPEND_USE_SDL_VERSION_FRAGMENT//\$\{SDL_version\}/sdl2} )
128 ${DXX_RDEPEND_ENGINE_FRAGMENT//\$\{ENGINE\}/1}
129 ${DXX_RDEPEND_ENGINE_FRAGMENT//\$\{ENGINE\}/2}
130 "
131 unset DXX_RDEPEND_ENGINE_FRAGMENT
132 unset DXX_RDEPEND_USE_SDL_VERSION_FRAGMENT
133 # USE=valgrind enables use of a Valgrind header. A build with valgrind
134 # instrumentation can be run without installing Valgrind, so this
135 # dependency is only in DEPEND, instead of being in both DEPEND and
136 # RDEPEND.
137 DEPEND+='
138 valgrind? ( dev-debug/valgrind )
139 '
140
141 # This ebuild builds d1x-rebirth, d2x-rebirth, or both. Building none
142 # would mean this ebuild installs zero files.
143 #
144 # For each of the supported music flags, require USE=music, so that the
145 # package is built with sdl-mixer support. Individual music types can be
146 # changed without a Rebirth rebuild by rebuilding sdl-mixer with
147 # appropriate support, but Rebirth must have sdl-mixer support at build
148 # time in order to support any of these music formats at runtime.
149 #
150 # All music files in the optional musicpack downloads are .ogg, so
151 # require USE=vorbis if those packs are enabled.
152 REQUIRED_USE='
153 || ( d1x d2x )
154 flac? ( music )
155 midi? ( music )
156 mp3? ( music )
157 vorbis? ( music )
158 opl3-musicpack? ( vorbis )
159 sc55-musicpack? ( vorbis )
160 sdl2? ( opengl )
161 '
162
163 # As of this writing, IUSE_RUNTIME is a GLEP, but not an implemented
164 # feature. This variable is stored here to be ready to activate when
165 # Portage implements this feature.
166 #
167 # Note that while individual music formats can be switched without a
168 # rebuild, the master flag USE=music controls whether sdl-mixer is used,
169 # and therefore requires a rebuild when changed.
170 #IUSE_RUNTIME="flac l10n_de midi mp3 opl3-musicpack sc55-musicpack vorbis"
171
172 dxx_scons() {
173 # Always build profile `m`. If use editor, also build profile `e`.
174 # Set most variables in the default anonymous profile. Only
175 # `builddir` and `editor` are set in the named profiles, since those
176 # must be different between the two builds.
177 #
178 # Notes for end users:
179 # - Per-engine options can be set with an engine prefix, as shown
180 # for sharepath. Such options are used in place of
181 # engine-unqualified options. For example, to disable sdlmixer
182 # for Descent 2: Rebirth, but use the setting below for Descent 1:
183 # Rebirth, set EXTRA_ESCONS="d2x_sdlmixer=0".
184 # - Profile `site` is searched before the anonymous profile, and is
185 # deliberately unused in this ebuild. Set options in the site
186 # profile to affect both engines:
187 # EXTRA_ESCONS="site_verbosebuild=0".
188 local scons_build_profile=m mysconsargs=(
189 sdl2=$(usex sdl2 1 0)
190 sdlmixer=$(usex music 1 0)
191 verbosebuild=1
192 debug=$(usex debug 1 0)
193 ipv6=$(usex ipv6 1 0)
194 opengl=$(usex opengl 1 0)
195 use_tracker=$(usex tracker 1 0)
196 prefix="${EPREFIX}"/usr
197 screenshot=$(usex png png legacy)
198 m_builddir=build/main/
199 m_editor=0
200 )
201 if use editor; then
202 scons_build_profile+=+e
203 mysconsargs+=( \
204 e_builddir=build/editor/
205 e_editor=1
206 )
207 fi
208 if ! use joystick; then
209 mysconsargs+=( \
210 max_joysticks=0
211 )
212 fi
213 # Add sharepath and enable build of selected games. The trailing
214 # comma after `$scons_build_profile` is required to cause scons to
215 # search the anonymous profile. If omitted, only settings from the
216 # named profile would be used.
217 use d1x && mysconsargs+=( d1x_sharepath="/usr/share/games/d1x" d1x="$scons_build_profile,site," )
218 use d2x && mysconsargs+=( d2x_sharepath="/usr/share/games/d2x" d2x="$scons_build_profile,site," )
219 use valgrind && mysconsargs+=( poison=valgrind )
220 escons "${mysconsargs[@]}" "$@"
221 }
222
223 src_compile() {
224 tc-export CXX PKG_CONFIG
225 dxx_scons register_install_target=0 build
226 }
227
228 src_install() {
229 # Use upstream install target to handle the various combinations of
230 # enabled/disabled engines and optional editor support.
231 dxx_scons register_compile_target=0 register_install_target=1 --install-sandbox="$D" "$D"
232 local DV
233 for DV in 1 2; do
234 if ! use d${DV}x; then
235 continue
236 fi
237 local PROGRAM=d${DV}x-rebirth
238 docinto "${PROGRAM}"
239 dodoc "${PROGRAM}"/*.txt
240 make_desktop_entry "${PROGRAM}" "Descent ${DV} Rebirth" "${PROGRAM}"
241 doicon "${PROGRAM}/${PROGRAM}.xpm"
242 done
243 }
244
245 pkg_postinst() {
246 xdg_pkg_postinst
247 if ! use data; then
248 elog "$PN requires game data to play."
249 elog "Game data is not included in this package. To play the game,"
250 elog "emerge the packages required by USE=data or install the game"
251 elog "data by hand."
252 elog
253 elog "Changing USE=data does not change how this package is built,"
254 elog "only its runtime dependencies."
255 fi
256 }