Skip to content

Commit 449fa04

Browse files
authored
cheesecutter: Fix build, modernise (NixOS#481969)
2 parents 96963d1 + 72d4176 commit 449fa04

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From 91e2418c37fce511eeaa1d1bb34a0d7a25668d40 Mon Sep 17 00:00:00 2001
2+
From: OPNA2608 <opna2608@protonmail.com>
3+
Date: Tue, 20 Jan 2026 15:29:03 +0100
4+
Subject: [PATCH] Makefile.{dmd,ldc}: Pin C standard to C99
5+
6+
Code is definitely not C23-compatible, and I imagine C99 is *prolly* what this was initially targeting.
7+
---
8+
Makefile.dmd | 4 ++--
9+
Makefile.ldc | 4 ++--
10+
2 files changed, 4 insertions(+), 4 deletions(-)
11+
12+
diff --git a/Makefile.dmd b/Makefile.dmd
13+
index 24a1d06..7c1b7c2 100644
14+
--- a/Makefile.dmd
15+
+++ b/Makefile.dmd
16+
@@ -3,7 +3,7 @@ COMFLAGS=
17+
DLINK=$(COMFLAGS)
18+
VERSION=$(shell cat Version)
19+
DFLAGS=$(COMFLAGS) -I./src -J./src/c64 -J./src/font -O
20+
-CFLAGS=$(COMFLAGS) -O1
21+
+CFLAGS=$(COMFLAGS) -O1 -std=c99
22+
CXXFLAGS=-I./src -O3
23+
COMPILE.d = $(DC) $(DFLAGS) -c -of$@
24+
OUTPUT_OPTION=
25+
@@ -21,7 +21,7 @@ $(TARGET): $(C64OBJS) $(OBJS) $(CXX_OBJS)
26+
$(CXX) $(CXXFLAGS) -c $< -o $@
27+
28+
.c.o : $(C_SRCS)
29+
- $(CC) -c $< -o $@
30+
+ $(CC) $(CFLAGS) -c $< -o $@
31+
32+
ct: $(C64OBJS) $(CTOBJS)
33+
34+
diff --git a/Makefile.ldc b/Makefile.ldc
35+
index b89077a..a6c4714 100644
36+
--- a/Makefile.ldc
37+
+++ b/Makefile.ldc
38+
@@ -6,7 +6,7 @@ LIBS=-L-ldl -L-lstdc++
39+
COMFLAGS=-O2
40+
VERSION=$(shell cat Version)
41+
DFLAGS=$(COMFLAGS) -I./src -J./src/c64 -J./src/font
42+
-CFLAGS=$(COMFLAGS)
43+
+CFLAGS=$(COMFLAGS) -std=c99
44+
CXXFLAGS=$(COMFLAGS) -I./src
45+
COMPILE.d = $(DC) $(DFLAGS) -c
46+
DC=ldc2
47+
@@ -28,7 +28,7 @@ ccutter:$(C64OBJS) $(OBJS) $(CXX_OBJS)
48+
$(CXX) $(CXXFLAGS) -c $< -o $@
49+
50+
.c.o : $(C_SRCS)
51+
- $(CC) -c $< -o $@
52+
+ $(CC) $(CFLAGS) -c $< -o $@
53+
54+
ct: $(C64OBJS) $(CTOBJS)
55+
56+
--
57+
2.51.2
58+

pkgs/by-name/ch/cheesecutter/package.nix

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,44 @@
99
}:
1010
stdenv.mkDerivation {
1111
pname = "cheesecutter";
12-
version = "unstable-2021-02-27";
12+
version = "2.9-beta-3-unstable-2021-02-27";
1313

1414
src = fetchFromGitHub {
1515
owner = "theyamo";
1616
repo = "CheeseCutter";
1717
rev = "84450d3614b8fb2cabda87033baab7bedd5a5c98";
18-
sha256 = "sha256:0q4a791nayya6n01l0f4kk497rdq6kiq0n72fqdpwqy138pfwydn";
18+
hash = "sha256-tnnuLhrBY34bduJYgOM0uOWTyJzEARqANcp7ZUM6imA=";
1919
};
2020

2121
patches = [
22+
# https://github.com/theyamo/CheeseCutter/pull/60
23+
./1001-cheesecutter-Pin-C-standard-to-C99.patch
24+
2225
./0001-Drop-baked-in-build-date-for-r13y.patch
2326
]
24-
++ lib.optional stdenv.hostPlatform.isDarwin ./0002-Prepend-libSDL.dylib-to-macOS-SDL-loader.patch;
27+
++ lib.optionals stdenv.hostPlatform.isDarwin [
28+
./0002-Prepend-libSDL.dylib-to-macOS-SDL-loader.patch
29+
];
30+
31+
strictDeps = true;
2532

2633
nativeBuildInputs = [
2734
acme
2835
ldc
2936
]
30-
++ lib.optional (!stdenv.hostPlatform.isDarwin) patchelf;
37+
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
38+
patchelf
39+
];
3140

3241
buildInputs = [ SDL ];
3342

43+
enableParallelBuilding = true;
44+
3445
makefile = "Makefile.ldc";
3546

3647
installPhase = ''
48+
runHook preInstall
49+
3750
for exe in {ccutter,ct2util}; do
3851
install -D $exe $out/bin/$exe
3952
done
@@ -45,6 +58,8 @@ stdenv.mkDerivation {
4558
for res in $(ls icons | sed -e 's/cc//g' -e 's/.png//g'); do
4659
install -Dm444 icons/cc$res.png $out/share/icons/hicolor/''${res}x''${res}/apps/cheesecutter.png
4760
done
61+
62+
runHook postInstall
4863
'';
4964

5065
postFixup =
@@ -71,5 +86,6 @@ stdenv.mkDerivation {
7186
"x86_64-darwin"
7287
];
7388
maintainers = with lib.maintainers; [ OPNA2608 ];
89+
mainProgram = "ccutter";
7490
};
7591
}

0 commit comments

Comments
 (0)