nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 acme,
6 ldc,
7 patchelf,
8 SDL,
9}:
10stdenv.mkDerivation {
11 pname = "cheesecutter";
12 version = "2.9-beta-3-unstable-2021-02-27";
13
14 src = fetchFromGitHub {
15 owner = "theyamo";
16 repo = "CheeseCutter";
17 rev = "84450d3614b8fb2cabda87033baab7bedd5a5c98";
18 hash = "sha256-tnnuLhrBY34bduJYgOM0uOWTyJzEARqANcp7ZUM6imA=";
19 };
20
21 patches = [
22 # https://github.com/theyamo/CheeseCutter/pull/60
23 ./1001-cheesecutter-Pin-C-standard-to-C99.patch
24
25 ./0001-Drop-baked-in-build-date-for-r13y.patch
26 ]
27 ++ lib.optionals stdenv.hostPlatform.isDarwin [
28 ./0002-Prepend-libSDL.dylib-to-macOS-SDL-loader.patch
29 ];
30
31 strictDeps = true;
32
33 nativeBuildInputs = [
34 acme
35 ldc
36 ]
37 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
38 patchelf
39 ];
40
41 buildInputs = [ SDL ];
42
43 enableParallelBuilding = true;
44
45 makefile = "Makefile.ldc";
46
47 installPhase = ''
48 runHook preInstall
49
50 for exe in {ccutter,ct2util}; do
51 install -D $exe $out/bin/$exe
52 done
53
54 mkdir -p $out/share/cheesecutter/example_tunes
55 cp -r tunes/* $out/share/cheesecutter/example_tunes
56
57 install -Dm444 arch/fd/ccutter.desktop -t $out/share/applications
58 for res in $(ls icons | sed -e 's/cc//g' -e 's/.png//g'); do
59 install -Dm444 icons/cc$res.png $out/share/icons/hicolor/''${res}x''${res}/apps/cheesecutter.png
60 done
61
62 runHook postInstall
63 '';
64
65 postFixup =
66 let
67 rpathSDL = lib.makeLibraryPath [ SDL ];
68 in
69 if stdenv.hostPlatform.isDarwin then
70 ''
71 install_name_tool -add_rpath ${rpathSDL} $out/bin/ccutter
72 ''
73 else
74 ''
75 rpath=$(patchelf --print-rpath $out/bin/ccutter)
76 patchelf --set-rpath "$rpath:${rpathSDL}" $out/bin/ccutter
77 '';
78
79 meta = {
80 description = "Tracker program for composing music for the SID chip";
81 homepage = "https://github.com/theyamo/CheeseCutter/";
82 license = lib.licenses.gpl2Plus;
83 platforms = [
84 "x86_64-linux"
85 "i686-linux"
86 "x86_64-darwin"
87 ];
88 maintainers = with lib.maintainers; [ OPNA2608 ];
89 mainProgram = "ccutter";
90 };
91}