commit: 6d87785bf263bc9fcd0c8e984dc8b97a48edfd8a Author: Yuan Liao <liaoyuan <AT> gmail <DOT> com> AuthorDate: Sat Jul 2 22:19:18 2022 +0000 Commit: Yuan Liao <liaoyuan <AT> gmail <DOT> com> CommitDate: Sat Jul 2 22:19:18 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6d87785b
games-emulation/dosbox-x: New package added at 0.84.1, 9999 Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com> games-emulation/dosbox-x/Manifest | 1 + games-emulation/dosbox-x/dosbox-x-0.84.1.ebuild | 205 +++++++++++++++++++++ games-emulation/dosbox-x/dosbox-x-9999.ebuild | 200 ++++++++++++++++++++ ...x-0.84.1-fix-build-error-with-disable-x11.patch | 43 +++++ games-emulation/dosbox-x/metadata.xml | 58 ++++++ 5 files changed, 507 insertions(+) diff --git a/games-emulation/dosbox-x/Manifest b/games-emulation/dosbox-x/Manifest new file mode 100644 index 000000000..b6ecb3b67 --- /dev/null +++ b/games-emulation/dosbox-x/Manifest @@ -0,0 +1 @@ +DIST dosbox-x-v0.84.1.tar.gz 67617800 BLAKE2B b7a93ac662d987f99884078fa8a2b566c8aef691861cd8b8270698470cef70e352616970e46439664eedb37b11f673a3cf7d253e45ed756e28740dd06080fffc SHA512 2104352f5756fa394c6a38f6b82694e4b17878b87d64cb67aeeb8ef9f9cf12cadfc8cd23b4626bbb59b8f0657ae6747633ac80016df511b7d9612245b32d21ca diff --git a/games-emulation/dosbox-x/dosbox-x-0.84.1.ebuild b/games-emulation/dosbox-x/dosbox-x-0.84.1.ebuild new file mode 100644 index 000000000..9db968900 --- /dev/null +++ b/games-emulation/dosbox-x/dosbox-x-0.84.1.ebuild @@ -0,0 +1,205 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools xdg + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/joncampbell123/dosbox-x.git" +else + SRC_URI="https://github.com/joncampbell123/dosbox-x/archive/dosbox-x-v${PV}.tar.gz" + S="${WORKDIR}/${PN}-${PN}-v${PV}" + KEYWORDS="~amd64" +fi + +DESCRIPTION="Complete, accurate DOS emulator forked from DOSBox" +HOMEPAGE="https://dosbox-x.com/" + +# Stay consistent with games-emulation/dosbox::gentoo even though source file +# headers specify the GPL version to be "either version 2 of the License, or +# (at your option) any later version." The same header is used in both the +# DOSBox source tree and the DOSBox-X source tree. +LICENSE="GPL-2" +SLOT="0" + +IUSE="X debug ffmpeg fluidsynth freetype opengl png slirp" + +BDEPEND=" + dev-lang/nasm + sys-libs/libcap +" + +# Unconditionally pulling in automagically-enabled optional dependencies: +# - media-libs/alsa-lib +# - media-libs/sdl2-net +# - net-libs/libpcap +# +# With media-libs/libsdl2[-X,wayland], this package does work on a Wayland +# desktop, but (at least on GNOME) the program does not launch in a movable +# and resizable window; whereas with media-libs/libsdl2[X], it does. Thus, +# unconditionally require media-libs/libsdl2[X] for better user experience. +RDEPEND=" + media-libs/alsa-lib + media-libs/libsdl2[X,opengl?,sound,threads,video] + media-libs/sdl2-net + net-libs/libpcap + sys-libs/zlib + X? ( + x11-libs/libX11 + x11-libs/libXrandr + x11-libs/libxkbfile + ) + debug? ( sys-libs/ncurses:= ) + ffmpeg? ( media-video/ffmpeg:= ) + fluidsynth? ( media-sound/fluidsynth:= ) + freetype? ( media-libs/freetype ) + opengl? ( media-libs/libglvnd[X] ) + png? ( media-libs/libpng:= ) + slirp? ( net-libs/libslirp ) +" + +DEPEND=" + ${RDEPEND} +" + +PATCHES=( + # Only needed on 0.84.1; please remove for newer releases + "${FILESDIR}/${P}-fix-build-error-with-disable-x11.patch" +) + +pkg_pretend() { + if use ffmpeg && use !png; then + ewarn "Setting the 'ffmpeg' USE flag when the 'png' USE flag is" + ewarn "unset does not have any effect. Unsetting the 'png' USE" + ewarn "flag disables the video capture feature, so additional" + ewarn "video capture formats enabled by the 'ffmpeg' USE flag" + ewarn "will end up being unused." + fi +} + +src_prepare() { + default + + # Patch command lines like the following in Makefile.am: + # -test -x /usr/sbin/setcap && setcap cap_net_raw=ep $(DESTDIR)$(bindir)/dosbox-x + # + # The purpose of these commands is, if the 'setcap' program exists and is + # executable, then invoke it to set capabilities required by the PCAP + # networking back-end for better out-of-box user experience; otherwise, + # ignore unsatisfied preconditions or 'setcap' errors since they are not + # critical, which is achieved by having a '-' in front of each line. + # + # Unfortunately, 'test -x /usr/sbin/setcap' does not always work as + # expected on Gentoo because it ignores the fact that some distributions, + # including Gentoo, may still have split /sbin and /usr/sbin and install + # 'setcap' to /sbin. + # + # As long as sys-libs/libcap is declared in BDEPEND of this ebuild, the + # availability of 'setcap' can be assumed, rendering the test redundant. + # However, successfully setting capabilities via 'setcap' usually requires + # the root account (which is not guaranteed on Prefix) and xattr support + # for the file system being used, so the '-' in front of each line is + # preserved to tolerate the expected 'setcap' failures. + sed -i -e 's|test -x /usr/sbin/setcap && ||' Makefile.am || + die "Failed to remove check for setcap in Makefile.am" + + eautoreconf +} + +src_configure() { + local myconf=( + # --disable-core-inline could cause compiler errors + # as of v0.84.1, so enable it unconditionally + --enable-core-inline + + # Always use SDL 2, even though the package provides the option to + # build with SDL 1.x, because this package is expected to be built + # with the bundled, heavily-modified version of SDL 1.x if that + # branch is used. Compiler errors are likely to occur if the + # bundled version of SDL 1.x is not used. Bundled dependencies + # should be avoided on Gentoo, so SDL 2 is more preferable. + --enable-sdl2 + + # Explicitly enable ALSA MIDI support, same as default. As of + # v0.84.1, even when it is disabled, media-libs/alsa-lib will + # still be automagically linked if it is present in the build + # environment (presumably for other components of this package), + # so the dependency cannot be made optional by disabling this + # option. Plus, disabling this option has no observable effect + # on build time, build size, or the program's functionality, as + # 'mididevice=alsa' still works with '--disable-alsa-midi'. + --enable-alsa-midi + + $(use_enable debug '' heavy) + + $(use_enable X x11) + $(use_enable ffmpeg avcodec) + $(use_enable fluidsynth libfluidsynth) + $(use_enable freetype) + $(use_enable opengl) + $(use_enable png screenshots) + $(use_enable slirp libslirp) + ) + + econf "${myconf[@]}" +} + +pkg_preinst() { + xdg_pkg_preinst + + # Returns whether or not the USE flag specified with the first positional + # argument is newly enabled for this installation of the package. + newuse() { + local flag="${1}" + + # The 'has_version' call tests if any USE flags are newly enabled. + # It is to extract information about any existing copy of this + # package installed on the system, which is why it should be made + # before the new copy of this package just built is merged. + use "${flag}" && ! has_version "${CATEGORY}/${PN}[${flag}]" + } + + newuse debug && PRINT_NOTES_FOR_DEBUGGER=1 + newuse fluidsynth && PRINT_NOTES_FOR_FLUIDSYNTH=1 +} + +pkg_postinst() { + xdg_pkg_postinst + + if [[ "${PRINT_NOTES_FOR_DEBUGGER}" ]]; then + elog + elog "Note on the Debugger" + elog + elog "The debugger can only be started when DOSBox-X is launched" + elog "from a terminal. Otherwise, the \"Start DOSBox-X Debugger\"" + elog "option in the \"Debug\" drop-down menu would be unavailable." + elog + elog "For more information about the debugger, please consult:" + elog " ${EPREFIX}/usr/share/doc/${PF}/README.debugger*" + fi + + if [[ "${PRINT_NOTES_FOR_FLUIDSYNTH}" ]]; then + elog + elog "Note on FluidSynth" + elog + elog "To use FluidSynth as the MIDI device for DOSBox-X, a soundfont" + elog "is required. If no existing soundfont is available, a new one" + elog "can be installed and configured for DOSBox-X very easily:" + elog + elog "1. Install the following package:" + elog " media-sound/fluid-soundfont" + elog "2. Add the following lines to DOSBox-X's configuration file:" + elog " [midi]" + elog " mididevice=fluidsynth" + elog + elog "Usually, there is no need to explicitly specify the soundfont" + elog "file's path because the package mentioned in step 1 installs" + elog "soundfont files to a standard location, allowing them to be" + elog "detected and selected automatically." + elog + elog "For advanced FluidSynth configuration, please consult:" + elog " https://dosbox-x.com/wiki/Guide%3ASetting-up-MIDI-in-DOSBox%E2%80%90X#_fluidsynth" + fi +} diff --git a/games-emulation/dosbox-x/dosbox-x-9999.ebuild b/games-emulation/dosbox-x/dosbox-x-9999.ebuild new file mode 100644 index 000000000..f2da3a0e0 --- /dev/null +++ b/games-emulation/dosbox-x/dosbox-x-9999.ebuild @@ -0,0 +1,200 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools xdg + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/joncampbell123/dosbox-x.git" +else + SRC_URI="https://github.com/joncampbell123/dosbox-x/archive/dosbox-x-v${PV}.tar.gz" + S="${WORKDIR}/${PN}-${PN}-v${PV}" + KEYWORDS="~amd64" +fi + +DESCRIPTION="Complete, accurate DOS emulator forked from DOSBox" +HOMEPAGE="https://dosbox-x.com/" + +# Stay consistent with games-emulation/dosbox::gentoo even though source file +# headers specify the GPL version to be "either version 2 of the License, or +# (at your option) any later version." The same header is used in both the +# DOSBox source tree and the DOSBox-X source tree. +LICENSE="GPL-2" +SLOT="0" + +IUSE="X debug ffmpeg fluidsynth freetype opengl png slirp" + +BDEPEND=" + dev-lang/nasm + sys-libs/libcap +" + +# Unconditionally pulling in automagically-enabled optional dependencies: +# - media-libs/alsa-lib +# - media-libs/sdl2-net +# - net-libs/libpcap +# +# With media-libs/libsdl2[-X,wayland], this package does work on a Wayland +# desktop, but (at least on GNOME) the program does not launch in a movable +# and resizable window; whereas with media-libs/libsdl2[X], it does. Thus, +# unconditionally require media-libs/libsdl2[X] for better user experience. +RDEPEND=" + media-libs/alsa-lib + media-libs/libsdl2[X,opengl?,sound,threads,video] + media-libs/sdl2-net + net-libs/libpcap + sys-libs/zlib + X? ( + x11-libs/libX11 + x11-libs/libXrandr + x11-libs/libxkbfile + ) + debug? ( sys-libs/ncurses:= ) + ffmpeg? ( media-video/ffmpeg:= ) + fluidsynth? ( media-sound/fluidsynth:= ) + freetype? ( media-libs/freetype ) + opengl? ( media-libs/libglvnd[X] ) + png? ( media-libs/libpng:= ) + slirp? ( net-libs/libslirp ) +" + +DEPEND=" + ${RDEPEND} +" + +pkg_pretend() { + if use ffmpeg && use !png; then + ewarn "Setting the 'ffmpeg' USE flag when the 'png' USE flag is" + ewarn "unset does not have any effect. Unsetting the 'png' USE" + ewarn "flag disables the video capture feature, so additional" + ewarn "video capture formats enabled by the 'ffmpeg' USE flag" + ewarn "will end up being unused." + fi +} + +src_prepare() { + default + + # Patch command lines like the following in Makefile.am: + # -test -x /usr/sbin/setcap && setcap cap_net_raw=ep $(DESTDIR)$(bindir)/dosbox-x + # + # The purpose of these commands is, if the 'setcap' program exists and is + # executable, then invoke it to set capabilities required by the PCAP + # networking back-end for better out-of-box user experience; otherwise, + # ignore unsatisfied preconditions or 'setcap' errors since they are not + # critical, which is achieved by having a '-' in front of each line. + # + # Unfortunately, 'test -x /usr/sbin/setcap' does not always work as + # expected on Gentoo because it ignores the fact that some distributions, + # including Gentoo, may still have split /sbin and /usr/sbin and install + # 'setcap' to /sbin. + # + # As long as sys-libs/libcap is declared in BDEPEND of this ebuild, the + # availability of 'setcap' can be assumed, rendering the test redundant. + # However, successfully setting capabilities via 'setcap' usually requires + # the root account (which is not guaranteed on Prefix) and xattr support + # for the file system being used, so the '-' in front of each line is + # preserved to tolerate the expected 'setcap' failures. + sed -i -e 's|test -x /usr/sbin/setcap && ||' Makefile.am || + die "Failed to remove check for setcap in Makefile.am" + + eautoreconf +} + +src_configure() { + local myconf=( + # --disable-core-inline could cause compiler errors + # as of v0.84.1, so enable it unconditionally + --enable-core-inline + + # Always use SDL 2, even though the package provides the option to + # build with SDL 1.x, because this package is expected to be built + # with the bundled, heavily-modified version of SDL 1.x if that + # branch is used. Compiler errors are likely to occur if the + # bundled version of SDL 1.x is not used. Bundled dependencies + # should be avoided on Gentoo, so SDL 2 is more preferable. + --enable-sdl2 + + # Explicitly enable ALSA MIDI support, same as default. As of + # v0.84.1, even when it is disabled, media-libs/alsa-lib will + # still be automagically linked if it is present in the build + # environment (presumably for other components of this package), + # so the dependency cannot be made optional by disabling this + # option. Plus, disabling this option has no observable effect + # on build time, build size, or the program's functionality, as + # 'mididevice=alsa' still works with '--disable-alsa-midi'. + --enable-alsa-midi + + $(use_enable debug '' heavy) + + $(use_enable X x11) + $(use_enable ffmpeg avcodec) + $(use_enable fluidsynth libfluidsynth) + $(use_enable freetype) + $(use_enable opengl) + $(use_enable png screenshots) + $(use_enable slirp libslirp) + ) + + econf "${myconf[@]}" +} + +pkg_preinst() { + xdg_pkg_preinst + + # Returns whether or not the USE flag specified with the first positional + # argument is newly enabled for this installation of the package. + newuse() { + local flag="${1}" + + # The 'has_version' call tests if any USE flags are newly enabled. + # It is to extract information about any existing copy of this + # package installed on the system, which is why it should be made + # before the new copy of this package just built is merged. + use "${flag}" && ! has_version "${CATEGORY}/${PN}[${flag}]" + } + + newuse debug && PRINT_NOTES_FOR_DEBUGGER=1 + newuse fluidsynth && PRINT_NOTES_FOR_FLUIDSYNTH=1 +} + +pkg_postinst() { + xdg_pkg_postinst + + if [[ "${PRINT_NOTES_FOR_DEBUGGER}" ]]; then + elog + elog "Note on the Debugger" + elog + elog "The debugger can only be started when DOSBox-X is launched" + elog "from a terminal. Otherwise, the \"Start DOSBox-X Debugger\"" + elog "option in the \"Debug\" drop-down menu would be unavailable." + elog + elog "For more information about the debugger, please consult:" + elog " ${EPREFIX}/usr/share/doc/${PF}/README.debugger*" + fi + + if [[ "${PRINT_NOTES_FOR_FLUIDSYNTH}" ]]; then + elog + elog "Note on FluidSynth" + elog + elog "To use FluidSynth as the MIDI device for DOSBox-X, a soundfont" + elog "is required. If no existing soundfont is available, a new one" + elog "can be installed and configured for DOSBox-X very easily:" + elog + elog "1. Install the following package:" + elog " media-sound/fluid-soundfont" + elog "2. Add the following lines to DOSBox-X's configuration file:" + elog " [midi]" + elog " mididevice=fluidsynth" + elog + elog "Usually, there is no need to explicitly specify the soundfont" + elog "file's path because the package mentioned in step 1 installs" + elog "soundfont files to a standard location, allowing them to be" + elog "detected and selected automatically." + elog + elog "For advanced FluidSynth configuration, please consult:" + elog " https://dosbox-x.com/wiki/Guide%3ASetting-up-MIDI-in-DOSBox%E2%80%90X#_fluidsynth" + fi +} diff --git a/games-emulation/dosbox-x/files/dosbox-x-0.84.1-fix-build-error-with-disable-x11.patch b/games-emulation/dosbox-x/files/dosbox-x-0.84.1-fix-build-error-with-disable-x11.patch new file mode 100644 index 000000000..dd5ed658d --- /dev/null +++ b/games-emulation/dosbox-x/files/dosbox-x-0.84.1-fix-build-error-with-disable-x11.patch @@ -0,0 +1,43 @@ +Staged upstream change after the v0.84.1 release; only needed on 0.84.1 +to support the '--disable-x11' configuration option and thus USE='-X'. + +Closes: https://github.com/joncampbell123/dosbox-x/issues/3602 + +From 07e51e044acbe05c3e4ebb6c54b67575a811ae09 Mon Sep 17 00:00:00 2001 +From: Wengier <wengie...@yahoo.com> +Date: Fri, 1 Jul 2022 18:12:17 -0400 +Subject: [PATCH] update + +--- + src/gui/sdlmain_linux.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/gui/sdlmain_linux.cpp b/src/gui/sdlmain_linux.cpp +index 94dd1875f..b22e987a8 100644 +--- a/src/gui/sdlmain_linux.cpp ++++ b/src/gui/sdlmain_linux.cpp +@@ -16,10 +16,6 @@ + # if C_X11_EXT_XKBRULES + # include <X11/extensions/XKBrules.h> + # endif +-#endif +- +-void UpdateWindowDimensions(Bitu width, Bitu height); +-void UpdateWindowMaximized(bool flag); + + /* X11 Error handler. + * Apparently it is possible with SDL2 to resize the window in such a way that +@@ -49,6 +45,10 @@ int X11_ErrorHandler(Display *disp,XErrorEvent *xev) { + void X11_ErrorHandlerInstall(void) { + XSetErrorHandler(X11_ErrorHandler); + } ++#endif ++ ++void UpdateWindowDimensions(Bitu width, Bitu height); ++void UpdateWindowMaximized(bool flag); + + #if C_X11_XRANDR + #include <X11/extensions/Xrandr.h> +-- +2.35.1 + diff --git a/games-emulation/dosbox-x/metadata.xml b/games-emulation/dosbox-x/metadata.xml new file mode 100644 index 000000000..cdbdb12b1 --- /dev/null +++ b/games-emulation/dosbox-x/metadata.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>liaoy...@gmail.com</email> + <name>Yuan Liao</name> + </maintainer> + <longdescription> + DOSBox-X is a fork of DOSBox. The main focus of DOSBox is just on + running DOS games, whereas DOSBox-X goes further than this: while it + "retains compatibility with the wide base of DOS games and DOS gaming + DOSBox was designed for", it is built to also run DOS applications, + Windows 3.x, Windows 9x series, and software written for those versions + of Windows. In particular, Windows 98 runs with superb stability on + DOSBox-X, which DOSBox cannot achieve yet. + + DOSBox-X also ships more user-friendly features than DOSBox, including + a drop-down menu system for easier alteration to emulation parameters + and access to the emulator's functions, a graphical configuration tool + for modifying the configuration file, saving and loading the emulator's + state, creation of new disk image files, support for directly mounting + hard disk images with partitions formatted with the FAT32 file system, + and many more. + </longdescription> + <upstream> + <doc>https://dosbox-x.com/wiki/</doc> + <remote-id type="github">joncampbell123/dosbox-x</remote-id> + </upstream> + <use> + <flag name="X"> + Enable X11 integration for better fullscreening functionality + </flag> + <flag name="debug"> + Enable the internal debugger of this program + </flag> + <flag name="ffmpeg"> + Enable MPEG.TS + H.264 video capture format support + via <pkg>media-video/ffmpeg</pkg> + </flag> + <flag name="fluidsynth"> + Enable FluidSynth to be used as the MIDI synthesizer + </flag> + <flag name="freetype"> + Enable TrueType font (TTF) output and printing support + via <pkg>media-libs/freetype</pkg> + </flag> + <flag name="opengl"> + Enable OpenGL as a video system to use for output + </flag> + <flag name="png"> + Enable screenshot and video capture support + via <pkg>media-libs/libpng</pkg> + </flag> + <flag name="slirp"> + Enable the SLIRP back-end for network adapter emulation + </flag> + </use> +</pkgmetadata>