Gentoo Archives: gentoo-commits

From: Haelwenn Monnier <contact@×××××××××.me>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: games-emulation/dosbox-x/
Date: Tue, 02 Aug 2022 10:55:24
Message-Id: 1659399466.fb061079aed4b1b1405c38f3ec3cd47b22b8fd8c.lanodan@gentoo
1 commit: fb061079aed4b1b1405c38f3ec3cd47b22b8fd8c
2 Author: Yuan Liao <liaoyuan <AT> gmail <DOT> com>
3 AuthorDate: Tue Aug 2 00:07:25 2022 +0000
4 Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
5 CommitDate: Tue Aug 2 00:17:46 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fb061079
7
8 games-emulation/dosbox-x: Add 2022.08.0
9
10 Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com>
11
12 games-emulation/dosbox-x/Manifest | 1 +
13 games-emulation/dosbox-x/dosbox-x-2022.08.0.ebuild | 205 +++++++++++++++++++++
14 2 files changed, 206 insertions(+)
15
16 diff --git a/games-emulation/dosbox-x/Manifest b/games-emulation/dosbox-x/Manifest
17 index b6ecb3b67..8727cde70 100644
18 --- a/games-emulation/dosbox-x/Manifest
19 +++ b/games-emulation/dosbox-x/Manifest
20 @@ -1 +1,2 @@
21 DIST dosbox-x-v0.84.1.tar.gz 67617800 BLAKE2B b7a93ac662d987f99884078fa8a2b566c8aef691861cd8b8270698470cef70e352616970e46439664eedb37b11f673a3cf7d253e45ed756e28740dd06080fffc SHA512 2104352f5756fa394c6a38f6b82694e4b17878b87d64cb67aeeb8ef9f9cf12cadfc8cd23b4626bbb59b8f0657ae6747633ac80016df511b7d9612245b32d21ca
22 +DIST dosbox-x-windows-v2022.08.0.tar.gz 67809452 BLAKE2B d0d8c6b6b328b363ea939de93e920ce33b260f4f986be50028c4a2e188c292be38c256bed7b0d6e052bf2b74600ece662f05b16943e90fbd44e48e2c6b4bc3cc SHA512 d11b907ff99e8599b454dc5979055dd85a64215913cb905c66d534930ce31afaab14d04169450eef5cb286c65933159f44be6cecad6adf6c7adad1a249758d7b
23
24 diff --git a/games-emulation/dosbox-x/dosbox-x-2022.08.0.ebuild b/games-emulation/dosbox-x/dosbox-x-2022.08.0.ebuild
25 new file mode 100644
26 index 000000000..8605437e9
27 --- /dev/null
28 +++ b/games-emulation/dosbox-x/dosbox-x-2022.08.0.ebuild
29 @@ -0,0 +1,205 @@
30 +# Copyright 2022 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +inherit autotools toolchain-funcs xdg
36 +
37 +if [[ "${PV}" == 9999 ]]; then
38 + inherit git-r3
39 + EGIT_REPO_URI="https://github.com/joncampbell123/dosbox-x.git"
40 +else
41 + SRC_URI="https://github.com/joncampbell123/dosbox-x/archive/dosbox-x-windows-v${PV}.tar.gz"
42 + S="${WORKDIR}/${PN}-${PN}-windows-v${PV}"
43 + KEYWORDS="~amd64"
44 +fi
45 +
46 +DESCRIPTION="Complete, accurate DOS emulator forked from DOSBox"
47 +HOMEPAGE="https://dosbox-x.com/"
48 +
49 +# Stay consistent with games-emulation/dosbox::gentoo even though source file
50 +# headers specify the GPL version to be "either version 2 of the License, or
51 +# (at your option) any later version." The same header is used in both the
52 +# DOSBox source tree and the DOSBox-X source tree.
53 +LICENSE="GPL-2"
54 +SLOT="0"
55 +
56 +IUSE="X debug ffmpeg fluidsynth freetype opengl png slirp"
57 +
58 +BDEPEND="
59 + dev-lang/nasm
60 + sys-libs/libcap
61 +"
62 +
63 +# Unconditionally pulling in automagically-enabled optional dependencies:
64 +# - media-libs/alsa-lib
65 +# - media-libs/sdl2-net
66 +# - net-libs/libpcap
67 +#
68 +# With media-libs/libsdl2[-X,wayland], this package does work on a Wayland
69 +# desktop, but (at least on GNOME) the program does not launch in a movable
70 +# and resizable window; whereas with media-libs/libsdl2[X], it does. Thus,
71 +# unconditionally require media-libs/libsdl2[X] for better user experience.
72 +RDEPEND="
73 + media-libs/alsa-lib
74 + media-libs/libsdl2[X,opengl?,sound,threads,video]
75 + media-libs/sdl2-net
76 + net-libs/libpcap
77 + sys-libs/zlib
78 + X? (
79 + x11-libs/libX11
80 + x11-libs/libXrandr
81 + x11-libs/libxkbfile
82 + )
83 + debug? ( sys-libs/ncurses:= )
84 + ffmpeg? ( media-video/ffmpeg:= )
85 + fluidsynth? ( media-sound/fluidsynth:= )
86 + freetype? ( media-libs/freetype )
87 + opengl? ( media-libs/libglvnd[X] )
88 + png? ( media-libs/libpng:= )
89 + slirp? ( net-libs/libslirp )
90 +"
91 +
92 +DEPEND="
93 + ${RDEPEND}
94 +"
95 +
96 +pkg_pretend() {
97 + if use ffmpeg && use !png; then
98 + ewarn "Setting the 'ffmpeg' USE flag when the 'png' USE flag is"
99 + ewarn "unset does not have any effect. Unsetting the 'png' USE"
100 + ewarn "flag disables the video capture feature, so additional"
101 + ewarn "video capture formats enabled by the 'ffmpeg' USE flag"
102 + ewarn "will end up being unused."
103 + fi
104 +}
105 +
106 +src_prepare() {
107 + default
108 +
109 + # Patch command lines like the following in Makefile.am:
110 + # -test -x /usr/sbin/setcap && setcap cap_net_raw=ep $(DESTDIR)$(bindir)/dosbox-x
111 + #
112 + # The purpose of these commands is, if the 'setcap' program exists and is
113 + # executable, then invoke it to set capabilities required by the PCAP
114 + # networking back-end for better out-of-box user experience; otherwise,
115 + # ignore unsatisfied preconditions or 'setcap' errors since they are not
116 + # critical, which is achieved by having a '-' in front of each line.
117 + #
118 + # Unfortunately, 'test -x /usr/sbin/setcap' does not always work as
119 + # expected on Gentoo because it ignores the fact that some distributions,
120 + # including Gentoo, may still have split /sbin and /usr/sbin and install
121 + # 'setcap' to /sbin.
122 + #
123 + # As long as sys-libs/libcap is declared in BDEPEND of this ebuild, the
124 + # availability of 'setcap' can be assumed, rendering the test redundant.
125 + # However, successfully setting capabilities via 'setcap' usually requires
126 + # the root account (which is not guaranteed on Prefix) and xattr support
127 + # for the file system being used, so the '-' in front of each line is
128 + # preserved to tolerate the expected 'setcap' failures.
129 + sed -i -e 's|test -x /usr/sbin/setcap && ||' Makefile.am ||
130 + die "Failed to remove check for setcap in Makefile.am"
131 +
132 + eautoreconf
133 +}
134 +
135 +src_configure() {
136 + local myconf=(
137 + # --disable-core-inline could cause compiler errors
138 + # as of v2022.08.0, so enable it unconditionally
139 + --enable-core-inline
140 +
141 + # Always use SDL 2, even though the package provides the option to
142 + # build with SDL 1.x, because this package is expected to be built
143 + # with the bundled, heavily-modified version of SDL 1.x if that
144 + # branch is used. Compiler errors are likely to occur if the
145 + # bundled version of SDL 1.x is not used. Bundled dependencies
146 + # should be avoided on Gentoo, so SDL 2 is more preferable.
147 + --enable-sdl2
148 +
149 + # Explicitly enable ALSA MIDI support, same as default. As of
150 + # v2022.08.0, even when it is disabled, media-libs/alsa-lib will
151 + # still be automagically linked if it is present in the build
152 + # environment (presumably for other components of this package),
153 + # so the dependency cannot be made optional by disabling this
154 + # option. Plus, disabling this option has no observable effect
155 + # on build time, build size, or the program's functionality, as
156 + # 'mididevice=alsa' still works with '--disable-alsa-midi'.
157 + --enable-alsa-midi
158 +
159 + $(use_enable debug '' heavy)
160 +
161 + $(use_enable X x11)
162 + $(use_enable ffmpeg avcodec)
163 + $(use_enable fluidsynth libfluidsynth)
164 + $(use_enable freetype)
165 + $(use_enable opengl)
166 + $(use_enable png screenshots)
167 + $(use_enable slirp libslirp)
168 + )
169 +
170 + econf "${myconf[@]}"
171 +}
172 +
173 +src_compile() {
174 + # https://bugs.gentoo.org/856352
175 + emake AR="$(tc-getAR)"
176 +}
177 +
178 +pkg_preinst() {
179 + xdg_pkg_preinst
180 +
181 + # Returns whether or not the USE flag specified with the first positional
182 + # argument is newly enabled for this installation of the package.
183 + newuse() {
184 + local flag="${1}"
185 +
186 + # The 'has_version' call tests if any USE flags are newly enabled.
187 + # It is to extract information about any existing copy of this
188 + # package installed on the system, which is why it should be made
189 + # before the new copy of this package just built is merged.
190 + use "${flag}" && ! has_version "${CATEGORY}/${PN}[${flag}]"
191 + }
192 +
193 + newuse debug && PRINT_NOTES_FOR_DEBUGGER=1
194 + newuse fluidsynth && PRINT_NOTES_FOR_FLUIDSYNTH=1
195 +}
196 +
197 +pkg_postinst() {
198 + xdg_pkg_postinst
199 +
200 + if [[ "${PRINT_NOTES_FOR_DEBUGGER}" ]]; then
201 + elog
202 + elog "Note on the Debugger"
203 + elog
204 + elog "The debugger can only be started when DOSBox-X is launched"
205 + elog "from a terminal. Otherwise, the \"Start DOSBox-X Debugger\""
206 + elog "option in the \"Debug\" drop-down menu would be unavailable."
207 + elog
208 + elog "For more information about the debugger, please consult:"
209 + elog " ${EPREFIX}/usr/share/doc/${PF}/README.debugger*"
210 + fi
211 +
212 + if [[ "${PRINT_NOTES_FOR_FLUIDSYNTH}" ]]; then
213 + elog
214 + elog "Note on FluidSynth"
215 + elog
216 + elog "To use FluidSynth as the MIDI device for DOSBox-X, a soundfont"
217 + elog "is required. If no existing soundfont is available, a new one"
218 + elog "can be installed and configured for DOSBox-X very easily:"
219 + elog
220 + elog "1. Install the following package:"
221 + elog " media-sound/fluid-soundfont"
222 + elog "2. Add the following lines to DOSBox-X's configuration file:"
223 + elog " [midi]"
224 + elog " mididevice=fluidsynth"
225 + elog
226 + elog "Usually, there is no need to explicitly specify the soundfont"
227 + elog "file's path because the package mentioned in step 1 installs"
228 + elog "soundfont files to a standard location, allowing them to be"
229 + elog "detected and selected automatically."
230 + elog
231 + elog "For advanced FluidSynth configuration, please consult:"
232 + elog " https://dosbox-x.com/wiki/Guide%3ASetting-up-MIDI-in-DOSBox%E2%80%90X#_fluidsynth"
233 + fi
234 +}