Unverified Commit 01b6d8bd authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

Merge pull request #259774 from surfaceflinger/jazz2-finalattrs

jazz2: switch to finalAttrs, use runCommandLocal for content, migrate to by-name
parents b7deed0c 80aced8d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
{ jazz2
, lib
, runCommand
, runCommandLocal
}:

runCommand "jazz2-content"
runCommandLocal "jazz2-content"
{
  inherit (jazz2) version src;

  preferLocalBuild = true;

  meta = with lib; {
  meta = (builtins.removeAttrs jazz2.meta ["mainProgram"]) // {
    description = "Assets needed for jazz2";
    homepage = "https://github.com/deathkiller/jazz2-native";
    license = licenses.gpl3;
    maintainers = with maintainers; [ surfaceflinger ];
    platforms = lib.platforms.all;
  };
} ''
  cp -r $src/Content $out
+55 −0
Original line number Diff line number Diff line
{ cmake
, fetchFromGitHub
, glew
, glfw
, jazz2-content
, lib
, libGL
, libopenmpt
, libvorbis
, openal
, SDL2
, stdenv
, xorg
, testers
, zlib
, graphicsLibrary ? "GLFW"
}:

stdenv.mkDerivation rec {
assert lib.assertOneOf "graphicsLibrary" graphicsLibrary [ "SDL2" "GLFW" ];
stdenv.mkDerivation (finalAttrs: {
  pname = "jazz2";
  version = "2.1.0";
  version = "2.2.2";

  src = fetchFromGitHub {
    owner = "deathkiller";
    repo = "jazz2-native";
    rev = version;
    sha256 = "nJha7+geP2Ov7ciEDzJ+XWdiF1jzv4Oeis1DwxcpJXo=";
    rev = finalAttrs.version;
    hash = "sha256-1psMeuMV8GjS+uNlgtCvKpHgV9XW+vjviQTHBPjA4Lc=";
  };

  patches = [ ./nocontent.patch ];

  buildInputs = [ libGL SDL2 zlib glew glfw openal libvorbis libopenmpt xorg.libSM xorg.libICE xorg.libXext ];
  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"
    "-DGLFW_INCLUDE_DIR=${glfw}/include/GLFW"
    "-DLIBOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include/libopenmpt"
    "-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.gpl3;
    license = licenses.gpl3Only;
    mainProgram = "jazz2";
    maintainers = with maintainers; [ surfaceflinger ];
    platforms = platforms.linux;
  };
}
})
+0 −4
Original line number Diff line number Diff line
@@ -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 { };
Loading