Unverified Commit 449fa04e authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

cheesecutter: Fix build, modernise (#481969)

parents 96963d10 72d41765
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
From 91e2418c37fce511eeaa1d1bb34a0d7a25668d40 Mon Sep 17 00:00:00 2001
From: OPNA2608 <opna2608@protonmail.com>
Date: Tue, 20 Jan 2026 15:29:03 +0100
Subject: [PATCH] Makefile.{dmd,ldc}: Pin C standard to C99

Code is definitely not C23-compatible, and I imagine C99 is *prolly* what this was initially targeting.
---
 Makefile.dmd | 4 ++--
 Makefile.ldc | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile.dmd b/Makefile.dmd
index 24a1d06..7c1b7c2 100644
--- a/Makefile.dmd
+++ b/Makefile.dmd
@@ -3,7 +3,7 @@ COMFLAGS=
 DLINK=$(COMFLAGS) 
 VERSION=$(shell cat Version)
 DFLAGS=$(COMFLAGS) -I./src -J./src/c64 -J./src/font -O
-CFLAGS=$(COMFLAGS) -O1
+CFLAGS=$(COMFLAGS) -O1 -std=c99
 CXXFLAGS=-I./src -O3
 COMPILE.d = $(DC) $(DFLAGS) -c -of$@
 OUTPUT_OPTION=
@@ -21,7 +21,7 @@ $(TARGET): $(C64OBJS) $(OBJS) $(CXX_OBJS)
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
 .c.o : $(C_SRCS)
-	$(CC) -c $< -o $@
+	$(CC) $(CFLAGS) -c $< -o $@
 
 ct: $(C64OBJS) $(CTOBJS)
 
diff --git a/Makefile.ldc b/Makefile.ldc
index b89077a..a6c4714 100644
--- a/Makefile.ldc
+++ b/Makefile.ldc
@@ -6,7 +6,7 @@ LIBS=-L-ldl -L-lstdc++
 COMFLAGS=-O2
 VERSION=$(shell cat Version)
 DFLAGS=$(COMFLAGS) -I./src -J./src/c64 -J./src/font
-CFLAGS=$(COMFLAGS)
+CFLAGS=$(COMFLAGS) -std=c99
 CXXFLAGS=$(COMFLAGS) -I./src 
 COMPILE.d = $(DC) $(DFLAGS) -c
 DC=ldc2
@@ -28,7 +28,7 @@ ccutter:$(C64OBJS) $(OBJS) $(CXX_OBJS)
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
 .c.o : $(C_SRCS)
-	$(CC) -c $< -o $@
+	$(CC) $(CFLAGS) -c $< -o $@
 
 ct: $(C64OBJS) $(CTOBJS)
 
-- 
2.51.2
+20 −4
Original line number Diff line number Diff line
@@ -9,31 +9,44 @@
}:
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 = [
    # https://github.com/theyamo/CheeseCutter/pull/60
    ./1001-cheesecutter-Pin-C-standard-to-C99.patch

    ./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
@@ -45,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 =
@@ -71,5 +86,6 @@ stdenv.mkDerivation {
      "x86_64-darwin"
    ];
    maintainers = with lib.maintainers; [ OPNA2608 ];
    mainProgram = "ccutter";
  };
}