pkgsrc-Changes archive

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

CVS commit: pkgsrc/emulators



Module Name:    pkgsrc
Committed By:   nia
Date:           Tue Nov 14 17:57:41 UTC 2023

Modified Files:
        pkgsrc/emulators: Makefile
Added Files:
        pkgsrc/emulators/duckstation-qt: DESCR Makefile Makefile.common PLIST
            distinfo
        pkgsrc/emulators/duckstation-qt/files: duckstation-qt.desktop
        pkgsrc/emulators/duckstation-qt/patches: patch-CMakeLists.txt
            patch-dep_CMakeLists.txt patch-src_common_CMakeLists.txt
            patch-src_common_byte__stream.cpp patch-src_common_file__system.cpp
            patch-src_common_platform.h patch-src_common_threading.cpp
            patch-src_core_CMakeLists.txt
            patch-src_core_cpu__recompiler__types.h patch-src_core_settings.h
            patch-src_duckstation-nogui_nogui__host.cpp
            patch-src_duckstation-qt_CMakeLists.txt
            patch-src_duckstation-qt_qthost.cpp
            patch-src_duckstation-qt_qttranslations.cpp
            patch-src_frontend-common_CMakeLists.txt
            patch-src_frontend-common_platform__misc__unix.cpp
            patch-src_updater_CMakeLists.txt patch-src_util_CMakeLists.txt
            patch-src_util_jit__code__buffer.cpp
            patch-src_util_memory__arena.cpp patch-src_util_memory__arena.h

Log Message:
Import emulators/duckstation-qt

DuckStation is an simulator/emulator of the Sony PlayStation(TM) console,
focusing on playability, speed, and long-term maintainability. The goal is
to be as accurate as possible while maintaining performance suitable for
low-end devices.

A "BIOS" ROM image is required to to start the emulator and to play games.
You can use an image from any hardware version or region, although mismatching
game regions and BIOS regions may have compatibility issues.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 pkgsrc/emulators/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/emulators/duckstation-qt/DESCR \
    pkgsrc/emulators/duckstation-qt/Makefile \
    pkgsrc/emulators/duckstation-qt/Makefile.common \
    pkgsrc/emulators/duckstation-qt/PLIST \
    pkgsrc/emulators/duckstation-qt/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/emulators/duckstation-qt/files/duckstation-qt.desktop
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/emulators/duckstation-qt/patches/patch-CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-dep_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_common_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_common_byte__stream.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_common_file__system.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_common_platform.h \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_common_threading.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_core_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_core_cpu__recompiler__types.h \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_core_settings.h \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-nogui_nogui__host.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qthost.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qttranslations.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_platform__misc__unix.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_updater_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_util_CMakeLists.txt \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_util_jit__code__buffer.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.cpp \
    pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.h

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

Modified files:

Index: pkgsrc/emulators/Makefile
diff -u pkgsrc/emulators/Makefile:1.352 pkgsrc/emulators/Makefile:1.353
--- pkgsrc/emulators/Makefile:1.352     Mon Jul  3 21:49:20 2023
+++ pkgsrc/emulators/Makefile   Tue Nov 14 17:57:40 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.352 2023/07/03 21:49:20 nia Exp $
+# $NetBSD: Makefile,v 1.353 2023/11/14 17:57:40 nia Exp $
 #
 
 COMMENT=       Emulators for other machines and systems
@@ -58,6 +58,7 @@ SUBDIR+=      dgen
 SUBDIR+=       dolphin-emu
 SUBDIR+=       dosbox
 SUBDIR+=       dosbox-x
+SUBDIR+=       duckstation-qt
 SUBDIR+=       dynagen
 SUBDIR+=       dynamips
 SUBDIR+=       e-uae

Added files:

