games-emulation/dosbox: fix for xorg 1.20 issue
authorAzamat H. Hackimov <azamat.hackimov@gmail.com>
Sat, 5 Jan 2019 18:11:13 +0000 (21:11 +0300)
committerJames Le Cuirot <chewi@gentoo.org>
Sat, 5 Jan 2019 19:43:35 +0000 (19:43 +0000)
* Added patch for xorg 1.20 issue
(https://sourceforge.net/p/dosbox/code-0/4177/).
* Changed HOMEPAGE

Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Closes: https://github.com/gentoo/gentoo/pull/10747
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
games-emulation/dosbox/dosbox-0.74_p20160629-r3.ebuild [new file with mode: 0644]
games-emulation/dosbox/dosbox-9999.ebuild
games-emulation/dosbox/files/dosbox-0.74.2_events.patch [new file with mode: 0644]

diff --git a/games-emulation/dosbox/dosbox-0.74_p20160629-r3.ebuild b/games-emulation/dosbox/dosbox-0.74_p20160629-r3.ebuild
new file mode 100644 (file)
index 0000000..140ff29
--- /dev/null
@@ -0,0 +1,75 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools desktop flag-o-matic
+
+PATCH=3989
+GLIDE_PATCH=3722fc563b737d2d7933df6a771651c2154e6f7b
+
+DESCRIPTION="DOS emulator"
+HOMEPAGE="https://www.dosbox.com/"
+SRC_URI="mirror://gentoo/dosbox-code-0-${PATCH}-dosbox-trunk.zip
+       glide? ( https://raw.githubusercontent.com/voyageur/openglide/${GLIDE_PATCH}/platform/dosbox/dosbox_glide.diff -> dosbox_glide-${GLIDE_PATCH}.diff )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc64 ~x86"
+IUSE="alsa +core-inline debug glide hardened opengl X"
+
+RDEPEND="alsa? ( media-libs/alsa-lib )
+       glide? ( media-libs/openglide )
+       opengl? ( virtual/glu virtual/opengl )
+       debug? ( sys-libs/ncurses:0 )
+       X? ( x11-libs/libX11 )
+       media-libs/libpng:0=
+       media-libs/libsdl[joystick,opengl?,video,X?]
+       media-libs/sdl-net
+       media-libs/sdl-sound
+       sys-libs/zlib"
+DEPEND="${RDEPEND}
+       app-arch/unzip"
+
+S=${WORKDIR}/${PN}-code-0-${PATCH}-dosbox-trunk
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.74-gcc46.patch"
+       "${FILESDIR}/${PN}-0.74.2_events.patch"
+)
+
+src_prepare() {
+       use glide && eapply "${DISTDIR}"/dosbox_glide-${GLIDE_PATCH}.diff
+       default
+       eautoreconf
+}
+
+src_configure() {
+       use glide && append-cppflags -I"${EPREFIX}"/usr/include/openglide
+
+       ac_cv_lib_X11_main=$(usex X yes no) \
+       econf \
+               $(use_enable alsa alsa-midi) \
+               $(use_enable core-inline) \
+               $(use_enable !hardened dynamic-core) \
+               $(use_enable !hardened dynamic-x86) \
+               $(use_enable debug) \
+               $(use_enable opengl)
+}
+
+src_install() {
+       default
+       make_desktop_entry dosbox DOSBox /usr/share/pixmaps/dosbox.ico
+       doicon src/dosbox.ico
+}
+
+pkg_postinst() {
+       if use glide; then
+               elog "You have enabled unofficial Glide emulation. To use this, symlink"
+               elog "or copy ${EPREFIX}/usr/share/openglide/glide2x-dosbox.ovl to your game's"
+               elog "directory and add the following to your DOSBox configuration."
+               elog ""
+               elog "[glide]"
+               elog "glide=true"
+       fi
+}
index 421603aa2fd025ed22b6921519ebbacde665034f..8c4711e5620cf40119ed92625f6d650f376e760a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -17,7 +17,7 @@ else
 fi
 
 DESCRIPTION="DOS emulator"
-HOMEPAGE="http://dosbox.sourceforge.net/"
+HOMEPAGE="https://www.dosbox.com/"
 
 LICENSE="GPL-2"
 SLOT="0"
diff --git a/games-emulation/dosbox/files/dosbox-0.74.2_events.patch b/games-emulation/dosbox/files/dosbox-0.74.2_events.patch
new file mode 100644 (file)
index 0000000..fee09a6
--- /dev/null
@@ -0,0 +1,37 @@
+Index: src/gui/sdlmain.cpp
+===================================================================
+--- a/src/gui/sdlmain.cpp      (revision 4177)
++++ b/src/gui/sdlmain.cpp      (working copy)
+@@ -1426,6 +1426,12 @@
+ #define DB_POLLSKIP 1
+ #endif
++#if defined(LINUX)
++#define SDL_XORG_FIX 1
++#else
++#define SDL_XORG_FIX 0
++#endif
++
+ void GFX_Events() {
+       //Don't poll too often. This can be heavy on the OS, especially Macs.
+       //In idle mode 3000-4000 polls are done per second without this check.
+@@ -1449,6 +1455,19 @@
+       }
+ #endif
+       while (SDL_PollEvent(&event)) {
++#if SDL_XORG_FIX
++              // Special code for broken SDL with Xorg 1.20.1, where pairs of inputfocus gain and loss events are generated
++              // when locking the mouse in windowed mode.
++              if (event.type == SDL_ACTIVEEVENT && event.active.state == SDL_APPINPUTFOCUS && event.active.gain == 0) {
++                      SDL_Event test; //Check if the next event would undo this one.
++                      if (SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_ACTIVEEVENTMASK) == 1 && test.active.state == SDL_APPINPUTFOCUS && test.active.gain == 1) {
++                              // Skip both events.
++                              SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_ACTIVEEVENTMASK);
++                              continue;
++                      }
++              }
++#endif
++
+               switch (event.type) {
+               case SDL_ACTIVEEVENT:
+                       if (event.active.state & SDL_APPINPUTFOCUS) {