games-emulation/hatari: Bump to 2.2.1, EAPI 7, lots of improvements
authorJames Le Cuirot <chewi@gentoo.org>
Sun, 10 Nov 2019 21:37:12 +0000 (21:37 +0000)
committerJames Le Cuirot <chewi@gentoo.org>
Sun, 10 Nov 2019 21:39:27 +0000 (21:39 +0000)
It turns out most of the dependencies are optional.

Closes: https://bugs.gentoo.org/689538
Package-Manager: Portage-2.3.79, Repoman-2.3.17
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
games-emulation/hatari/Manifest
games-emulation/hatari/files/hatari-2.2.1-default-rom.patch [new file with mode: 0644]
games-emulation/hatari/files/hatari-2.2.1-joystick.patch [new file with mode: 0644]
games-emulation/hatari/hatari-2.2.1.ebuild [new file with mode: 0644]
games-emulation/hatari/metadata.xml

index e061a3037e68a5ccd7209c61ee4e82b3b13ccbc5..2d2d4017ca7345a6f7618f3aaa8c40deebe13878 100644 (file)
@@ -1 +1,2 @@
 DIST hatari-2.1.0.tar.bz2 4072778 BLAKE2B 934ab28e799d0d13c26c291005513511367eb2ddbeda0f9756c19f10fa9e6bb8e10451057fa7e0b49a30e3f562eb5f327057d324b2a92e09b1115f63132dca97 SHA512 d1fbf6e60e2df2c43d070bee6a9c1dc93c36a8ea7f75bbf2a67790840952661cee136ebccd6b2ed523ef9b7b56391e058384f2e3f46acb609bb362cac05b9753
