pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Add WIP melonds update.



Module Name:	pkgsrc-wip
Committed By:	nia <nia%netbsd.org@localhost>
Pushed By:	nee
Date:		Fri Feb 26 09:10:35 2021 +0100
Changeset:	2e63a1f6503ae86a8ebc66d854249c8518a9484c

Modified Files:
	Makefile
Added Files:
	melonds/DESCR
	melonds/Makefile
	melonds/PLIST
	melonds/TODO
	melonds/distinfo
	melonds/patches/patch-CMakeLists.txt
	melonds/patches/patch-src_ARMJIT__Memory.cpp
	melonds/patches/patch-src_frontend_qt__sdl_CMakeLists.txt

Log Message:
Add WIP melonds update.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2e63a1f6503ae86a8ebc66d854249c8518a9484c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 melonds/DESCR                                      | 11 ++++
 melonds/Makefile                                   | 32 +++++++++
 melonds/PLIST                                      |  9 +++
 melonds/TODO                                       |  2 +
 melonds/distinfo                                   |  9 +++
 melonds/patches/patch-CMakeLists.txt               | 63 ++++++++++++++++++
 melonds/patches/patch-src_ARMJIT__Memory.cpp       | 76 ++++++++++++++++++++++
 .../patch-src_frontend_qt__sdl_CMakeLists.txt      | 21 ++++++
 9 files changed, 224 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 0a06edc94a..9e3ca23b65 100644
--- a/Makefile
+++ b/Makefile
@@ -2288,6 +2288,7 @@ SUBDIR+=	meep
 SUBDIR+=	meep-mpi
 SUBDIR+=	meep-openmpi
 SUBDIR+=	meka-git
+SUBDIR+=	melonds
 SUBDIR+=	memdump
 SUBDIR+=	memgrep
 SUBDIR+=	mendexk
