Unverified Commit 6c8e5b93 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

zatackax: enable on darwin (#459206)

parents 43e26207 dbbdc29a
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
From 9cf8d3f1025689f3765da2f0a27561a6bfe5c3cb Mon Sep 17 00:00:00 2001
From: Moraxyc <i@qaq.li>
Date: Fri, 7 Nov 2025 00:23:44 +0800
Subject: [PATCH] Fix SDL_main redefinition issue on macOS

---
 src/zatackax.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/zatackax.c b/src/zatackax.c
index dad2fa9..47a8bd7 100644
--- a/src/zatackax.c
+++ b/src/zatackax.c
@@ -16,6 +16,8 @@
  */
 
 #include "zatackax.h"
+// override SDL_main.h redefining main to SDL_main on darwin
+#define main main
 
 static const unsigned int FPS_CAP = 100;
 
-- 
2.51.0
+12 −1
Original line number Diff line number Diff line
@@ -21,6 +21,17 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-1m99hi0kjpj5Yl1nAmwSMMdQWcP0rfLLPFJPkU4oVbM=";
  };

  # src/zatackax.c:2069:5: error: conflicting types for 'SDL_main'
  # Fix SDL_main redefinition issue on darwin
  patches = lib.optional stdenv.hostPlatform.isDarwin ./0001-Fix-SDL_main-redefinition-issue-on-macOS.patch;

  # malloc.h is not needed because stdlib.h is already included.
  # On darwin, malloc.h does not even exist, resulting in an error.
  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace src/zatackax.h \
      --replace-fail '#include <malloc.h>' ""
  '';

  strictDeps = true;

  nativeBuildInputs = [
@@ -45,6 +56,6 @@ stdenv.mkDerivation (finalAttrs: {
    license = lib.licenses.gpl3Plus;
    maintainers = [ lib.maintainers.alch-emi ];
    mainProgram = "zatackax";
    platforms = lib.platforms.linux;
    platforms = with lib.platforms; linux ++ darwin;
  };
})