Commit 72d41765 authored by OPNA2608's avatar OPNA2608
Browse files

cheesecutter: Modernise

- Fix version not starting with last release's version
- src.hash to current-day format
- lib.optional -> lib.optionals for consistency ([] ++ [])
- Enable strictDeps
- enableParallelBuilding = true (tested with 30 cores)
- Add runHook pre-/postInstall calls
- Add meta.mainProgram
parent 234f722f
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -9,13 +9,13 @@
}:
stdenv.mkDerivation {
  pname = "cheesecutter";
  version = "unstable-2021-02-27";
  version = "2.9-beta-3-unstable-2021-02-27";

  src = fetchFromGitHub {
    owner = "theyamo";
    repo = "CheeseCutter";
    rev = "84450d3614b8fb2cabda87033baab7bedd5a5c98";
    sha256 = "sha256:0q4a791nayya6n01l0f4kk497rdq6kiq0n72fqdpwqy138pfwydn";
    hash = "sha256-tnnuLhrBY34bduJYgOM0uOWTyJzEARqANcp7ZUM6imA=";
  };

  patches = [
@@ -24,19 +24,29 @@ stdenv.mkDerivation {

    ./0001-Drop-baked-in-build-date-for-r13y.patch
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin ./0002-Prepend-libSDL.dylib-to-macOS-SDL-loader.patch;
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    ./0002-Prepend-libSDL.dylib-to-macOS-SDL-loader.patch
  ];

  strictDeps = true;

  nativeBuildInputs = [
    acme
    ldc
  ]
  ++ lib.optional (!stdenv.hostPlatform.isDarwin) patchelf;
  ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
    patchelf
  ];

  buildInputs = [ SDL ];

  enableParallelBuilding = true;

  makefile = "Makefile.ldc";

  installPhase = ''
    runHook preInstall

    for exe in {ccutter,ct2util}; do
      install -D $exe $out/bin/$exe
    done
@@ -48,6 +58,8 @@ stdenv.mkDerivation {
    for res in $(ls icons | sed -e 's/cc//g' -e 's/.png//g'); do
      install -Dm444 icons/cc$res.png $out/share/icons/hicolor/''${res}x''${res}/apps/cheesecutter.png
    done

    runHook postInstall
  '';

  postFixup =
@@ -74,5 +86,6 @@ stdenv.mkDerivation {
      "x86_64-darwin"
    ];
    maintainers = with lib.maintainers; [ OPNA2608 ];
    mainProgram = "ccutter";
  };
}