+DIST hatari-2.2.1.tar.bz2 4162798 BLAKE2B 51938a649957779652b0debf7f867b2abe2d54fd3bb31086542f9f5970d01a120455e4381a9cb173724fbc7c45359d4009377bfe99038b338142fa5b82723533 SHA512 0e4c148a355a53c9cf79bdd28e5d7bb5f3389c780576017c6ebe2b69465d67522f373945f0e51681120ece24f5f08442265515486d2d7df7a02d9cd94cc44f1e
diff --git a/games-emulation/hatari/files/hatari-2.2.1-default-rom.patch b/games-emulation/hatari/files/hatari-2.2.1-default-rom.patch
new file mode 100644 (file)
index 0000000..c42f67f
--- /dev/null
@@ -0,0 +1,16 @@
+Use etos512k.img from the emutos package rather than tos.img.
+
+diff -Naur a/src/configuration.c b/src/configuration.c
+--- a/src/configuration.c      2019-02-08 08:30:11.000000000 +0000
++++ b/src/configuration.c      2019-11-10 21:19:31.712605716 +0000
+@@ -841,8 +841,8 @@
+       ConfigureParams.Sound.YmVolumeMixing = YM_TABLE_MIXING;
+       /* Set defaults for Rom */
+-      sprintf(ConfigureParams.Rom.szTosImageFileName, "%s%ctos.img",
+-              Paths_GetDataDir(), PATHSEP);
++      sprintf(ConfigureParams.Rom.szTosImageFileName, "%s%c..%cemutos%cetos512k.img",
++              Paths_GetDataDir(), PATHSEP, PATHSEP, PATHSEP);
+       ConfigureParams.Rom.bPatchTos = true;
+       strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
diff --git a/games-emulation/hatari/files/hatari-2.2.1-joystick.patch b/games-emulation/hatari/files/hatari-2.2.1-joystick.patch
new file mode 100644 (file)
index 0000000..193bb72
--- /dev/null
@@ -0,0 +1,59 @@
+https://bugs.gentoo.org/689538
+
+diff -ruN hatari-2.1.0.old/src/gui-sdl/sdlgui.c hatari-2.1.0/src/gui-sdl/sdlgui.c
+--- hatari-2.1.0.old/src/gui-sdl/sdlgui.c      2018-02-07 18:33:56.000000000 +0000
++++ hatari-2.1.0/src/gui-sdl/sdlgui.c  2019-07-08 23:55:50.481270799 +0100
+@@ -1329,12 +1329,28 @@
+                               }
+                               break;
++                       case SDL_JOYHATMOTION:
++                              if (sdlEvent.jhat.value & SDL_HAT_LEFT)
++                                      retbutton = SDLGui_HandleShortcut(dlg, SG_SHORTCUT_LEFT);
++                              else if (sdlEvent.jhat.value & SDL_HAT_RIGHT)
++                                      retbutton = SDLGui_HandleShortcut(dlg, SG_SHORTCUT_RIGHT);
++                              if (sdlEvent.jhat.value & SDL_HAT_UP)
++                              {
++                                      SDLGui_RemoveFocus(dlg, focused);
++                                      focused = SDLGui_FocusNext(dlg, focused, -1);
++                              }
++                              else if (sdlEvent.jhat.value & SDL_HAT_DOWN)
++                              {
++                                      SDLGui_RemoveFocus(dlg, focused);
++                                      focused = SDLGui_FocusNext(dlg, focused, +1);
++                              }
++                              break;
++
+                        case SDL_JOYBUTTONDOWN:
+                               retbutton = SDLGui_HandleSelection(dlg, focused, focused);
+                               break;
+                        case SDL_JOYBALLMOTION:
+-                       case SDL_JOYHATMOTION:
+                        case SDL_MOUSEMOTION:
+                               break;
+diff -ruN hatari-2.1.0.old/src/joy.c hatari-2.1.0/src/joy.c
+--- hatari-2.1.0.old/src/joy.c 2018-02-07 18:33:56.000000000 +0000
++++ hatari-2.1.0/src/joy.c     2019-07-09 14:46:36.502410790 +0100
+@@ -199,9 +199,20 @@
+  */
+ static bool Joy_ReadJoystick(int nSdlJoyID, JOYREADING *pJoyReading)
+ {
++      unsigned hat = SDL_JoystickGetHat(sdlJoystick[nSdlJoyID], 0);
++
+       /* Joystick is OK, read position from the configured joystick axis */
+       pJoyReading->XPos = SDL_JoystickGetAxis(sdlJoystick[nSdlJoyID], pJoyReading->XAxisID);
+       pJoyReading->YPos = SDL_JoystickGetAxis(sdlJoystick[nSdlJoyID], pJoyReading->YAxisID);
++      /* Similarly to other emulators that support hats, override axis readings with hats */
++      if (hat & SDL_HAT_LEFT)
++              pJoyReading->XPos = -32768;
++      if (hat & SDL_HAT_RIGHT)
++              pJoyReading->XPos = 32767;
++      if (hat & SDL_HAT_UP)
++              pJoyReading->YPos = -32768;
++      if (hat & SDL_HAT_DOWN)
++              pJoyReading->YPos = 32767;
+       /* Sets bit #0 if button #1 is pressed: */
+       pJoyReading->Buttons = SDL_JoystickGetButton(sdlJoystick[nSdlJoyID], 0);
+       /* Sets bit #1 if button #2 is pressed: */
diff --git a/games-emulation/hatari/hatari-2.2.1.ebuild b/games-emulation/hatari/hatari-2.2.1.ebuild
new file mode 100644 (file)
index 0000000..a8f8410
--- /dev/null
@@ -0,0 +1,80 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{6,7}} )
+inherit cmake-utils python-single-r1 xdg
+
+DESCRIPTION="Atari ST emulator"
+HOMEPAGE="https://hatari.tuxfamily.org/"
+SRC_URI="https://download.tuxfamily.org/hatari/${PV}/${P}.tar.bz2"
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="capsimage microphone png portmidi readline +sdl2 udev zlib"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+       ${PYTHON_DEPS}
+       capsimage? ( >=dev-libs/spsdeclib-5.1-r1 )
+       microphone? ( media-libs/portaudio )
+       png? ( media-libs/libpng:0= )
+       portmidi? ( media-libs/portmidi )
+       readline? ( sys-libs/readline:0= )
+       sdl2? ( media-libs/libsdl2[sound,video,X] )
+       !sdl2? ( media-libs/libsdl[sound,video,X] )
+       udev? ( virtual/udev )
+       zlib? ( sys-libs/zlib )
+"
+
+RDEPEND="
+       ${DEPEND}
+       dev-python/pygobject:3[${PYTHON_USEDEP}]
+       >=games-emulation/emutos-0.9.9.1
+"
+
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.2.1-default-rom.patch
+       "${FILESDIR}"/${PN}-2.2.1-joystick.patch
+)
+
+DOCS=(
+       readme.txt
+       doc/{changelog,coding,scsi-driver,thanks,video-recording}.txt
+)
+
+src_prepare() {
+       xdg_environment_reset
+       cmake-utils_src_prepare
+
+       sed -i "s/\.1\.gz\b/.1/g;T;s/gzip[^\$]*/cat /g" {*/,}*/CMakeLists.txt || die
+       sed -i "s:\"doc\" + sep + \"hatari\":\"doc/${PF}\":" python-ui/uihelpers.py || die
+       sed -i "s/python/${EPYTHON}/" tools/atari-hd-image.sh || die
+
+       # Use emutos package rather than bundled ROM.
+       rm src/tos.img || die
+}
+
+src_configure() {
+       mycmakeargs=(
+               -DBUILD_SHARED_LIBS=OFF
+               -DDOCDIR="${EPREFIX}"/usr/share/doc/${PF}
+               -DENABLE_SDL2=$(usex sdl2)
+               -DCMAKE_DISABLE_FIND_PACKAGE_CapsImage=$(usex !capsimage)
+               -DCMAKE_DISABLE_FIND_PACKAGE_PortAudio=$(usex !microphone)
+               -DCMAKE_DISABLE_FIND_PACKAGE_PortMidi=$(usex !portmidi)
+               -DCMAKE_DISABLE_FIND_PACKAGE_PNG=$(usex !png)
+               -DCMAKE_DISABLE_FIND_PACKAGE_Readline=$(usex !readline)
+               -DCMAKE_DISABLE_FIND_PACKAGE_Udev=$(usex !udev)
+               -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=$(usex !zlib)
+       )
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+       python_fix_shebang "${ED}"/usr/share/${PN}/
+}
index d4511e749d48a707d88c63b00ea19d4dfdd167aa..f17253687ee3e0b7220de605995fe86fb96d4ef7 100644 (file)
@@ -6,6 +6,9 @@
        <name>Gentoo Games Project</name>
 </maintainer>
 <use>
+       <flag name="capsimage">Use <pkg>dev-libs/spsdeclib</pkg> to read .IPF, .RAW, and .CTR disk images</flag>
+       <flag name="microphone">Use <pkg>media-libs/portaudio</pkg> for Falcon microphone handling</flag>
+       <flag name="portmidi">Use <pkg>media-libs/portmidi</pkg> as an alternative MIDI backend</flag>
        <flag name="sdl2">Use libsdl2 instead of libsdl</flag>
 </use>
 </pkgmetadata>