From c4c3a8da375aa651dcc2b5c80fe8e72aecbe0b7e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 May 2020 21:46:44 +1000
Subject: [PATCH] Mupen64Plus: add recipe
---
.../additional-files/Mupen64plus.iom | Bin 0 -> 19256 bytes
.../additional-files/mupen64plus.rdef.in | 39 ++
.../mupen64plus/mupen64plus-2.5.9.recipe | 162 +++++++
.../patches/mupen64plus-2.5.9.patchset | 415 ++++++++++++++++++
.../patches/mupen64plus_qt-1.14.patchset | 153 +++++++
5 files changed, 769 insertions(+)
create mode 100644 games-emulation/mupen64plus/additional-files/Mupen64plus.iom
create mode 100644 games-emulation/mupen64plus/additional-files/mupen64plus.rdef.in
create mode 100644 games-emulation/mupen64plus/mupen64plus-2.5.9.recipe
create mode 100644 games-emulation/mupen64plus/patches/mupen64plus-2.5.9.patchset
create mode 100644 games-emulation/mupen64plus/patches/mupen64plus_qt-1.14.patchset
diff --git a/games-emulation/mupen64plus/additional-files/Mupen64plus.iom b/games-emulation/mupen64plus/additional-files/Mupen64plus.iom
new file mode 100644
index 0000000000000000000000000000000000000000..bd3f8a3f67034fd549ac3f2fef8f99c0f0a3cc90
GIT binary patch
literal 19256
zcmeHO3vgUj89v+47D|P+fL5V)9Ud)EnY5Ia5oNa}O@foqK;!TjG}$JbW}8hm?rwoF
zijkLvwzPJn6e(JvXr&CKJe-O$2~d!sip6oPB5G$GULullCL=h`tlxJYchBA4T~0~b
z&~fj~zvtfXo_o)^|Ns5}Ip@E3FK%2`SKnAWS6~Z4@+G$IUlO7U=O-4`!J)h^BqoWv
zx@C>L$7M5#s(XdRWDnmoO^7RSZUWBP_(Ri$7(ox%bZ
Q=>6K~K
zJVXfnWv@Pt6Yrp|InP$aRp^IHBe&w2CgDoc2yf0C@ln;IOca+jFT04xQ+Wa#RaJ$n
znlEWu{4wlzLf8pjTP2S1;ok(#dsm4mK71J1Q5tVpx>VkW_gapI)P1H3;%t}Fr}3V6
zc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#K;>e%OU*IQF3zqHE82^3D6!{N;dzjvud$p^MmRW20DzUhL>gOQ4TKb*@f_$&oXJUF!pDH}Tl0!Dsc+**iVw`{K*{dT
zbV@*0=TJLS|B@KGCiCK0ajY<9oM<;)b
literal 0
HcmV?d00001
diff --git a/games-emulation/mupen64plus/additional-files/mupen64plus.rdef.in b/games-emulation/mupen64plus/additional-files/mupen64plus.rdef.in
new file mode 100644
index 000000000..db15c5f2b
--- /dev/null
+++ b/games-emulation/mupen64plus/additional-files/mupen64plus.rdef.in
@@ -0,0 +1,39 @@
+
+resource app_flags B_SINGLE_LAUNCH;
+
+resource app_version {
+ major = @MAJOR@,
+ middle = @MIDDLE@,
+ minor = @MINOR@,
+
+ variety = B_APPV_FINAL,
+ internal = 0,
+
+ short_info = "Mupen64Plus",
+ long_info = "@LONG_INFO@"
+};
+
+resource app_signature "@APP_SIGNATURE@";
+
+resource vector_icon {
+ $"6E6369660A020016023A6496BA3F153EBCDC3EEA9047D96A4458AB00F5FFA402"
+ $"0016023D5163B57FEA381ADF3FFDC648CA11C8B7B1006BFF9602000602000000"
+ $"3CEA3DBCEA3D0000004E387A49D8000080FF80FF00B200020006023811A63A97"
+ $"1BBD48503A9F304AA47946B8910080FF80FF00B30002000602BBCCAC3269EAB3"
+ $"B380BCE9BD4B21754AFEF100FFABABFFD900000501020006023B55F13C5CD2BE"
+ $"755C3D78964B054E477F96000EB3B5FF003BFF020006023C318A3A487BBD09B3"
+ $"3EEB2D4830B83EEDE00000AAFFFF0537C704006603005900110A0D224E223129"
+ $"332F3F36383E3A3E5C3658364231482E47293C29510A0D3E5C3E3A4536493D4D"
+ $"30522D52474D4C4D394A444845454045550A042951293C3038304D0A04223129"
+ $"2E31312A340A0436383C3445363E3A0A044A2B522D4D30452E0A0437263E2839"
+ $"2B32290A042F3F29343031353A0A042D323328392B34340A04392B3E2844323F"
+ $"350A044238452E4D30493D0A05353A30313434392B39360A053936392B3F3345"
+ $"2E43370A084749474049414D364D394D394D394D4B0A18224E2231282E2E3032"
+ $"2938263E284330452E4A2B522D52474D4B47494743454045553E5C3658364231"
+ $"483048304D29510A0C3A22302230302230223A303A30483A483A3A483A48303A"
+ $"300A093E5E4B5D604660403930293C2953375236580C0A080110000A05010E10"
+ $"01178412010A0702020B000A010407090A08000A04010D000A03010C000A0201"
+ $"00000A060101000A000403040506000A08010F123DD1740000000000003DD174"
+ $"4AC0004AC00001178422040A09010F123DD1740000000000003DD1744AB0004A"
+ $"B00001178722040A02010F023DD1740000000000003DD1744AB0004AB000"
+};
diff --git a/games-emulation/mupen64plus/mupen64plus-2.5.9.recipe b/games-emulation/mupen64plus/mupen64plus-2.5.9.recipe
new file mode 100644
index 000000000..7ece8e890
--- /dev/null
+++ b/games-emulation/mupen64plus/mupen64plus-2.5.9.recipe
@@ -0,0 +1,162 @@
+SUMMARY="A portable Nintendo 64 emulator"
+DESCRIPTION="Mupen64Plus is a cross-platform plugin-based N64 emulator which is \
+capable of accurately playing many games. Included are four MIPS R4300 CPU emulators, \
+with dynamic recompilers for 32-bit x86 and 64-bit amd64 systems, and necessary plugins \
+for audio, graphical rendering (RDP), signal co-processor (RSP), and input. \
+There is 1 included OpenGL video plugin, called RiceVideo. There are 3 other excellent \
+video plugins being maintained by wahrhaft, called Arachnoid, Glide64, and Z64."
+HOMEPAGE="https://mupen64plus.org/"
+COPYRIGHT="Mupen64Plus Team, Dan Hasting"
+LICENSE="GNU GPL v2
+ GNU LGPL v2.1
+ BSD (3-clause)
+ "
+REVISION="1"
+SOURCE_URI="https://github.com/mupen64plus/mupen64plus-core/releases/download/$portVersion/mupen64plus-bundle-src-$portVersion.tar.gz"
+CHECKSUM_SHA256="d5243ddc00388ee2e538b3826a78a719dec2bd5da54ac6f3344fed861fb141a8"
+SOURCE_DIR="mupen64plus-bundle-src-$portVersion"
+guiVersion="1.14"
+SOURCE_URI_2="https://github.com/dh4/mupen64plus-qt/archive/$guiVersion.tar.gz"
+CHECKSUM_SHA256_2="467f4e5b75a0f63f23b1c8266746b3e7932b9dc4ee950c42b2bfaf9660e64614"
+SOURCE_DIR_2="mupen64plus-qt-$guiVersion"
+PATCHES="mupen64plus-$portVersion.patchset"
+PATCHES_2="mupen64plus_qt-$guiVersion.patchset"
+ADDITIONAL_FILES="mupen64plus.rdef.in"
+
+ARCHITECTURES="!x86_gcc2 x86_64"
+SECONDARY_ARCHITECTURES="x86"
+
+M64P_COMPONENTS="core ui-console audio-sdl input-sdl rsp-hle video-rice video-glide64mk2"
+
+PROVIDES="
+ mupen64plus$secondaryArchSuffix = $portVersion
+ app:mupen64plus = $portVersion
+ "
+REQUIRES="
+ haiku$secondaryArchSuffix
+ lib:libboost_filesystem$secondaryArchSuffix
+ lib:libboost_system$secondaryArchSuffix
+ lib:libfreetype$secondaryArchSuffix
+ lib:libGL$secondaryArchSuffix
+ lib:libglew$secondaryArchSuffix
+ lib:libGLU$secondaryArchSuffix
+ lib:libintl$secondaryArchSuffix
+ lib:libpng16$secondaryArchSuffix
+ lib:libQt5Core$secondaryArchSuffix
+ lib:libQt5Gui$secondaryArchSuffix
+ lib:libQt5Widgets$secondaryArchSuffix
+ lib:libquazip5$secondaryArchSuffix
+ lib:libSDL2_2.0$secondaryArchSuffix
+ lib:libSDL2_image_2.0$secondaryArchSuffix
+ lib:libz$secondaryArchSuffix
+ lib:libzip$secondaryArchSuffix
+ "
+
+BUILD_REQUIRES="
+ haiku${secondaryArchSuffix}_devel
+ devel:libboost_filesystem$secondaryArchSuffix
+ devel:libboost_system$secondaryArchSuffix
+ devel:libGL$secondaryArchSuffix
+ devel:libfreetype$secondaryArchSuffix
+ devel:libglew$secondaryArchSuffix
+ devel:libGLU$secondaryArchSuffix
+ devel:libintl$secondaryArchSuffix
+ devel:libpng16$secondaryArchSuffix
+ devel:libQt5Core$secondaryArchSuffix
+ devel:libquazip5$secondaryArchSuffix
+ devel:libSDL2_2.0$secondaryArchSuffix
+ devel:libSDL2_image_2.0$secondaryArchSuffix
+ devel:libz$secondaryArchSuffix
+ devel:libzip$secondaryArchSuffix
+ "
+BUILD_PREREQUIRES="
+ cmd:awk
+ cmd:gcc$secondaryArchSuffix
+ cmd:ld$secondaryArchSuffix
+ cmd:lrelease$secondaryArchSuffix >= 5
+ cmd:make
+ cmd:nasm
+ cmd:pkg_config$secondaryArchSuffix
+ cmd:qmake$secondaryArchSuffix >= 5
+ cmd:which
+ "
+
+BUILD()
+{
+ APP_DIR="$appsDir/Mupen64Plus/"
+ PARAMS="\
+ PLUGINDIR=$APP_DIR/plugins \
+ SHAREDIR=$APP_DIR/data \
+ BINDIR=$APP_DIR/bin \
+ MANDIR=$manDir \
+ LIBDIR=$APP_DIR/lib \
+ APPSDIR=$APP_DIR \
+ ICONSDIR=$APP_DIR/icons \
+ INCDIR=$APP_DIR/api \
+ LDCONFIG=true "
+
+ for component in ${M64P_COMPONENTS}; do
+ make -C source/mupen64plus-${component}/projects/unix all $@ ${PARAMS}
+ done
+
+ mkdir -p $sourceDir2/build
+ cd $sourceDir2/build
+
+ qmake ../mupen64plus-qt.pro
+ make
+}
+
+INSTALL()
+{
+ APP_DIR="$appsDir/Mupen64Plus/"
+ mkdir -p $APP_DIR
+
+ PARAMS="\
+ PLUGINDIR=$APP_DIR/plugins \
+ SHAREDIR=$APP_DIR/data \
+ BINDIR=$APP_DIR/bin \
+ MANDIR=$manDir \
+ LIBDIR=$APP_DIR/lib \
+ APPSDIR=$APP_DIR \
+ ICONSDIR=$APP_DIR/icons \
+ INCDIR=$APP_DIR/api \
+ LDCONFIG=true "
+
+ for component in ${M64P_COMPONENTS}; do
+ make -C source/mupen64plus-${component}/projects/unix install $@ ${PARAMS}
+ done
+
+ mv $APP_DIR/bin/mupen64plus $APP_DIR/bin/Mupen64Plus
+ cp source/mupen64plus-rom/m64p_test_rom.v64 $APP_DIR/data
+ cp $sourceDir2/build/mupen64plus-qt $APP_DIR/Mupen64Plus
+ rm -rf $APP_DIR/{mupen64plus.desktop,api,icons} $manDir
+
+ local APP_SIGNATURE="application/x-vnd.mupen64plus"
+ local MAJOR="`echo "$portVersion" | cut -d. -f1`"
+ local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
+ local MINOR="`echo "$portVersion" | cut -d. -f3`"
+ local LONG_INFO="$SUMMARY"
+ sed \
+ -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
+ -e "s|@MAJOR@|$MAJOR|" \
+ -e "s|@MIDDLE@|$MIDDLE|" \
+ -e "s|@MINOR@|$MINOR|" \
+ -e "s|@LONG_INFO@|$LONG_INFO|" \
+ $portDir/additional-files/mupen64plus.rdef.in > mupen64plus.rdef
+ addResourcesToBinaries mupen64plus.rdef $APP_DIR/bin/Mupen64Plus
+
+ local APP_SIGNATURE="application/x-vnd.mupen64plus-qt"
+ local MAJOR="`echo "$guiVersion" | cut -d. -f1`"
+ local MIDDLE="`echo "$guiVersion" | cut -d. -f2`"
+ local MINOR="0"
+ sed \
+ -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
+ -e "s|@MAJOR@|$MAJOR|" \
+ -e "s|@MIDDLE@|$MIDDLE|" \
+ -e "s|@MINOR@|$MINOR|" \
+ -e "s|@LONG_INFO@|$LONG_INFO|" \
+ $portDir/additional-files/mupen64plus.rdef.in > mupen64plus-qt.rdef
+ addResourcesToBinaries mupen64plus-qt.rdef $APP_DIR/Mupen64Plus
+
+ addAppDeskbarSymlink $APP_DIR/Mupen64Plus
+}
diff --git a/games-emulation/mupen64plus/patches/mupen64plus-2.5.9.patchset b/games-emulation/mupen64plus/patches/mupen64plus-2.5.9.patchset
new file mode 100644
index 000000000..95919760d
--- /dev/null
+++ b/games-emulation/mupen64plus/patches/mupen64plus-2.5.9.patchset
@@ -0,0 +1,415 @@
+From 53d85e77afe4f9d92207d63ba5ae434a72ca06f1 Mon Sep 17 00:00:00 2001
+From: Gerasim Troeglazov <3dEyes@gmail.com>
+Date: Fri, 15 May 2020 20:50:20 +1000
+Subject: Add Haiku suppport
+
+
+diff --git a/source/mupen64plus-audio-sdl/projects/unix/Makefile b/source/mupen64plus-audio-sdl/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 9a98687..70fe253
+--- a/source/mupen64plus-audio-sdl/projects/unix/Makefile
++++ b/source/mupen64plus-audio-sdl/projects/unix/Makefile
+@@ -24,6 +24,11 @@
+ # detect operation system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++ SHARED = -shared
++ SO_EXTENSION = so
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ SHARED = -shared
+diff --git a/source/mupen64plus-core/projects/unix/Makefile b/source/mupen64plus-core/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index c18596b..a57390d
+--- a/source/mupen64plus-core/projects/unix/Makefile
++++ b/source/mupen64plus-core/projects/unix/Makefile
+@@ -25,6 +25,9 @@
+ # detect operating system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ endif
+@@ -134,7 +137,7 @@ ifeq ("$(CPU)","NONE")
+ endif
+
+ # base CFLAGS, LDLIBS, and LDFLAGS
+-OPTFLAGS ?= -O3 -flto
++OPTFLAGS ?= -O3
+ WARNFLAGS ?= -Wall
+ CFLAGS += -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/asm_defines -DM64P_PARALLEL
+ CXXFLAGS += -fvisibility-inlines-hidden
+@@ -169,6 +172,16 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
+ endif
+
+ # set special flags per-system
++ifeq ($(OS), HAIKU)
++ TARGET = libmupen64plus$(POSTFIX).so.2.0.0
++ SONAME = libmupen64plus$(POSTFIX).so.2
++ LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
++ ifeq ($(ARCH_DETECTED), 64BITS)
++ ASFLAGS = -f elf64
++ else
++ ASFLAGS = -f elf
++ endif
++endif
+ ifeq ($(OS), FREEBSD)
+ TARGET = libmupen64plus$(POSTFIX).so.2.0.0
+ SONAME = libmupen64plus$(POSTFIX).so.2
+@@ -406,6 +419,9 @@ LINK.o = $(Q_LD)$(CXX) $(OPTFLAGS) $(WARNFLAGS) $(CXXFLAGS) $(LDFLAGS) $(TARGET_
+ ifeq ($(OS),OSX)
+ LDCONFIG ?= true # no 'ldconfig' under OSX
+ else
++ ifeq ($(OS),HAIKU)
++ LDCONFIG ?= true
++ endif
+ ifeq ($(OS),LINUX)
+ LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -n
+ endif
+diff --git a/source/mupen64plus-core/src/api/vidext.c b/source/mupen64plus-core/src/api/vidext.c
+index 6ff9bd9..5062fb7 100644
+--- a/source/mupen64plus-core/src/api/vidext.c
++++ b/source/mupen64plus-core/src/api/vidext.c
+@@ -158,7 +158,11 @@ EXPORT m64p_error CALL VidExt_ListFullscreenModes(m64p_2d_size *SizeArray, int *
+ return M64ERR_NOT_INIT;
+
+ /* get a list of SDL video modes */
++#ifdef __HAIKU__
++ videoFlags = SDL_OPENGL;
++#else
+ videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
++#endif
+
+ if ((videoInfo = SDL_GetVideoInfo()) == NULL)
+ {
+@@ -224,7 +228,11 @@ EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPix
+ }
+ else if (ScreenMode == M64VIDEO_FULLSCREEN)
+ {
++#ifdef __HAIKU__
++ videoFlags = SDL_OPENGL;
++#else
+ videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
++#endif
+ }
+ else
+ {
+diff --git a/source/mupen64plus-core/src/api/vidext_sdl2_compat.h b/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
+index 06d778d..69beabd 100644
+--- a/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
++++ b/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
+@@ -195,6 +195,9 @@ SDL_GL_SwapBuffers(void)
+ static int
+ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
+ {
++#ifdef __HAIKU__
++ return 0;
++#else
+ int window_w;
+ int window_h;
+
+@@ -225,6 +228,7 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
+
+ /* We're done! */
+ return 1;
++#endif
+ }
+
+ static int
+diff --git a/source/mupen64plus-core/src/osal/files_unix.c b/source/mupen64plus-core/src/osal/files_unix.c
+index 2207167..65daf08 100644
+--- a/source/mupen64plus-core/src/osal/files_unix.c
++++ b/source/mupen64plus-core/src/osal/files_unix.c
+@@ -35,6 +35,11 @@
+ #include "api/m64p_types.h"
+ #include "files.h"
+
++#ifdef __HAIKU__
++#include
++#include
++#endif
++
+ /* definitions for system directories to search when looking for shared data files */
+ #if defined(SHAREDIR)
+ #define XSTR(S) STR(S) /* this wacky preprocessor thing is necessary to generate a quote-enclosed */
+@@ -173,6 +178,15 @@ const char * osal_get_user_configpath(void)
+ {
+ static char retpath[PATH_MAX];
+ int rval;
++
++#ifdef __HAIKU__
++ char path[B_PATH_NAME_LENGTH];
++ if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH) == B_OK) {
++ snprintf(retpath, PATH_MAX, "%s/%s", path, "Mupen64Plus/");
++ mkdir(retpath, S_IRWXU);
++ return retpath;
++ }
++#endif
+
+ /* first, try the XDG_CONFIG_HOME environment variable */
+ rval = get_xdg_dir(retpath, "XDG_CONFIG_HOME", "mupen64plus/");
+@@ -194,7 +208,16 @@ const char * osal_get_user_datapath(void)
+ {
+ static char retpath[PATH_MAX];
+ int rval;
+-
++
++#ifdef __HAIKU__
++ char path[B_PATH_NAME_LENGTH];
++ if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH) == B_OK) {
++ snprintf(retpath, PATH_MAX, "%s/%s", path, "Mupen64Plus/");
++ mkdir(retpath, S_IRWXU);
++ return retpath;
++ }
++#endif
++
+ /* first, try the XDG_DATA_HOME environment variable */
+ rval = get_xdg_dir(retpath, "XDG_DATA_HOME", "mupen64plus/");
+ if (rval == 0)
+@@ -215,7 +238,16 @@ const char * osal_get_user_cachepath(void)
+ {
+ static char retpath[PATH_MAX];
+ int rval;
+-
++
++#ifdef __HAIKU__
++ char path[B_PATH_NAME_LENGTH];
++ if (find_directory(B_USER_CACHE_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH) == B_OK) {
++ snprintf(retpath, PATH_MAX, "%s/%s", path, "Mupen64Plus/");
++ mkdir(retpath, S_IRWXU);
++ return retpath;
++ }
++#endif
++
+ /* first, try the XDG_CACHE_HOME environment variable */
+ rval = get_xdg_dir(retpath, "XDG_CACHE_HOME", "mupen64plus/");
+ if (rval == 0)
+diff --git a/source/mupen64plus-core/subprojects/minizip/ioapi.h b/source/mupen64plus-core/subprojects/minizip/ioapi.h
+index bac1325..8015acd 100644
+--- a/source/mupen64plus-core/subprojects/minizip/ioapi.h
++++ b/source/mupen64plus-core/subprojects/minizip/ioapi.h
+@@ -60,6 +60,11 @@
+ #define ftello64 ftello
+ #define fseeko64 fseeko
+ #endif
++#ifdef __HAIKU__
++#define fopen64 fopen
++#define ftello64 ftello
++#define fseeko64 fseeko
++#endif
+ #ifdef _MSC_VER
+ #define fopen64 fopen
+ #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
+diff --git a/source/mupen64plus-input-sdl/projects/unix/Makefile b/source/mupen64plus-input-sdl/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 91ba331..5cda0e8
+--- a/source/mupen64plus-input-sdl/projects/unix/Makefile
++++ b/source/mupen64plus-input-sdl/projects/unix/Makefile
+@@ -23,6 +23,11 @@
+ # detect operating system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++ SO_EXTENSION = so
++ SHARED = -shared
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ SO_EXTENSION = so
+@@ -91,7 +96,7 @@ ifeq ("$(CPU)","OTHER")
+ endif
+
+ # base CFLAGS, LDLIBS, and LDFLAGS
+-OPTFLAGS ?= -O3 -flto
++OPTFLAGS ?= -O3
+ WARNFLAGS ?= -Wall
+ CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -D_GNU_SOURCE=1
+ LDFLAGS += $(SHARED)
+diff --git a/source/mupen64plus-rsp-hle/projects/unix/Makefile b/source/mupen64plus-rsp-hle/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 57e0580..0de8dbe
+--- a/source/mupen64plus-rsp-hle/projects/unix/Makefile
++++ b/source/mupen64plus-rsp-hle/projects/unix/Makefile
+@@ -24,6 +24,11 @@
+ # detect operating system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++ SO_EXTENSION = so
++ SHARED = -shared
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ SO_EXTENSION = so
+@@ -128,7 +133,7 @@ ifeq ("$(CPU)","NONE")
+ endif
+
+ # base CFLAGS, LDLIBS, and LDFLAGS
+-OPTFLAGS ?= -O3 -flto
++OPTFLAGS ?= -O3
+ WARNFLAGS ?= -Wall
+ CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
+ LDFLAGS += $(SHARED)
+diff --git a/source/mupen64plus-ui-console/projects/unix/Makefile b/source/mupen64plus-ui-console/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 42f11a9..3c3e83b
+--- a/source/mupen64plus-ui-console/projects/unix/Makefile
++++ b/source/mupen64plus-ui-console/projects/unix/Makefile
+@@ -23,6 +23,9 @@
+ # detect operation system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ endif
+@@ -68,7 +71,7 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
+ endif
+
+ # base CFLAGS, LDLIBS, and LDFLAGS
+-OPTFLAGS ?= -O3 -flto
++OPTFLAGS ?= -O3
+ WARNFLAGS ?= -Wall
+
+ CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -I../../src
+@@ -76,10 +79,12 @@ ifeq ($(OS), MINGW)
+ CFLAGS += -lpthread
+ LDLIBS += -lpthread
+ else
++ ifneq ($(OS), HAIKU)
+ ifneq ($(OS), OSX)
+ CFLAGS += -pthread
+ LDLIBS += -pthread
+ endif
++ endif
+ endif
+
+ # set special flags per-system
+@@ -172,6 +177,7 @@ MKDIR ?= mkdir -p
+ COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+ LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
+
++ifneq ($(OS), HAIKU)
+ ifeq ($(PIE), 1)
+ CFLAGS += -fPIE
+ LDFLAGS += -pie
+@@ -185,6 +191,9 @@ else
+ endif
+ endif
+ endif
++else
++ CFLAGS += -fPIC
++endif
+
+ # set installation options
+ ifeq ($(PREFIX),)
+diff --git a/source/mupen64plus-video-glide64mk2/projects/unix/Makefile b/source/mupen64plus-video-glide64mk2/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 18d6fba..6054a4e
+--- a/source/mupen64plus-video-glide64mk2/projects/unix/Makefile
++++ b/source/mupen64plus-video-glide64mk2/projects/unix/Makefile
+@@ -25,6 +25,11 @@
+ # detect operating system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++ SO_EXTENSION = so
++ SHARED = -shared
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ SO_EXTENSION = so
+diff --git a/source/mupen64plus-video-glide64mk2/src/Glitch64/inc/glidesys.h b/source/mupen64plus-video-glide64mk2/src/Glitch64/inc/glidesys.h
+index 12d0fcb..dd98be5 100644
+--- a/source/mupen64plus-video-glide64mk2/src/Glitch64/inc/glidesys.h
++++ b/source/mupen64plus-video-glide64mk2/src/Glitch64/inc/glidesys.h
+@@ -111,7 +111,7 @@ n** -----------------------------------------------------------------------
+ /* Check for OS */
+ #if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
+- defined(__FreeBSD_kernel__) || defined(__GNU__)
++ defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__HAIKU__)
+ # define GLIDE_OS GLIDE_OS_UNIX
+ #elif defined(__DOS__)
+ # define GLIDE_OS GLIDE_OS_DOS32
+diff --git a/source/mupen64plus-video-rice/projects/unix/Makefile b/source/mupen64plus-video-rice/projects/unix/Makefile
+old mode 100755
+new mode 100644
+index 7601a80..5035e17
+--- a/source/mupen64plus-video-rice/projects/unix/Makefile
++++ b/source/mupen64plus-video-rice/projects/unix/Makefile
+@@ -24,6 +24,11 @@
+ # detect operating system
+ UNAME ?= $(shell uname -s)
+ OS := NONE
++ifeq ("$(UNAME)","Haiku")
++ OS = HAIKU
++ SO_EXTENSION = so
++ SHARED = -shared
++endif
+ ifeq ("$(UNAME)","Linux")
+ OS = LINUX
+ SO_EXTENSION = so
+@@ -118,7 +123,7 @@ ifeq ("$(CPU)","NONE")
+ endif
+
+ # base CFLAGS, LDLIBS, and LDFLAGS
+-OPTFLAGS ?= -O3 -flto
++OPTFLAGS ?= -O3
+ WARNFLAGS ?= -Wall
+ CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
+ CXXFLAGS += -fvisibility-inlines-hidden
+diff --git a/source/mupen64plus-video-rice/src/OGLGraphicsContext.cpp b/source/mupen64plus-video-rice/src/OGLGraphicsContext.cpp
+index e4e57ba..2336bb4 100644
+--- a/source/mupen64plus-video-rice/src/OGLGraphicsContext.cpp
++++ b/source/mupen64plus-video-rice/src/OGLGraphicsContext.cpp
+@@ -100,6 +100,14 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind
+ /* Set the video mode */
+ m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN;
+ m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING;
++ if (!bWindowed)
++ {
++ ScreenMode = M64VIDEO_WINDOWED;
++ SDL_DisplayMode desktop_mode;
++ SDL_GetDesktopDisplayMode(0, &desktop_mode);
++ windowSetting.uDisplayWidth = desktop_mode.w;
++ windowSetting.uDisplayHeight = desktop_mode.h;
++ }
+ if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode, flags) != M64ERR_SUCCESS)
+ {
+ DebugMessage(M64MSG_ERROR, "Failed to set %i-bit video mode: %ix%i", colorBufferDepth, (int)windowSetting.uDisplayWidth, (int)windowSetting.uDisplayHeight);
+@@ -208,12 +216,12 @@ bool COGLGraphicsContext::ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL
+
+ InitState();
+ Unlock();
+-
++#ifndef __HAIKU__
+ Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers
+ UpdateFrame();
+ Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
+ UpdateFrame();
+-
++#endif
+ return true;
+ }
+
+--
+2.26.0
+
diff --git a/games-emulation/mupen64plus/patches/mupen64plus_qt-1.14.patchset b/games-emulation/mupen64plus/patches/mupen64plus_qt-1.14.patchset
new file mode 100644
index 000000000..7efa19de5
--- /dev/null
+++ b/games-emulation/mupen64plus/patches/mupen64plus_qt-1.14.patchset
@@ -0,0 +1,153 @@
+From 091c2860bf117fa761048d539a9a3c354980e772 Mon Sep 17 00:00:00 2001
+From: Gerasim Troeglazov <3dEyes@gmail.com>
+Date: Fri, 15 May 2020 20:51:12 +1000
+Subject: Fixes for Haiku
+
+
+diff --git a/src/common.cpp b/src/common.cpp
+index 3ffdb7c..5f6e561 100644
+--- a/src/common.cpp
++++ b/src/common.cpp
+@@ -393,7 +393,7 @@ bool romSorter(const Rom &firstRom, const Rom &lastRom)
+ {
+ QString sort, direction;
+
+- QString layout = SETTINGS.value("View/layout", "None").toString();
++ QString layout = SETTINGS.value("View/layout", "grid").toString();
+ if (layout == "grid") {
+ sort = SETTINGS.value("Grid/sort", "Filename").toString();
+ direction = SETTINGS.value("Grid/sortdirection", "ascending").toString();
+diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp
+index 2ef4586..54eb80b 100644
+--- a/src/dialogs/settingsdialog.cpp
++++ b/src/dialogs/settingsdialog.cpp
+@@ -184,7 +184,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, int activeTab) : QDialog(parent)
+ << (QStringList() << tr("Super") << "Super");
+
+
+- if (SETTINGS.value("Other/downloadinfo", "").toString() == "true")
++ if (SETTINGS.value("Other/downloadinfo", "true").toString() == "true")
+ populateTableAndListTab(true);
+ else
+ populateTableAndListTab(false);
+@@ -370,13 +370,13 @@ SettingsDialog::SettingsDialog(QWidget *parent, int activeTab) : QDialog(parent)
+ << ui->listSizeLabel
+ << ui->listSizeBox;
+
+- if (SETTINGS.value("Other/downloadinfo", "").toString() == "true") {
++ if (SETTINGS.value("Other/downloadinfo", "true").toString() == "true") {
+ toggleDownload(true);
+ ui->downloadOption->setChecked(true);
+ } else
+ toggleDownload(false);
+
+- if (SETTINGS.value("saveoptions", "").toString() == "true")
++ if (SETTINGS.value("saveoptions", "true").toString() == "true")
+ ui->saveOption->setChecked(true);
+
+ ui->parametersLine->setText(SETTINGS.value("Other/parameters", "").toString());
+diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
+index 0915a5a..132f175 100644
+--- a/src/mainwindow.cpp
++++ b/src/mainwindow.cpp
+@@ -64,7 +64,7 @@
+ #include
+ #include
+
+-#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
++#if defined(Q_OS_WIN) || defined(Q_OS_OSX) || defined(Q_OS_HAIKU)
+ #include
+ #endif
+
+@@ -123,7 +123,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
+
+ void MainWindow::addToView(Rom *currentRom, int count)
+ {
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ if (visibleLayout == "table")
+ tableView->addToTableView(currentRom);
+@@ -202,6 +202,16 @@ void MainWindow::autoloadSettings()
+ SETTINGS.setValue("Paths/data", mupen64App+"/Resources");
+ }
+ #endif
++
++#ifdef Q_OS_HAIKU
++ QString currentDir = QCoreApplication::applicationDirPath();
++ if (QFileInfo(currentDir+"/bin/Mupen64Plus").exists()) {
++ SETTINGS.setValue("Paths/mupen64plus", currentDir+"/bin/Mupen64Plus");
++ SETTINGS.setValue("Paths/plugins", currentDir+"/plugins");
++ SETTINGS.setValue("Paths/data", currentDir+"/data");
++ }
++#endif
++
+ }
+
+ checkConfigLocation();
+@@ -218,6 +228,8 @@ void MainWindow::checkConfigLocation()
+
+ #ifdef Q_OS_WIN
+ QString configCheck = homeDir + "/AppData/Roaming/Mupen64Plus/";
++#elif defined(Q_OS_HAIKU)
++ QString configCheck = homeDir + "/config/settings/Mupen64Plus/";
+ #else
+ QString configCheck = homeDir + "/.config/mupen64plus";
+ #endif
+@@ -329,7 +341,7 @@ void MainWindow::createMenu()
+ << (QStringList() << tr("Grid View") << "grid")
+ << (QStringList() << tr("List View") << "list");
+
+- QString layoutValue = SETTINGS.value("View/layout", "none").toString();
++ QString layoutValue = SETTINGS.value("View/layout", "grid").toString();
+
+ foreach (QStringList layoutName, layouts)
+ {
+@@ -478,7 +490,7 @@ void MainWindow::disableButtons()
+
+ void MainWindow::disableViews(bool imageUpdated)
+ {
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ //Save position in current layout
+ if (visibleLayout == "table")
+@@ -508,7 +520,7 @@ void MainWindow::enableButtons()
+
+ void MainWindow::enableViews(int romCount, bool cached)
+ {
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ if (romCount != 0) { //else no ROMs, so leave views disabled
+ QStringList tableVisible = SETTINGS.value("Table/columns", "Filename|Size").toString().split("|");
+@@ -608,7 +620,7 @@ bool MainWindow::eventFilter(QObject*, QEvent *event)
+
+ QString MainWindow::getCurrentRomInfoFromView(QString infoName)
+ {
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ if (visibleLayout == "table")
+ return tableView->getCurrentRomInfo(infoName);
+@@ -875,7 +887,7 @@ void MainWindow::resetLayouts(bool imageUpdated)
+
+ void MainWindow::showActiveView()
+ {
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ if (visibleLayout == "table")
+ tableView->setHidden(false);
+@@ -918,7 +930,7 @@ void MainWindow::showRomMenu(const QPoint &pos)
+
+
+ QWidget *activeWidget = new QWidget(this);
+- QString visibleLayout = SETTINGS.value("View/layout", "none").toString();
++ QString visibleLayout = SETTINGS.value("View/layout", "grid").toString();
+
+ if (visibleLayout == "table")
+ activeWidget = tableView->viewport();
+--
+2.26.0
+