zatackax: enable on darwin

This commit is contained in:
Moraxyc
2025-11-07 00:32:47 +08:00
parent 34c8169458
commit dbbdc29a84
2 changed files with 37 additions and 1 deletions
@@ -0,0 +1,25 @@
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
View File
@@ -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;
};
})