From f88567b6661613cfe5b749db0f06e08e76d35ac7 Mon Sep 17 00:00:00 2001 From: qubitnano <146656568+qubitnano@users.noreply.github.com> Date: Sun, 30 Jun 2024 11:17:24 -0400 Subject: [PATCH 1/2] duckstation: 0.1-6759 -> 0.1-7465 Note: this is the last commit with the previous GPL license --- pkgs/by-name/du/duckstation/package.nix | 11 ++ pkgs/by-name/du/duckstation/sources.nix | 127 ++++++++++++++++++++---- 2 files changed, 121 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/du/duckstation/package.nix b/pkgs/by-name/du/duckstation/package.nix index f65be766b7c6f..9148b76144f60 100644 --- a/pkgs/by-name/du/duckstation/package.nix +++ b/pkgs/by-name/du/duckstation/package.nix @@ -4,8 +4,10 @@ SDL2, callPackage, cmake, + cpuinfo, cubeb, curl, + discord-rpc, extra-cmake-modules, libXrandr, libbacktrace, @@ -16,6 +18,7 @@ qt6, vulkan-loader, wayland, + wayland-scanner, }: let @@ -43,11 +46,13 @@ stdenv.mkDerivation (finalAttrs: { ninja pkg-config qttools + wayland-scanner wrapQtAppsHook ]; buildInputs = [ SDL2 + cpuinfo curl extra-cmake-modules libXrandr @@ -56,7 +61,11 @@ stdenv.mkDerivation (finalAttrs: { qtbase qtsvg qtwayland + sources.discord-rpc-patched + sources.lunasvg sources.shaderc-patched + sources.soundtouch-patched + sources.spirv-cross-patched wayland ] ++ cubeb.passthru.backendLibs; @@ -105,6 +114,8 @@ stdenv.mkDerivation (finalAttrs: { let libPath = lib.makeLibraryPath ( [ + sources.shaderc-patched + sources.spirv-cross-patched vulkan-loader ] ++ cubeb.passthru.backendLibs diff --git a/pkgs/by-name/du/duckstation/sources.nix b/pkgs/by-name/du/duckstation/sources.nix index 3978dcbf7de64..701499ea28f6b 100644 --- a/pkgs/by-name/du/duckstation/sources.nix +++ b/pkgs/by-name/du/duckstation/sources.nix @@ -4,6 +4,11 @@ fetchFromGitHub, fetchpatch, shaderc, + spirv-cross, + discord-rpc, + stdenv, + cmake, + ninja, }: { @@ -11,11 +16,11 @@ let self = { pname = "duckstation"; - version = "0.1-6759"; + version = "0.1-7465"; src = fetchFromGitHub { owner = "stenzek"; repo = "duckstation"; - rev = "refs/tags/v${self.version}"; + rev = "aa955b8ae28314ae061613f0ddf13183a98aca03"; # # Some files are filled by using Git commands; it requires deepClone. # More info at `checkout_ref` function in nix-prefetch-git. @@ -37,7 +42,7 @@ git log -1 --date=iso8601-strict --format=%cd > .nixpkgs-auxfiles/git_date find $out -name .git -print0 | xargs -0 rm -fr ''; - hash = "sha256-HETo7mChBASnr5prPUWcOhS4TIESFdrs1haEXQpnuzs="; + hash = "sha256-ixrlr7Rm6GZAn/kh2sSeCCiK/qdmQ5+5jbbhAKjTx/E="; }; }; in @@ -46,28 +51,116 @@ shaderc-patched = shaderc.overrideAttrs ( old: let - version = "2024.0"; + version = "2024.3-unstable-2024-08-24"; src = fetchFromGitHub { - owner = "google"; + owner = "stenzek"; repo = "shaderc"; - rev = "v${version}"; - hash = "sha256-Cwp7WbaKWw/wL9m70wfYu47xoUGQW+QGeoYhbyyzstQ="; + rev = "f60bb80e255144e71776e2ad570d89b78ea2ab4f"; + hash = "sha256-puZxkrEVhhUT4UcCtEDmtOMX4ugkB6ooMhKRBlb++lE="; }; in { pname = "shaderc-patched-for-duckstation"; inherit version src; - patches = (old.patches or [ ]) ++ [ - (fetchpatch { - url = "file://${duckstation.src}/scripts/shaderc-changes.patch"; - hash = "sha256-Ps/D+CdSbjVWg3ZGOEcgbpQbCNkI5Nuizm4E5qiM9Wo="; - excludes = [ - "CHANGES" - "CMakeLists.txt" - "libshaderc/CMakeLists.txt" - ]; - }) + patches = (old.patches or [ ]); + cmakeFlags = (old.cmakeFlags or [ ]) ++ [ + (lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true) + (lib.cmakeBool "SHADERC_SKIP_TESTS" true) + ]; + outputs = [ + "out" + "lib" + "dev" + ]; + postFixup = ''''; + } + ); + spirv-cross-patched = spirv-cross.overrideAttrs ( + old: + let + version = "1.3.290.0"; + src = fetchFromGitHub { + owner = "KhronosGroup"; + repo = "SPIRV-Cross"; + rev = "vulkan-sdk-${version}"; + hash = "sha256-h5My9PbPq1l03xpXQQFolNy7G1RhExtTH6qPg7vVF/8="; + }; + in + { + pname = "spirv-cross-patched-for-duckstation"; + inherit version src; + patches = (old.patches or [ ]); + cmakeFlags = (old.cmakeFlags or [ ]) ++ [ + (lib.cmakeBool "SPIRV_CROSS_CLI" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_CPP" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_C_API" true) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_GLSL" true) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_HLSL" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_MSL" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_REFLECT" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_TESTS" false) + (lib.cmakeBool "SPIRV_CROSS_ENABLE_UTIL" true) + (lib.cmakeBool "SPIRV_CROSS_SHARED" true) + (lib.cmakeBool "SPIRV_CROSS_STATIC" false) ]; } ); + discord-rpc-patched = discord-rpc.overrideAttrs (old: { + pname = "discord-rpc-patched-for-duckstation"; + version = "3.4.0-unstable-2024-08-02"; + src = fetchFromGitHub { + owner = "stenzek"; + repo = "discord-rpc"; + rev = "144f3a3f1209994d8d9e8a87964a989cb9911c1e"; + hash = "sha256-VyL8bEjY001eHWcEoUPIAFDAmaAbwcNb1hqlV2a3cWs="; + }; + patches = (old.patches or [ ]); + }); + + soundtouch-patched = stdenv.mkDerivation (finalAttrs: { + pname = "soundtouch-patched-for-duckstation"; + version = "2.2.3-unstable-2024-08-02"; + src = fetchFromGitHub { + owner = "stenzek"; + repo = "soundtouch"; + rev = "463ade388f3a51da078dc9ed062bf28e4ba29da7"; + hash = "sha256-hvBW/z+fmh/itNsJnlDBtiI1DZmUMO9TpHEztjo2pA0="; + }; + + nativeBuildInputs = [ + cmake + ninja + ]; + + meta = { + homepage = "https://github.com/stenzek/soundtouch"; + description = "SoundTouch Audio Processing Library (forked from https://codeberg.org/soundtouch/soundtouch)"; + license = lib.licenses.lgpl21; + platforms = lib.platforms.linux; + }; + + }); + + lunasvg = stdenv.mkDerivation (finalAttrs: { + pname = "lunasvg-patched-for-duckstation"; + version = "2.4.1-unstable-2024-08-24"; + src = fetchFromGitHub { + owner = "stenzek"; + repo = "lunasvg"; + rev = "9af1ac7b90658a279b372add52d6f77a4ebb482c"; + hash = "sha256-ZzOe84ZF5JRrJ9Lev2lwYOccqtEGcf76dyCDBDTvI2o="; + }; + + nativeBuildInputs = [ + cmake + ninja + ]; + + meta = { + homepage = "https://github.com/stenzek/lunasvg"; + description = "lunasvg is a standalone SVG rendering library in C++"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + }; + }); } From 3ba1e3d83a31fd694c1f251d6da6b75b211e1dfe Mon Sep 17 00:00:00 2001 From: qubitnano <146656568+qubitnano@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:17:37 -0400 Subject: [PATCH 2/2] duckstation: build with clang Fails to build with gcc: duckstation> In function 'void* memcpy(void*, const void*, size_t)', duckstation> inlined from 'FileSystem::AtomicRenamedFile FileSystem::CreateAtomicRenamedFile(std::string, const char*, Error*)' at /build/source/src/common/file_system.cpp:1213:16: duckstation> /nix/store/wlavaybjbzgllhq11lib6qgr7rm8imgp-glibc-2.39-52-dev/include/bits/string_fortified.h:29:33: warning: 'void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)' accessing 9223372036854775801 or more bytes at offsets 0 and 0 overlaps 9223372036854775795 bytes at offset 6 [-Wrestrict] Warnings before building: duckstation> *************** UNSUPPORTED CONFIGURATION *************** duckstation> duckstation> You are not compiling DuckStation with a supported compiler. duckstation> duckstation> It may not even build successfully. duckstation> duckstation> DuckStation only supports the Clang and MSVC compilers. duckstation> duckstation> No support will be provided, continue at your own risk. duckstation> duckstation> ********************************************************* --- pkgs/by-name/du/duckstation/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/du/duckstation/package.nix b/pkgs/by-name/du/duckstation/package.nix index 9148b76144f60..65ddc92ea2ded 100644 --- a/pkgs/by-name/du/duckstation/package.nix +++ b/pkgs/by-name/du/duckstation/package.nix @@ -1,6 +1,7 @@ { lib, stdenv, + llvmPackages, SDL2, callPackage, cmake, @@ -31,7 +32,7 @@ let wrapQtAppsHook ; in -stdenv.mkDerivation (finalAttrs: { +llvmPackages.stdenv.mkDerivation (finalAttrs: { inherit (sources.duckstation) pname version src; patches = [