diff --git a/melonds/DESCR b/melonds/DESCR
new file mode 100644
index 0000000000..d50cffceab
--- /dev/null
+++ b/melonds/DESCR
@@ -0,0 +1,11 @@
+melonDS aims at providing fast and accurate Nintendo DS emulation. While it
+is still a work in progress, it has a pretty solid set of features:
+
+* Nearly complete core (CPU, video, audio, ...)
+* OpenGL renderer, 3D upscaling
+* RTC, microphone, lid close/open
+* Joystick support
+* Savestates
+* Various display position/sizing/rotation modes
+* (WIP) Wifi: local multiplayer, online connectivity
+* and more are planned!
diff --git a/melonds/Makefile b/melonds/Makefile
new file mode 100644
index 0000000000..f3e4ff92cb
--- /dev/null
+++ b/melonds/Makefile
@@ -0,0 +1,32 @@
+# $NetBSD: Makefile,v 1.6 2020/08/18 17:57:46 leot Exp $
+
+DISTNAME=	melonDS-0.9.1
+PKGNAME=	${DISTNAME:S/DS/ds/}
+CATEGORIES=	emulators
+MASTER_SITES=	${MASTER_SITE_GITHUB:=Arisotura/}
+
+MAINTAINER=	nia%NetBSD.org@localhost
+HOMEPAGE=	http://melonds.kuribo64.net/
+COMMENT=	Nintendo DS emulator, sorta
+LICENSE=	gnu-gpl-v3
+
+USE_CMAKE=	yes
+USE_TOOLS+=	pkg-config
+USE_LANGUAGES=	c c++
+
+# C++17
+GCC_REQD+=	7
+
+CMAKE_ARGS+=	-DCMAKE_BUILD_TYPE="Release"
+CMAKE_ARGS+=	-DENABLE_LTO=OFF
+
+# TODO: Make src/ARMJIT_Memory.cpp PaX MPROTECT safe.
+NOT_PAX_MPROTECT_SAFE+=	bin/melonDS
+
+.include "../../devel/SDL2/buildlink3.mk"
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
+.include "../../net/libpcap/buildlink3.mk"
+.include "../../net/libslirp/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../x11/qt5-qtbase/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/melonds/PLIST b/melonds/PLIST
new file mode 100644
index 0000000000..7e0b7edc19
--- /dev/null
+++ b/melonds/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD$
+bin/melonDS
+share/applications/net.kuribo64.melonDS.desktop
+share/icons/hicolor/128x128/apps/net.kuribo64.melonDS.png
+share/icons/hicolor/16x16/apps/net.kuribo64.melonDS.png
+share/icons/hicolor/256x256/apps/net.kuribo64.melonDS.png
+share/icons/hicolor/32x32/apps/net.kuribo64.melonDS.png
+share/icons/hicolor/48x48/apps/net.kuribo64.melonDS.png
+share/icons/hicolor/64x64/apps/net.kuribo64.melonDS.png
diff --git a/melonds/TODO b/melonds/TODO
new file mode 100644
index 0000000000..a7ffde9857
--- /dev/null
+++ b/melonds/TODO
@@ -0,0 +1,2 @@
+Segfaults on game load on NetBSD, seems to be invalid memory access
+on the DTCM variable.
diff --git a/melonds/distinfo b/melonds/distinfo
new file mode 100644
index 0000000000..532a693e18
--- /dev/null
+++ b/melonds/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.2 2019/12/22 22:25:21 joerg Exp $
+
+SHA1 (melonDS-0.9.1.tar.gz) = b785da967f8d330d58a36945cb552c69e1042e74
+RMD160 (melonDS-0.9.1.tar.gz) = 06941c76a6dff993218c234d9e2bf6a6c8e0c813
+SHA512 (melonDS-0.9.1.tar.gz) = 733a9f9352b7f61c76de761c7f632f5fca9c4ae2970a0235a7b5c0e6ca2ea550762472ff293f65ce29aaa63a610bb4f1a22b62e1957004606c2f85be60fbb8f2
+Size (melonDS-0.9.1.tar.gz) = 1311519 bytes
+SHA1 (patch-CMakeLists.txt) = 6f0c1c514c998827c21d3209678c58a05264723a
+SHA1 (patch-src_ARMJIT__Memory.cpp) = 9f1e1a2ecaa0b278a3371812274df62d1461cdd7
+SHA1 (patch-src_frontend_qt__sdl_CMakeLists.txt) = 0311d4eb299c124911a18a69d6808219de74e3ff
diff --git a/melonds/patches/patch-CMakeLists.txt b/melonds/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..6794b58a3c
--- /dev/null
+++ b/melonds/patches/patch-CMakeLists.txt
@@ -0,0 +1,63 @@
+$NetBSD$
+
+Don't use the special gcc-ar, gcc-ranlib when not building with LTO.
+NetBSD's gcc distribution doesn't include these.
+
+https://github.com/Arisotura/melonDS/pull/1018
+
+Don't override pkgsrc CFLAGS.
+
+--- CMakeLists.txt.orig	2020-12-25 13:42:23.000000000 +0000
++++ CMakeLists.txt
+@@ -66,15 +66,6 @@ if (ENABLE_OGLRENDERER)
+     add_definitions(-DOGLRENDERER_ENABLED)
+ endif()
+ 
+-if (CMAKE_BUILD_TYPE STREQUAL Debug)
+-	add_compile_options(-Og)
+-endif()
+-
+-if (CMAKE_BUILD_TYPE STREQUAL Release)
+-	add_compile_options(-O3)
+-	add_link_options(-s)
+-endif()
+-
+ if (WIN32)
+ 	option(BUILD_STATIC "Statically link dependencies" OFF)
+ endif()
+@@ -87,18 +78,17 @@ if (ENABLE_LTO)
+ 		add_compile_options(-flto -fPIC)
+ 		add_link_options(-flto -fuse-linker-plugin -pie)
+ 	endif()
+-endif()
+-
+-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+-	set(CMAKE_AR "gcc-ar")
+-	set(CMAKE_RANLIB "gcc-ranlib")
+-elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+-	find_program(LLD NAMES ld.lld ld64.lld lld-link)
+-	if (NOT LLD STREQUAL "LLD-NOTFOUND")
+-		add_link_options(-fuse-ld=lld)
++	if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
++		set(CMAKE_AR "gcc-ar")
++		set(CMAKE_RANLIB "gcc-ranlib")
++	elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
++		find_program(LLD NAMES ld.lld ld64.lld lld-link)
++		if (NOT LLD STREQUAL "LLD-NOTFOUND")
++			add_link_options(-fuse-ld=lld)
++		endif()
++		set(CMAKE_AR "llvm-ar")
++		set(CMAKE_RANLIB "llvm-ranlib")
+ 	endif()
+-	set(CMAKE_AR "llvm-ar")
+-	set(CMAKE_RANLIB "llvm-ranlib")
+ endif()
+ 
+ option(BUILD_QT_SDL "Build Qt/SDL frontend" ON)
+@@ -107,4 +97,4 @@ add_subdirectory(src)
+ 
+ if (BUILD_QT_SDL)
+ 	add_subdirectory(src/frontend/qt_sdl)
+-endif()
+\ No newline at end of file
++endif()
diff --git a/melonds/patches/patch-src_ARMJIT__Memory.cpp b/melonds/patches/patch-src_ARMJIT__Memory.cpp
new file mode 100644
index 0000000000..7af78b0d38
--- /dev/null
+++ b/melonds/patches/patch-src_ARMJIT__Memory.cpp
@@ -0,0 +1,76 @@
+$NetBSD$
+
+Support NetBSD and PaX MPROTECT.
+
+Use the portable "#ifdef __APPLE__" code on !Linux.
+
+This is now solved a different way upstream.
+
+--- src/ARMJIT_Memory.cpp.orig	2020-12-25 13:42:23.000000000 +0000
++++ src/ARMJIT_Memory.cpp
+@@ -157,6 +157,8 @@ static void SigsegvHandler(int sig, sigi
+     desc.EmulatedFaultAddr = (u8*)info->si_addr - curArea;
+     #ifdef __APPLE__
+         desc.FaultPC = (u8*)context->uc_mcontext->__ss.__rip;
++    #elif defined __NetBSD__
++        desc.FaultPC = (u8*)context->uc_mcontext.__gregs[_REG_RIP];
+     #else
+         desc.FaultPC = (u8*)context->uc_mcontext.gregs[REG_RIP];
+     #endif
+@@ -176,6 +178,8 @@ static void SigsegvHandler(int sig, sigi
+ #ifdef __x86_64__
+         #ifdef __APPLE__
+             context->uc_mcontext->__ss.__rip = (u64)desc.FaultPC;
++        #elif defined __NetBSD__
++            context->uc_mcontext.__gregs[_REG_RIP] = (u64)desc.FaultPC;
+         #else
+             context->uc_mcontext.gregs[REG_RIP] = (u64)desc.FaultPC;
+         #endif
+@@ -739,13 +743,13 @@ void Init()
+         ioctl(fd, ASHMEM_SET_SIZE, MemoryTotalSize);
+         MemoryFile = fd;
+     }
+-#elif defined(__APPLE__)
++#elif defined(__linux__)
++    MemoryFile = memfd_create("melondsfastmem", 0);
++#else
+     char* fastmemPidName = new char[snprintf(NULL, 0, "melondsfastmem%d", getpid()) + 1];
+     sprintf(fastmemPidName, "melondsfastmem%d", getpid());
+     MemoryFile = shm_open(fastmemPidName, O_RDWR|O_CREAT, 0600);
+     delete[] fastmemPidName;
+-#else
+-    MemoryFile = memfd_create("melondsfastmem", 0);
+ #endif
+     ftruncate(MemoryFile, MemoryTotalSize);
+ 
+@@ -781,24 +785,21 @@ void DeInit()
+     svcUnmapProcessCodeMemory(envGetOwnProcessHandle(), (u64)MemoryBaseCodeMem, (u64)MemoryBase, MemoryTotalSize);
+     virtmemFree(MemoryBaseCodeMem, MemoryTotalSize);
+     free(MemoryBase);
+-#elif defined(__APPLE__)
+-    char* fastmemPidName = new char[snprintf(NULL, 0, "melondsfastmem%d", getpid()) + 1];
+-    sprintf(fastmemPidName, "melondsfastmem%d", getpid());
+-    shm_unlink(fastmemPidName);
+-    delete[] fastmemPidName;
+ #elif defined(_WIN32)
+     assert(UnmapViewOfFile(MemoryBase));
+     CloseHandle(MemoryFile);
+ 
+     RemoveVectoredExceptionHandler(ExceptionHandlerHandle);
+-#else
++#elif defined(__linux__)
+     sigaction(SIGSEGV, &OldSaSegv, nullptr);
+-#ifdef __APPLE__
+-    sigaction(SIGBUS, &OldSaBus, nullptr);
+-#endif
+ 
+     munmap(MemoryBase, MemoryTotalSize);
+     close(MemoryFile);
++#else
++    char* fastmemPidName = new char[snprintf(NULL, 0, "melondsfastmem%d", getpid()) + 1];
++    sprintf(fastmemPidName, "melondsfastmem%d", getpid());
++    shm_unlink(fastmemPidName);
++    delete[] fastmemPidName;
+ #endif
+ }
+ 
diff --git a/melonds/patches/patch-src_frontend_qt__sdl_CMakeLists.txt b/melonds/patches/patch-src_frontend_qt__sdl_CMakeLists.txt
new file mode 100644
index 0000000000..bdfd72e484
--- /dev/null
+++ b/melonds/patches/patch-src_frontend_qt__sdl_CMakeLists.txt
@@ -0,0 +1,21 @@
+$NetBSD$
+
+libdl is optional, and not usually present on non-Linux systems.
+
+This is now solved a different way upstream.
+
+--- src/frontend/qt_sdl/CMakeLists.txt.orig	2020-12-25 13:42:23.000000000 +0000
++++ src/frontend/qt_sdl/CMakeLists.txt
+@@ -78,7 +78,11 @@ endif()
+ 
+ if (UNIX)
+     option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
+-    target_link_libraries(melonDS dl Qt5::Core Qt5::Gui Qt5::Widgets)
++    target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
++    find_library(LIBDL NAMES dl)
++    if (LIBDL)
++        target_link_libraries(melonDS ${LIBDL})
++    endif()
+ elseif (WIN32)
+     option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)
+     target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")


Home | Main Index | Thread Index | Old Index