diff --git a/pkgs/applications/emulators/duckstation/001-fix-test-inclusion.diff b/pkgs/applications/emulators/duckstation/001-fix-test-inclusion.diff new file mode 100644 index 000000000000..b2dabe0262db --- /dev/null +++ b/pkgs/applications/emulators/duckstation/001-fix-test-inclusion.diff @@ -0,0 +1,11 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 879d46bc..95570f6b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -20,5 +20,5 @@ if(BUILD_REGTEST) + endif() + + if(BUILD_TESTS) +- add_subdirectory(common-tests EXCLUDE_FROM_ALL) ++ add_subdirectory(common-tests) + endif() diff --git a/pkgs/applications/emulators/duckstation/002-hardcode-vars.diff b/pkgs/applications/emulators/duckstation/002-hardcode-vars.diff new file mode 100644 index 000000000000..f0b7bb67a0ee --- /dev/null +++ b/pkgs/applications/emulators/duckstation/002-hardcode-vars.diff @@ -0,0 +1,19 @@ +diff --git a/src/scmversion/gen_scmversion.sh b/src/scmversion/gen_scmversion.sh +index 9c1dacab..d1f895ee 100755 +--- a/src/scmversion/gen_scmversion.sh ++++ b/src/scmversion/gen_scmversion.sh +@@ -10,10 +10,10 @@ else + fi + + +-HASH=$(git rev-parse HEAD) +-BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n') +-TAG=$(git describe --tags --dirty --exclude latest --exclude preview --exclude legacy --exclude previous-latest | tr -d '\r\n') +-DATE=$(git log -1 --date=iso8601-strict --format=%cd) ++HASH="@gitHash@" ++BRANCH="@gitBranch@" ++TAG="@gitTag@" ++DATE="@gitDate@" + + cd $CURDIR + diff --git a/pkgs/applications/emulators/duckstation/default.nix b/pkgs/applications/emulators/duckstation/default.nix index 87470f561413..e7980e20dddd 100644 --- a/pkgs/applications/emulators/duckstation/default.nix +++ b/pkgs/applications/emulators/duckstation/default.nix @@ -8,31 +8,45 @@ , curl , extra-cmake-modules , libXrandr +, libbacktrace , makeDesktopItem -, mesa # for libgbm , ninja , pkg-config , qtbase , qtsvg , qttools , qtwayland +, substituteAll , vulkan-loader , wayland , wrapQtAppsHook , enableWayland ? true }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "duckstation"; - version = "unstable-2023-04-14"; + version = "unstable-2023-09-30"; src = fetchFromGitHub { owner = "stenzek"; repo = "duckstation"; - rev = "5fee6f5abee7f3aad65da5523e57896e10e2a53a"; - sha256 = "sha256-sRs/b4GVXhF3zrOef8DSBKJJGYECUER/nNWZAqv7suA="; + rev = "d5608bf12df7a7e03750cb94a08a3d7999034ae2"; + hash = "sha256-ktfZgacjkN6GQb1vLmyTZMr8QmmH12qAvFSIBTjgRSs="; }; + patches = [ + # Tests are not built by default + ./001-fix-test-inclusion.diff + # Patching yet another script that fills data based on git commands... + (substituteAll { + src = ./002-hardcode-vars.diff; + gitHash = finalAttrs.src.rev; + gitBranch = "master"; + gitTag = "0.1-5889-gd5608bf1"; + gitDate = "2023-09-30T23:20:09+10:00"; + }) + ]; + nativeBuildInputs = [ cmake copyDesktopItems @@ -49,7 +63,7 @@ stdenv.mkDerivation { SDL2 curl libXrandr - mesa + libbacktrace qtbase qtsvg vulkan-loader @@ -60,10 +74,12 @@ stdenv.mkDerivation { ] ++ cubeb.passthru.backendLibs; + strictDeps = true; + cmakeFlags = [ - "-DUSE_DRMKMS=ON" - ] - ++ lib.optionals enableWayland [ "-DUSE_WAYLAND=ON" ]; + (lib.cmakeBool "BUILD_TESTS" true) + (lib.cmakeBool "ENABLE_WAYLAND" enableWayland) + ]; desktopItems = [ (makeDesktopItem { @@ -79,6 +95,13 @@ stdenv.mkDerivation { }) ]; + doCheck = true; + checkPhase = '' + runHook preCheck + bin/common-tests + runHook postCheck + ''; + installPhase = '' runHook preInstall @@ -92,23 +115,16 @@ stdenv.mkDerivation { runHook postInstall ''; - doCheck = true; - checkPhase = '' - runHook preCheck - bin/common-tests - runHook postCheck - ''; - qtWrapperArgs = [ "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ vulkan-loader ] ++ cubeb.passthru.backendLibs)}" ]; - meta = with lib; { + meta = { homepage = "https://github.com/stenzek/duckstation"; description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64"; - license = licenses.gpl3Only; + license = lib.licenses.gpl3Only; mainProgram = "duckstation-qt"; - maintainers = with maintainers; [ guibou AndersonTorres ]; - platforms = platforms.linux; + maintainers = with lib.maintainers; [ guibou AndersonTorres ]; + platforms = lib.platforms.linux; }; -} +})