Merge pull request #259774 from surfaceflinger/jazz2-finalattrs

jazz2: switch to finalAttrs, use runCommandLocal for content, migrate to by-name
This commit is contained in:
Peder Bergebakken Sundt 2023-11-22 16:59:46 +01:00 committed by GitHub
commit 01b6d8bd71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 71 deletions

View File

@ -0,0 +1,16 @@
{ jazz2
, lib
, runCommandLocal
}:
runCommandLocal "jazz2-content"
{
inherit (jazz2) version src;
meta = (builtins.removeAttrs jazz2.meta ["mainProgram"]) // {
description = "Assets needed for jazz2";
platforms = lib.platforms.all;
};
} ''
cp -r $src/Content $out
''

View File

@ -0,0 +1,55 @@
{ cmake
, fetchFromGitHub
, glfw
, jazz2-content
, lib
, libopenmpt
, libvorbis
, openal
, SDL2
, stdenv
, testers
, zlib
, graphicsLibrary ? "GLFW"
}:
assert lib.assertOneOf "graphicsLibrary" graphicsLibrary [ "SDL2" "GLFW" ];
stdenv.mkDerivation (finalAttrs: {
pname = "jazz2";
version = "2.2.2";
src = fetchFromGitHub {
owner = "deathkiller";
repo = "jazz2-native";
rev = finalAttrs.version;
hash = "sha256-1psMeuMV8GjS+uNlgtCvKpHgV9XW+vjviQTHBPjA4Lc=";
};
patches = [ ./nocontent.patch ];
nativeBuildInputs = [ cmake ];
buildInputs = [ libopenmpt libvorbis openal zlib ]
++ lib.optionals (graphicsLibrary == "GLFW") [ glfw ]
++ lib.optionals (graphicsLibrary == "SDL2") [ SDL2 ];
cmakeFlags = [
"-DLIBOPENMPT_INCLUDE_DIR=${lib.getDev libopenmpt}/include/libopenmpt"
"-DNCINE_DOWNLOAD_DEPENDENCIES=OFF"
"-DNCINE_OVERRIDE_CONTENT_PATH=${jazz2-content}"
] ++ lib.optionals (graphicsLibrary == "GLFW") [
"-DGLFW_INCLUDE_DIR=${glfw}/include/GLFW"
];
passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
};
meta = with lib; {
description = "Open-source Jazz Jackrabbit 2 reimplementation";
homepage = "https://github.com/deathkiller/jazz2-native";
license = licenses.gpl3Only;
mainProgram = "jazz2";
maintainers = with maintainers; [ surfaceflinger ];
platforms = platforms.linux;
};
})

View File

@ -1,20 +0,0 @@
{ jazz2
, lib
, runCommand
}:
runCommand "jazz2-content"
{
inherit (jazz2) version src;
preferLocalBuild = true;
meta = with lib; {
description = "Assets needed for jazz2";
homepage = "https://github.com/deathkiller/jazz2-native";
license = licenses.gpl3;
maintainers = with maintainers; [ surfaceflinger ];
};
} ''
cp -r $src/Content $out
''

View File

@ -1,47 +0,0 @@
{ cmake
, fetchFromGitHub
, glew
, glfw
, jazz2-content
, lib
, libGL
, libopenmpt
, libvorbis
, openal
, SDL2
, stdenv
, xorg
, zlib
}:
stdenv.mkDerivation rec {
pname = "jazz2";
version = "2.1.0";
src = fetchFromGitHub {
owner = "deathkiller";
repo = "jazz2-native";
rev = version;
sha256 = "nJha7+geP2Ov7ciEDzJ+XWdiF1jzv4Oeis1DwxcpJXo=";
};
patches = [ ./nocontent.patch ];
buildInputs = [ libGL SDL2 zlib glew glfw openal libvorbis libopenmpt xorg.libSM xorg.libICE xorg.libXext ];
nativeBuildInputs = [ cmake ];
cmakeFlags = [
"-DNCINE_DOWNLOAD_DEPENDENCIES=OFF"
"-DGLFW_INCLUDE_DIR=${glfw}/include/GLFW"
"-DLIBOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include/libopenmpt"
"-DNCINE_OVERRIDE_CONTENT_PATH=${jazz2-content}"
];
meta = with lib; {
description = "Open-source Jazz Jackrabbit 2 reimplementation";
homepage = "https://github.com/deathkiller/jazz2-native";
license = licenses.gpl3;
maintainers = with maintainers; [ surfaceflinger ];
platforms = platforms.linux;
};
}

View File

@ -37790,10 +37790,6 @@ with pkgs;
fish-fillets-ng = callPackage ../games/fish-fillets-ng { };
jazz2 = callPackage ../games/jazz2/game.nix { };
jazz2-content = callPackage ../games/jazz2/content.nix { };
jumpy = callPackage ../games/jumpy { };
flightgear = libsForQt5.callPackage ../games/flightgear { };