Index: pkgsrc/emulators/duckstation-qt/DESCR
diff -u /dev/null pkgsrc/emulators/duckstation-qt/DESCR:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/DESCR       Tue Nov 14 17:57:40 2023
@@ -0,0 +1,8 @@
+DuckStation is an simulator/emulator of the Sony PlayStation(TM) console,
+focusing on playability, speed, and long-term maintainability. The goal is
+to be as accurate as possible while maintaining performance suitable for
+low-end devices.
+
+A "BIOS" ROM image is required to to start the emulator and to play games.
+You can use an image from any hardware version or region, although mismatching
+game regions and BIOS regions may have compatibility issues.
Index: pkgsrc/emulators/duckstation-qt/Makefile
diff -u /dev/null pkgsrc/emulators/duckstation-qt/Makefile:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/Makefile    Tue Nov 14 17:57:40 2023
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile,v 1.1 2023/11/14 17:57:40 nia Exp $
+
+.include "../../emulators/duckstation-qt/Makefile.common"
+
+PKGNAME=       ${DISTNAME:S/duckstation-/duckstation-qt-/g}
+COMMENT=       PlayStation emulator aiming for the best accuracy (Qt version)
+
+INSTALLATION_DIRS+=    bin
+INSTALLATION_DIRS+=    share/applications
+INSTALLATION_DIRS+=    share/duckstation
+INSTALLATION_DIRS+=    share/duckstation/translations
+INSTALLATION_DIRS+=    share/pixmaps
+
+NOT_PAX_MPROTECT_SAFE+=        bin/duckstation-qt
+
+do-install:
+       ${INSTALL_PROGRAM} ${WRKSRC}/${CMAKE_BUILD_DIR}/bin/duckstation-qt \
+               ${DESTDIR}${PREFIX}/bin
+       ${INSTALL_DATA} ${FILESDIR}/duckstation-qt.desktop \
+               ${DESTDIR}${PREFIX}/share/applications/duckstation-qt.desktop
+       ${INSTALL_DATA} ${WRKSRC}/data/resources/images/duck.png \
+               ${DESTDIR}${PREFIX}/share/pixmaps/duckstation.png
+       cd ${WRKSRC}/data/resources && \
+               ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/duckstation
+       cd ${WRKSRC}/${CMAKE_BUILD_DIR}/bin/translations && \
+               ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/duckstation/translations
+
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../x11/qt6-qtbase/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/emulators/duckstation-qt/Makefile.common
diff -u /dev/null pkgsrc/emulators/duckstation-qt/Makefile.common:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/Makefile.common     Tue Nov 14 17:57:40 2023
@@ -0,0 +1,57 @@
+# $NetBSD: Makefile.common,v 1.1 2023/11/14 17:57:40 nia Exp $
+
+# This is a separate file out of optimism that the non-qt version will
+# eventually be portable.
+
+GITHUB_TAG=    v0.1-5624
+DISTNAME=      duckstation-${GITHUB_TAG:S/-/./g:S/^v//g}
+CATEGORIES=    emulators
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=stenzek/}
+
+MAINTAINER=    nia%NetBSD.org@localhost
+HOMEPAGE=      https://www.duckstation.org/
+LICENSE=       gnu-gpl-v3
+
+USE_LANGUAGES+=        c c++
+USE_TOOLS+=    pkg-config pax
+
+DISTINFO_FILE= ${.CURDIR}/../../emulators/duckstation-qt/distinfo
+PATCHDIR=      ${.CURDIR}/../../emulators/duckstation-qt/patches
+
+WRKSRC=                ${WRKDIR}/duckstation-${GITHUB_TAG:S/^v//g}
+
+USE_CXX_FEATURES+=     c++17 c++20
+
+ONLY_FOR_PLATFORM+=    *-*-i386
+ONLY_FOR_PLATFORM+=    *-*-x86_64
+ONLY_FOR_PLATFORM+=    *-*-aarch64
+ONLY_FOR_PLATFORM+=    *-*-earmv7hf
+
+CMAKE_ARGS+=           -DENABLE_DISCORD_PRESENCE=OFF
+CMAKE_ARGS+=           -DBUILD_REGTEST=OFF
+CMAKE_ARGS+=           -DUSE_DBUS=OFF
+
+INSTALLATION_DIRS+=    bin
+INSTALLATION_DIRS+=    share/pixmaps
+INSTALLATION_DIRS+=    share/duckstation
+
+SUBST_CLASSES+=                paths
+SUBST_STAGE.paths=     pre-configure
+SUBST_FILES.paths=     src/duckstation-qt/qthost.cpp
+SUBST_FILES.paths+=    src/duckstation-qt/qttranslations.cpp
+SUBST_VARS.paths=      PREFIX
+
+# Sigh...
+BUILDLINK_TRANSFORM+=  l:zlib:z
+
+# Stop cmake/build.mk overriding it.
+do-install:
+
+.include "../../devel/cmake/build.mk"
+.include "../../archivers/minizip/buildlink3.mk"
+.include "../../archivers/zstd/buildlink3.mk"
+.include "../../audio/soundtouch/buildlink3.mk"
+.include "../../devel/SDL2/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../textproc/rapidjson/buildlink3.mk"
+.include "../../www/curl/buildlink3.mk"
Index: pkgsrc/emulators/duckstation-qt/PLIST
diff -u /dev/null pkgsrc/emulators/duckstation-qt/PLIST:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/PLIST       Tue Nov 14 17:57:40 2023
@@ -0,0 +1,57 @@
+@comment $NetBSD: PLIST,v 1.1 2023/11/14 17:57:40 nia Exp $
+bin/duckstation-qt
+share/applications/duckstation-qt.desktop
+share/duckstation/chtdb.txt
+share/duckstation/database/compatibility.xml
+share/duckstation/database/gamedb.json
+share/duckstation/database/gamesettings.ini
+share/duckstation/fonts/LICENSE.txt
+share/duckstation/fonts/Roboto-Regular.ttf
+share/duckstation/fonts/RobotoMono-Medium.ttf
+share/duckstation/fonts/fa-solid-900.ttf
+share/duckstation/fullscreenui/NTSC-J.png
+share/duckstation/fullscreenui/NTSC-U.png
+share/duckstation/fullscreenui/PAL.png
+share/duckstation/fullscreenui/address-book-new.png
+share/duckstation/fullscreenui/applications-system.png
+share/duckstation/fullscreenui/media-cdrom.png
+share/duckstation/fullscreenui/multimedia-player.png
+share/duckstation/fullscreenui/star-0.png
+share/duckstation/fullscreenui/star-1.png
+share/duckstation/fullscreenui/star-2.png
+share/duckstation/fullscreenui/star-3.png
+share/duckstation/fullscreenui/star-4.png
+share/duckstation/fullscreenui/star-5.png
+share/duckstation/gamecontrollerdb.txt
+share/duckstation/images/cover-placeholder.png
+share/duckstation/images/duck.png
+share/duckstation/images/placeholder.png
+share/duckstation/shaders/Cccalibrator.glsl
+share/duckstation/shaders/crt-lottes.glsl
+share/duckstation/shaders/dolphinfx/bloom.glsl
+share/duckstation/shaders/dolphinfx/celshading.glsl
+share/duckstation/shaders/dolphinfx/scanlines.glsl
+share/duckstation/shaders/simple-brightness.glsl
+share/duckstation/shaders/simple-flip.glsl
+share/duckstation/shaders/simple-gamma.glsl
+share/duckstation/shaders/simple-sharpen.glsl
+share/duckstation/sounds/achievements/README.txt
+share/duckstation/sounds/achievements/lbsubmit.wav
+share/duckstation/sounds/achievements/message.wav
+share/duckstation/sounds/achievements/unlock.wav
+share/duckstation/translations/duckstation-qt_de.qm
+share/duckstation/translations/duckstation-qt_en.qm
+share/duckstation/translations/duckstation-qt_es-es.qm
+share/duckstation/translations/duckstation-qt_es.qm
+share/duckstation/translations/duckstation-qt_fr.qm
+share/duckstation/translations/duckstation-qt_he.qm
+share/duckstation/translations/duckstation-qt_it.qm
+share/duckstation/translations/duckstation-qt_ja.qm
+share/duckstation/translations/duckstation-qt_nl.qm
+share/duckstation/translations/duckstation-qt_pl.qm
+share/duckstation/translations/duckstation-qt_pt-br.qm
+share/duckstation/translations/duckstation-qt_pt-pt.qm
+share/duckstation/translations/duckstation-qt_ru.qm
+share/duckstation/translations/duckstation-qt_tr.qm
+share/duckstation/translations/duckstation-qt_zh-cn.qm
+share/pixmaps/duckstation.png
Index: pkgsrc/emulators/duckstation-qt/distinfo
diff -u /dev/null pkgsrc/emulators/duckstation-qt/distinfo:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/distinfo    Tue Nov 14 17:57:40 2023
@@ -0,0 +1,26 @@
+$NetBSD: distinfo,v 1.1 2023/11/14 17:57:40 nia Exp $
+
+BLAKE2s (duckstation-0.1.5624.tar.gz) = 914ceaa61499ad1a53a0569daa966a2332a06fe1665866d825ca9b4e56cc359b
+SHA512 (duckstation-0.1.5624.tar.gz) = 88be9979e5c650a4582cdc4b23bc042fba7f456a187734140b61142d5ba4402a482a2419d01b509abad52ad41c6e9e964736759b51b32b9e16f7dbc5f2705a47
+Size (duckstation-0.1.5624.tar.gz) = 13553293 bytes
+SHA1 (patch-CMakeLists.txt) = d026c98fd72038ce051a1932efb9fc0343112ea5
+SHA1 (patch-dep_CMakeLists.txt) = e8264a079c25391fffa9f2fd4c1fbb45575c40af
+SHA1 (patch-src_common_CMakeLists.txt) = a90039c6d1c30040294f66a37f57cfdfe255696d
+SHA1 (patch-src_common_byte__stream.cpp) = 23fe22853041eaa22578b0a70a3fd324241dfba5
+SHA1 (patch-src_common_file__system.cpp) = 5c337a476e1cdda5d1b7a5b0aabc160bc2aed4ef
+SHA1 (patch-src_common_platform.h) = c7ffd141ccaf4c3293acab5dcc795f517aef6576
+SHA1 (patch-src_common_threading.cpp) = 46812162369b921b9d61e9185aa5a3bae4294f4d
+SHA1 (patch-src_core_CMakeLists.txt) = ce20985c85bd585dfa5d2a4d8432f1beb7ac18aa
+SHA1 (patch-src_core_cpu__recompiler__types.h) = e5de4ff35866db057c03b49b1dec989f71453cef
+SHA1 (patch-src_core_settings.h) = 27f2c0bb5cce0737a7dd7308bcc76ed704250804
+SHA1 (patch-src_duckstation-nogui_nogui__host.cpp) = e5865352a5ebd047a388363da6f76528453fe410
+SHA1 (patch-src_duckstation-qt_CMakeLists.txt) = 19a4dee7490789a2c9aeacba1194d3f218f7e6c8
+SHA1 (patch-src_duckstation-qt_qthost.cpp) = b43d9b5cfaec84597579fd71acde2e8fddeeda1c
+SHA1 (patch-src_duckstation-qt_qttranslations.cpp) = 8d55d4e57a61247561d79cdb947312fc7a758e2a
+SHA1 (patch-src_frontend-common_CMakeLists.txt) = 119ec00a78319b0519a077bb3f07a05b3d4e45c7
+SHA1 (patch-src_frontend-common_platform__misc__unix.cpp) = f7e6542c17168ba74a77a5b2358f6a753ef4598b
+SHA1 (patch-src_updater_CMakeLists.txt) = a78f6d713949a8c99beb54c741869f824110e3e3
+SHA1 (patch-src_util_CMakeLists.txt) = 0b0d034b22ccb70e4cda42e41dda04367a7fd777
+SHA1 (patch-src_util_jit__code__buffer.cpp) = 4605ac55fc05917e1a4789389f6505d5c98b40f4
+SHA1 (patch-src_util_memory__arena.cpp) = 2bc9d39ab7ac7a1328169252fc3079f63d1505bf
+SHA1 (patch-src_util_memory__arena.h) = 24ad75ad086e3f129ab55530d16e5455d02a87fc

Index: pkgsrc/emulators/duckstation-qt/files/duckstation-qt.desktop
diff -u /dev/null pkgsrc/emulators/duckstation-qt/files/duckstation-qt.desktop:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/files/duckstation-qt.desktop        Tue Nov 14 17:57:41 2023
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Encoding=UTF-8
+Name=DuckStation Qt
+Comment=Sony PlayStation emulator
+Icon=duckstation
+Exec=duckstation-qt
+Terminal=false
+Categories=Game;Emulator;

Index: pkgsrc/emulators/duckstation-qt/patches/patch-CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-CMakeLists.txt        Tue Nov 14 17:57:41 2023
@@ -0,0 +1,30 @@
+$NetBSD: patch-CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- CMakeLists.txt.orig        2023-08-12 04:46:09.000000000 +0000
++++ CMakeLists.txt
+@@ -22,6 +22,10 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Fr
+   set(SUPPORTS_X11 TRUE)
+ endif()
+ 
++if(UNIX AND NOT APPLE)
++  set(SUPPORTS_X11 TRUE)
++endif()
++
+ # Set minimum OS version for macOS. 10.14 should work.
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14.0" CACHE STRING "")
+ 
+@@ -46,10 +50,10 @@ endif()
+ if(SUPPORTS_WAYLAND)
+   option(USE_WAYLAND "Support Wayland window system" ON)
+ endif()
+-if((LINUX OR FREEBSD) OR ANDROID)
++if((UNIX AND NOT APPLE) OR ANDROID)
+   option(USE_EGL "Support EGL OpenGL context creation" ON)
+ endif()
+-if((LINUX OR FREEBSD) AND NOT ANDROID)
++if(UNIX AND NOT APPLE AND NOT ANDROID)
+   option(USE_DRMKMS "Support DRM/KMS OpenGL contexts" OFF)
+   option(USE_FBDEV "Support FBDev OpenGL contexts" OFF)
+   option(USE_EVDEV "Support EVDev controller interface" OFF)
Index: pkgsrc/emulators/duckstation-qt/patches/patch-dep_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-dep_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-dep_CMakeLists.txt    Tue Nov 14 17:57:41 2023
@@ -0,0 +1,31 @@
+$NetBSD: patch-dep_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle dependencies.
+
+--- dep/CMakeLists.txt.orig    2023-08-12 04:46:09.000000000 +0000
++++ dep/CMakeLists.txt
+@@ -2,18 +2,19 @@ add_subdirectory(fmt)
+ add_subdirectory(gsl)
+ add_subdirectory(glad)
+ add_subdirectory(stb)
+-add_subdirectory(zlib)
+-add_subdirectory(zstd)
+-add_subdirectory(minizip)
+ add_subdirectory(lzma)
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(ZLIB REQUIRED zlib)
++pkg_check_modules(ZSTD REQUIRED libzstd)
++pkg_check_modules(MINIZIP REQUIRED minizip)
++pkg_check_modules(RAPIDJSON REQUIRED RapidJSON)
++pkg_check_modules(SOUNDTOUCH REQUIRED soundtouch)
+ add_subdirectory(libchdr)
+ add_subdirectory(xxhash)
+-add_subdirectory(rapidjson)
+ add_subdirectory(glslang)
+ add_subdirectory(imgui)
+ add_subdirectory(simpleini)
+ add_subdirectory(vulkan)
+-add_subdirectory(soundtouch)
+ add_subdirectory(tinyxml2)
+ add_subdirectory(googletest)
+ add_subdirectory(cpuinfo)
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_common_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_common_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_common_CMakeLists.txt     Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_common_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle dependencies.
+
+--- src/common/CMakeLists.txt.orig     2023-08-12 04:46:09.000000000 +0000
++++ src/common/CMakeLists.txt
+@@ -62,7 +62,7 @@ add_library(common
+ target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_link_libraries(common PUBLIC fmt Threads::Threads vulkan-headers GSL fast_float)
+-target_link_libraries(common PRIVATE stb libchdr zlib minizip Zstd::Zstd "${CMAKE_DL_LIBS}")
++target_link_libraries(common PRIVATE stb libchdr ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${ZSTD_LIBRARIES} "${CMAKE_DL_LIBS}")
+ 
+ if(WIN32)
+   target_sources(common PRIVATE
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_common_byte__stream.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_common_byte__stream.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_common_byte__stream.cpp   Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_common_byte__stream.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/common/byte_stream.cpp.orig    2023-08-12 04:46:09.000000000 +0000
++++ src/common/byte_stream.cpp
+@@ -27,7 +27,7 @@
+ 
+ #ifdef _MSC_VER
+ #include <malloc.h>
+-#else
++#elif defined(__linux__) || defined(__sun)
+ #include <alloca.h>
+ #endif
+ 
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_common_file__system.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_common_file__system.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_common_file__system.cpp   Tue Nov 14 17:57:41 2023
@@ -0,0 +1,121 @@
+$NetBSD: patch-src_common_file__system.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/common/file_system.cpp.orig    2023-08-12 04:46:09.000000000 +0000
++++ src/common/file_system.cpp
+@@ -17,7 +17,7 @@
+ #include <sys/param.h>
+ #endif
+ 
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <sys/sysctl.h>
+ #endif
+ 
+@@ -1474,15 +1474,14 @@ static u32 RecursiveFindFiles(const char
+     FILESYSTEM_FIND_DATA outData;
+     outData.Attributes = 0;
+ 
+-#if defined(__HAIKU__) || defined(__APPLE__) || defined(__FreeBSD__)
+-    struct stat sDir;
+-    if (stat(full_path.c_str(), &sDir) < 0)
+-      continue;
+-
+-#else
++#ifdef __linux__
+     struct stat64 sDir;
+     if (stat64(full_path.c_str(), &sDir) < 0)
+       continue;
++#else
++    struct stat sDir;
++    if (stat(full_path.c_str(), &sDir) < 0)
++      continue;
+ #endif
+ 
+     if (S_ISDIR(sDir.st_mode))
+@@ -1587,12 +1586,12 @@ bool FileSystem::StatFile(const char* pa
+     return false;
+ 
+     // stat file
+-#if defined(__HAIKU__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  struct stat sysStatData;
+-  if (stat(path, &sysStatData) < 0)
+-#else
++#ifdef __linux__
+   struct stat64 sysStatData;
+   if (stat64(path, &sysStatData) < 0)
++#else
++  struct stat sysStatData;
++  if (stat(path, &sysStatData) < 0)
+ #endif
+     return false;
+ 
+@@ -1620,12 +1619,12 @@ bool FileSystem::StatFile(std::FILE* fp,
+     return false;
+ 
+     // stat file
+-#if defined(__HAIKU__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  struct stat sysStatData;
+-  if (fstat(fd, &sysStatData) < 0)
+-#else
++#ifdef __linux__
+   struct stat64 sysStatData;
+   if (fstat64(fd, &sysStatData) < 0)
++#else
++  struct stat sysStatData;
++  if (fstat(fd, &sysStatData) < 0)
+ #endif
+     return false;
+ 
+@@ -1653,12 +1652,12 @@ bool FileSystem::FileExists(const char* 
+     return false;
+ 
+     // stat file
+-#if defined(__HAIKU__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  struct stat sysStatData;
+-  if (stat(path, &sysStatData) < 0)
+-#else
++#ifdef __linux__
+   struct stat64 sysStatData;
+   if (stat64(path, &sysStatData) < 0)
++#else
++  struct stat sysStatData;
++  if (stat(path, &sysStatData) < 0)
+ #endif
+     return false;
+ 
+@@ -1675,12 +1674,12 @@ bool FileSystem::DirectoryExists(const c
+     return false;
+ 
+     // stat file
+-#if defined(__HAIKU__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  struct stat sysStatData;
+-  if (stat(path, &sysStatData) < 0)
+-#else
++#ifdef __linux__
+   struct stat64 sysStatData;
+   if (stat64(path, &sysStatData) < 0)
++#else
++  struct stat sysStatData;
++  if (stat(path, &sysStatData) < 0)
+ #endif
+     return false;
+ 
+@@ -1886,6 +1885,16 @@ std::string FileSystem::GetProgramPath()
+ 
+   buffer[cb] = '\0';
+   return buffer;
++#elif defined(__NetBSD__)
++  int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
++  char buffer[PATH_MAX];
++  size_t cb = sizeof(buffer) - 1;
++  int res = sysctl(mib, std::size(mib), buffer, &cb, nullptr, 0);
++  if (res != 0)
++    return {};
++
++  buffer[cb] = '\0';
++  return buffer;
+ #else
+   return {};
+ #endif
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_common_platform.h
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_common_platform.h:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_common_platform.h Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_common_platform.h,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/common/platform.h.orig 2023-08-12 04:46:09.000000000 +0000
++++ src/common/platform.h
+@@ -57,6 +57,8 @@
+ #define SYSTEM_STR "Linux"
+ #elif defined(__FreeBSD__)
+ #define SYSTEM_STR "FreeBSD"
++#elif defined(__NetBSD__)
++#define SYSTEM_STR "NetBSD"
+ #elif defined(__APPLE__)
+ #define SYSTEM_STR "macOS"
+ #else
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_common_threading.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_common_threading.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_common_threading.cpp      Tue Nov 14 17:57:41 2023
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_common_threading.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/common/threading.cpp.orig      2023-08-12 04:46:09.000000000 +0000
++++ src/common/threading.cpp
+@@ -33,7 +33,7 @@
+ #include <mach/mach_time.h>
+ #include <mach/semaphore.h>
+ #include <mach/task.h>
+-#else
++#elif defined (__linux__)
+ #include <pthread_np.h>
+ #endif
+ #endif
+@@ -473,8 +473,10 @@ u64 Threading::GetThreadCpuTime()
+   return user.u64time + kernel.u64time;
+ #elif defined(__APPLE__)
+   return getthreadtime(pthread_mach_thread_np(pthread_self()));
+-#else
++#elif defined(__linux__)
+   return get_thread_time(nullptr);
++#else
++  return 0;
+ #endif
+ }
+ 
+@@ -556,6 +558,8 @@ void Threading::SetNameOfCurrentThread(c
+   prctl(PR_SET_NAME, name, 0, 0, 0);
+ #elif defined(__APPLE__)
+   pthread_setname_np(name);
++#elif defined(__NetBSD__)
++  pthread_setname_np(pthread_self(), "%s", (void *)name);
+ #else
+   pthread_set_name_np(pthread_self(), name);
+ #endif
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_core_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_core_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_core_CMakeLists.txt       Tue Nov 14 17:57:41 2023
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_core_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle dependencies.
+
+--- src/core/CMakeLists.txt.orig       2023-08-12 04:46:09.000000000 +0000
++++ src/core/CMakeLists.txt
+@@ -119,8 +119,8 @@ set(RECOMPILER_SRCS
+ 
+ target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
+-target_link_libraries(core PUBLIC Threads::Threads common util zlib)
+-target_link_libraries(core PRIVATE stb xxhash imgui rapidjson tinyxml2)
++target_link_libraries(core PUBLIC Threads::Threads common util ${ZLIB_LIBRARIES})
++target_link_libraries(core PRIVATE stb xxhash imgui ${RAPIDJSON_LIBRARIES} tinyxml2)
+ 
+ if(WIN32)
+   target_sources(core PRIVATE
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_core_cpu__recompiler__types.h
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_core_cpu__recompiler__types.h:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_core_cpu__recompiler__types.h     Tue Nov 14 17:57:41 2023
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_core_cpu__recompiler__types.h,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/core/cpu_recompiler_types.h.orig       2023-08-12 04:46:09.000000000 +0000
++++ src/core/cpu_recompiler_types.h
+@@ -86,10 +86,8 @@ constexpr u32 CODE_STORAGE_ALIGNMENT = 4
+ // ABI selection
+ #if defined(_WIN32)
+ #define ABI_WIN64 1
+-#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
+-#define ABI_SYSV 1
+ #else
+-#error Unknown ABI.
++#define ABI_SYSV 1
+ #endif
+ 
+ #elif defined(CPU_AARCH32)
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_core_settings.h
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_core_settings.h:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_core_settings.h   Tue Nov 14 17:57:41 2023
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_core_settings.h,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/core/settings.h.orig   2023-08-12 04:46:09.000000000 +0000
++++ src/core/settings.h
+@@ -417,7 +417,9 @@ struct Settings
+ 
+ #ifdef WITH_RECOMPILER
+   static constexpr CPUExecutionMode DEFAULT_CPU_EXECUTION_MODE = CPUExecutionMode::Recompiler;
+-#ifdef WITH_MMAP_FASTMEM
++#ifdef __NetBSD__
++  static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled;
++#elif defined(WITH_MMAP_FASTMEM)
+   static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::MMap;
+ #else
+   static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::LUT;
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-nogui_nogui__host.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-nogui_nogui__host.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-nogui_nogui__host.cpp Tue Nov 14 17:57:41 2023
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_duckstation-nogui_nogui__host.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/duckstation-nogui/nogui_host.cpp.orig  2023-08-12 04:46:09.000000000 +0000
++++ src/duckstation-nogui/nogui_host.cpp
+@@ -183,7 +183,12 @@ void NoGUIHost::SetDataDirectory()
+       EmuFolders::DataRoot = Path::Combine(StringUtil::WideStringToUTF8String(documents_directory), "DuckStation");
+     CoTaskMemFree(documents_directory);
+   }
+-#elif defined(__linux__)
++#elif defined(__APPLE__)
++  static constexpr char MAC_DATA_DIR[] = "Library/Application Support/DuckStation";
++  const char* home_dir = getenv("HOME");
++  if (home_dir)
++    EmuFolders::DataRoot = Path::Combine(home_dir, MAC_DATA_DIR);
++#else
+   // Use $XDG_CONFIG_HOME/duckstation if it exists.
+   const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
+   if (xdg_config_home && Path::IsAbsolute(xdg_config_home))
+@@ -204,11 +209,6 @@ void NoGUIHost::SetDataDirectory()
+       EmuFolders::DataRoot = Path::Combine(share_dir, "duckstation");
+     }
+   }
+-#elif defined(__APPLE__)
+-  static constexpr char MAC_DATA_DIR[] = "Library/Application Support/DuckStation";
+-  const char* home_dir = getenv("HOME");
+-  if (home_dir)
+-    EmuFolders::DataRoot = Path::Combine(home_dir, MAC_DATA_DIR);
+ #endif
+ 
+   // make sure it exists
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_CMakeLists.txt     Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_duckstation-qt_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle dependencies.
+
+--- src/duckstation-qt/CMakeLists.txt.orig     2023-08-12 04:46:09.000000000 +0000
++++ src/duckstation-qt/CMakeLists.txt
+@@ -170,7 +170,7 @@ qt6_add_translation(QM_FILES ${TS_FILES}
+ 
+ add_executable(duckstation-qt ${SRCS} ${QM_FILES})
+ target_include_directories(duckstation-qt PRIVATE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}")
+-target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
++target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad ${MINIZIP_LIBRARIES} ${SOUNDTOUCH_LIBRARIES} scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
+ 
+ if(WIN32)
+   # We want a Windows subsystem application not console.
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qthost.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qthost.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qthost.cpp Tue Nov 14 17:57:41 2023
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_duckstation-qt_qthost.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/duckstation-qt/qthost.cpp.orig 2023-08-12 04:46:09.000000000 +0000
++++ src/duckstation-qt/qthost.cpp
+@@ -240,13 +240,7 @@ void QtHost::SetAppRoot()
+ 
+ void QtHost::SetResourcesDirectory()
+ {
+-#ifndef __APPLE__
+-  // On Windows/Linux, these are in the binary directory.
+-  EmuFolders::Resources = Path::Combine(EmuFolders::AppRoot, "resources");
+-#else
+-  // On macOS, this is in the bundle resources directory.
+-  EmuFolders::Resources = Path::Canonicalize(Path::Combine(EmuFolders::AppRoot, "../Resources"));
+-#endif
++  EmuFolders::Resources = "@PREFIX@/share/duckstation";
+ }
+ 
+ void QtHost::SetDataDirectory()
+@@ -270,7 +264,12 @@ void QtHost::SetDataDirectory()
+       EmuFolders::DataRoot = Path::Combine(StringUtil::WideStringToUTF8String(documents_directory), "DuckStation");
+     CoTaskMemFree(documents_directory);
+   }
+-#elif defined(__linux__)
++#elif defined(__APPLE__)
++  static constexpr char MAC_DATA_DIR[] = "Library/Application Support/DuckStation";
++  const char* home_dir = getenv("HOME");
++  if (home_dir)
++    EmuFolders::DataRoot = Path::Combine(home_dir, MAC_DATA_DIR);
++#else
+   // Use $XDG_CONFIG_HOME/duckstation if it exists.
+   const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
+   if (xdg_config_home && Path::IsAbsolute(xdg_config_home))
+@@ -291,11 +290,6 @@ void QtHost::SetDataDirectory()
+       EmuFolders::DataRoot = Path::Combine(share_dir, "duckstation");
+     }
+   }
+-#elif defined(__APPLE__)
+-  static constexpr char MAC_DATA_DIR[] = "Library/Application Support/DuckStation";
+-  const char* home_dir = getenv("HOME");
+-  if (home_dir)
+-    EmuFolders::DataRoot = Path::Combine(home_dir, MAC_DATA_DIR);
+ #endif
+ 
+   // make sure it exists
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qttranslations.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qttranslations.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_duckstation-qt_qttranslations.cpp Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_duckstation-qt_qttranslations.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+pkgsrc paths.
+
+--- src/duckstation-qt/qttranslations.cpp.orig 2023-08-12 04:46:09.000000000 +0000
++++ src/duckstation-qt/qttranslations.cpp
+@@ -41,7 +41,7 @@ void QtHost::InstallTranslator()
+   const QString language(QString::fromStdString(Host::GetBaseStringSettingValue("Main", "Language", "en")));
+ 
+   // install the base qt translation first
+-  const QString base_dir(QStringLiteral("%1/translations").arg(qApp->applicationDirPath()));
++  const QString base_dir(QStringLiteral("@PREFIX@/share/duckstation/translations"));
+   QString base_path(QStringLiteral("%1/qtbase_%2.qm").arg(base_dir).arg(language));
+   bool has_base_ts = QFile::exists(base_path);
+   if (!has_base_ts)
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_CMakeLists.txt    Tue Nov 14 17:57:41 2023
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_frontend-common_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle libraries.
+
+--- src/frontend-common/CMakeLists.txt.orig    2023-08-12 04:46:09.000000000 +0000
++++ src/frontend-common/CMakeLists.txt
+@@ -27,7 +27,7 @@ add_library(frontend-common
+   postprocessing_shadergen.h
+ )
+ 
+-target_link_libraries(frontend-common PUBLIC core common imgui tinyxml2 rapidjson scmversion)
++target_link_libraries(frontend-common PUBLIC core common imgui tinyxml2 ${RAPIDJSON_LIBRARIES} scmversion)
+ 
+ if(ENABLE_CUBEB)
+   target_sources(frontend-common PRIVATE
+@@ -145,7 +145,7 @@ if(ENABLE_CHEEVOS)
+     achievements.h
+   )
+   target_compile_definitions(frontend-common PUBLIC -DWITH_CHEEVOS=1)
+-  target_link_libraries(frontend-common PRIVATE rcheevos rapidjson)
++  target_link_libraries(frontend-common PRIVATE rcheevos ${RAPIDJSON_LIBRARIES})
+ endif()
+ 
+ # Copy the provided data directory to the output directory.
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_platform__misc__unix.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_platform__misc__unix.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_frontend-common_platform__misc__unix.cpp  Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_frontend-common_platform__misc__unix.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/frontend-common/platform_misc_unix.cpp.orig    2023-08-12 04:46:09.000000000 +0000
++++ src/frontend-common/platform_misc_unix.cpp
+@@ -16,6 +16,8 @@ Log_SetChannel(FrontendCommon);
+ #include <cstdio>
+ #include <sys/wait.h>
+ 
++extern char **environ;
++
+ static bool SetScreensaverInhibitX11(bool inhibit, const WindowInfo& wi)
+ {
+   TinyString command;
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_updater_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_updater_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_updater_CMakeLists.txt    Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_updater_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle libraries.
+
+--- src/updater/CMakeLists.txt.orig    2023-08-12 04:46:09.000000000 +0000
++++ src/updater/CMakeLists.txt
+@@ -3,7 +3,7 @@ add_executable(updater
+   updater.h
+ )
+ 
+-target_link_libraries(updater PRIVATE common minizip zlib)
++target_link_libraries(updater PRIVATE common ${MINIZIP_LIBRARIES} ${ZLIB_LIBRARIES})
+ 
+ if(WIN32)
+   target_sources(updater PRIVATE
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_util_CMakeLists.txt
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_util_CMakeLists.txt:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_util_CMakeLists.txt       Tue Nov 14 17:57:41 2023
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_util_CMakeLists.txt,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+Unbundle libraries.
+
+--- src/util/CMakeLists.txt.orig       2023-08-12 04:46:09.000000000 +0000
++++ src/util/CMakeLists.txt
+@@ -42,4 +42,4 @@ add_library(util
+ target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_link_libraries(util PUBLIC common simpleini)
+-target_link_libraries(util PRIVATE libchdr zlib soundtouch)
++target_link_libraries(util PRIVATE libchdr ${ZLIB_LIBRARIES} ${SOUNDTOUCH_LINK_LIBRARIES})
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_util_jit__code__buffer.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_util_jit__code__buffer.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_util_jit__code__buffer.cpp        Tue Nov 14 17:57:41 2023
@@ -0,0 +1,49 @@
+$NetBSD: patch-src_util_jit__code__buffer.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/util/jit_code_buffer.cpp.orig  2023-08-12 04:46:09.000000000 +0000
++++ src/util/jit_code_buffer.cpp
+@@ -53,7 +53,7 @@ bool JitCodeBuffer::Allocate(u32 size /*
+     Log_ErrorPrintf("VirtualAlloc(RWX, %u) for internal buffer failed: %u", m_total_size, GetLastError());
+     return false;
+   }
+-#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
++#else
+   int flags = MAP_PRIVATE | MAP_ANONYMOUS;
+ #if defined(__APPLE__) && defined(__aarch64__)
+   // MAP_JIT and toggleable write protection is required on Apple Silicon.
+@@ -66,8 +66,6 @@ bool JitCodeBuffer::Allocate(u32 size /*
+     Log_ErrorPrintf("mmap(RWX, %u) for internal buffer failed: %d", m_total_size, errno);
+     return false;
+   }
+-#else
+-  return false;
+ #endif
+ 
+   m_free_code_ptr = m_code_ptr;
+@@ -113,7 +111,7 @@ bool JitCodeBuffer::Initialize(void* buf
+ 
+   m_code_ptr = static_cast<u8*>(buffer);
+   m_old_protection = static_cast<u32>(old_protect);
+-#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
++#else
+   if (mprotect(buffer, size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+   {
+     Log_ErrorPrintf("mprotect(RWX) for external buffer failed: %d", errno);
+@@ -133,8 +131,6 @@ bool JitCodeBuffer::Initialize(void* buf
+   // reasonable default?
+   m_code_ptr = static_cast<u8*>(buffer);
+   m_old_protection = PROT_READ | PROT_WRITE;
+-#else
+-  m_code_ptr = nullptr;
+ #endif
+ 
+   if (!m_code_ptr)
+@@ -298,4 +294,4 @@ void JitCodeBuffer::WriteProtect(bool en
+   pthread_jit_write_protect_np(enabled ? 1 : 0);
+ }
+ 
+-#endif
+\ No newline at end of file
++#endif
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.cpp
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.cpp:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.cpp    Tue Nov 14 17:57:41 2023
@@ -0,0 +1,174 @@
+$NetBSD: patch-src_util_memory__arena.cpp,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/util/memory_arena.cpp.orig     2023-08-12 04:46:09.000000000 +0000
++++ src/util/memory_arena.cpp
+@@ -16,7 +16,7 @@ Log_SetChannel(Common::MemoryArena);
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+ #include <unistd.h>
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
++#else
+ #include <cerrno>
+ #include <fcntl.h>
+ #include <sys/mman.h>
+@@ -76,16 +76,14 @@ void* MemoryArena::FindBaseAddressForMap
+   base_address = VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
+   if (base_address)
+     VirtualFree(base_address, 0, MEM_RELEASE);
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  base_address = mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
+-  if (base_address)
+-    munmap(base_address, size);
+ #elif defined(__ANDROID__)
+   base_address = mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_SHARED, -1, 0);
+   if (base_address)
+     munmap(base_address, size);
+ #else
+-  base_address = nullptr;
++  base_address = mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
++  if (base_address)
++    munmap(base_address, size);
+ #endif
+ 
+   if (!base_address)
+@@ -110,13 +108,11 @@ static std::string GetFileMappingName()
+ {
+ #if defined(_WIN32)
+   const unsigned pid = GetCurrentProcessId();
+-#elif defined(__ANDROID__) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  const unsigned pid = static_cast<unsigned>(getpid());
+ #else
+-#error Unknown platform.
++  const unsigned pid = static_cast<unsigned>(getpid());
+ #endif
+ 
+-  const std::string ret(StringUtil::StdStringFromFormat("duckstation_%u", pid));
++  const std::string ret(StringUtil::StdStringFromFormat("/duckstation_%u", pid));
+   Log_InfoPrintf("File mapping name: %s", ret.c_str());
+   return ret;
+ }
+@@ -176,11 +172,11 @@ bool MemoryArena::Create(size_t size, bo
+   m_writable = writable;
+   m_executable = executable;
+   return true;
+-#elif defined(__APPLE__) || defined(__FreeBSD__)
+-#if defined(__APPLE__)
+-  m_shmem_fd = shm_open(file_mapping_name.c_str(), O_CREAT | O_EXCL | (writable ? O_RDWR : O_RDONLY), 0600);
+ #else
++#ifdef SHM_ANON
+   m_shmem_fd = shm_open(SHM_ANON, O_CREAT | O_EXCL | (writable ? O_RDWR : O_RDONLY), 0600);
++#else
++  m_shmem_fd = shm_open(file_mapping_name.c_str(), O_CREAT | O_EXCL | (writable ? O_RDWR : O_RDONLY), 0600);
+ #endif
+ 
+   if (m_shmem_fd < 0)
+@@ -189,7 +185,7 @@ bool MemoryArena::Create(size_t size, bo
+     return false;
+   }
+ 
+-#ifdef __APPLE__
++#ifndef SHM_ANON
+   // we're not going to be opening this mapping in other processes, so remove the file
+   shm_unlink(file_mapping_name.c_str());
+ #endif
+@@ -205,8 +201,6 @@ bool MemoryArena::Create(size_t size, bo
+   m_writable = writable;
+   m_executable = executable;
+   return true;
+-#else
+-  return false;
+ #endif
+ }
+ 
+@@ -218,7 +212,7 @@ void MemoryArena::Destroy()
+     CloseHandle(m_file_handle);
+     m_file_handle = nullptr;
+   }
+-#elif defined(__linux__) || defined(__FreeBSD__)
++#elif defined(__linux__) || defined(SHM_ANON)
+   if (m_shmem_fd > 0)
+   {
+     close(m_shmem_fd);
+@@ -256,14 +250,12 @@ void* MemoryArena::CreateViewPtr(size_t 
+     MapViewOfFileEx(m_file_handle, desired_access, Truncate32(offset >> 32), Truncate32(offset), size, fixed_address);
+   if (!base_pointer)
+     return nullptr;
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
++#else
+   const int flags = (fixed_address != nullptr) ? (MAP_SHARED | MAP_FIXED) : MAP_SHARED;
+   const int prot = PROT_READ | (writable ? PROT_WRITE : 0) | (executable ? PROT_EXEC : 0);
+   base_pointer = mmap(fixed_address, size, prot, flags, m_shmem_fd, static_cast<off_t>(offset));
+   if (base_pointer == reinterpret_cast<void*>(-1))
+     return nullptr;
+-#else
+-  return nullptr;
+ #endif
+ 
+   m_num_views.fetch_add(1);
+@@ -274,10 +266,8 @@ bool MemoryArena::FlushViewPtr(void* add
+ {
+ #if defined(_WIN32)
+   return FlushViewOfFile(address, size);
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  return (msync(address, size, 0) >= 0);
+ #else
+-  return false;
++  return (msync(address, size, 0) >= 0);
+ #endif
+ }
+ 
+@@ -286,10 +276,8 @@ bool MemoryArena::ReleaseViewPtr(void* a
+   bool result;
+ #if defined(_WIN32)
+   result = static_cast<bool>(UnmapViewOfFile(address));
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  result = (munmap(address, size) >= 0);
+ #else
+-  result = false;
++  result = (munmap(address, size) >= 0);
+ #endif
+ 
+   if (!result)
+@@ -308,14 +296,12 @@ void* MemoryArena::CreateReservedPtr(siz
+   void* base_pointer;
+ #if defined(_WIN32)
+   base_pointer = VirtualAlloc(fixed_address, size, MEM_RESERVE, PAGE_NOACCESS);
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
++#else
+   const int flags =
+     (fixed_address != nullptr) ? (MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED) : (MAP_PRIVATE | MAP_ANONYMOUS);
+   base_pointer = mmap(fixed_address, size, PROT_NONE, flags, -1, 0);
+   if (base_pointer == reinterpret_cast<void*>(-1))
+     return nullptr;
+-#else
+-  return nullptr;
+ #endif
+ 
+   m_num_views.fetch_add(1);
+@@ -327,10 +313,8 @@ bool MemoryArena::ReleaseReservedPtr(voi
+   bool result;
+ #if defined(_WIN32)
+   result = static_cast<bool>(VirtualFree(address, 0, MEM_RELEASE));
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+-  result = (munmap(address, size) >= 0);
+ #else
+-  result = false;
++  result = (munmap(address, size) >= 0);
+ #endif
+ 
+   if (!result)
+@@ -354,11 +338,9 @@ bool MemoryArena::SetPageProtection(void
+   DWORD old_protect;
+   return static_cast<bool>(
+     VirtualProtect(address, length, protection_table[readable][writable][executable], &old_protect));
+-#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__FreeBSD__)
++#else
+   const int prot = (readable ? PROT_READ : 0) | (writable ? PROT_WRITE : 0) | (executable ? PROT_EXEC : 0);
+   return (mprotect(address, length, prot) >= 0);
+-#else
+-  return false;
+ #endif
+ }
+ 
Index: pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.h
diff -u /dev/null pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.h:1.1
--- /dev/null   Tue Nov 14 17:57:41 2023
+++ pkgsrc/emulators/duckstation-qt/patches/patch-src_util_memory__arena.h      Tue Nov 14 17:57:41 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_util_memory__arena.h,v 1.1 2023/11/14 17:57:41 nia Exp $
+
+NetBSD (and more POSIX platforms) support.
+
+--- src/util/memory_arena.h.orig       2023-08-12 04:46:09.000000000 +0000
++++ src/util/memory_arena.h
+@@ -65,7 +65,7 @@ public:
+ private:
+ #if defined(_WIN32)
+   void* m_file_handle = nullptr;
+-#elif defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(__FreeBSD__)
++#else
+   int m_shmem_fd = -1;
+ #endif
+ 



Home | Main Index | Thread Index | Old Index