2025-04-26

XSkat on MacOS

Maybe the first game I ever played on Linux is XSkat. The other day I wondered, if it would build on MacOS, and - yes, it does.


 

 Here the patch:

diff --git a/Imakefile b/Imakefile
index ab1b892..06fd031 100644
--- a/Imakefile
+++ b/Imakefile
@@ -19,13 +19,28 @@
 */
 
 /*DEFL=-DDEFAULT_LANGUAGE=\"german\"*/
+/* macOS-specific adjustments */
+#ifdef Darwin
+   # Use clang instead of gcc
+   CC = clang
+   # X11 paths for Homebrew
+   X11_BASE = /opt/X11
+   X11_INCLUDES = -I$(X11_BASE)/include
+   X11_LIBDIR = -L$(X11_BASE)/lib
+   # SDK paths
+   SDK_PATH = $(shell xcrun --show-sdk-path)
+   EXTRA_CFLAGS = -isysroot $(SDK_PATH) $(X11_INCLUDES)
+   EXTRA_LDFLAGS = $(X11_LIBDIR)
+#endif
+
+/* Language selection */
 DEFL=-DDEFAULT_LANGUAGE=\"english\"
 
 DEFI=-DDEFAULT_IRC_SERVER=\"irc.fu-berlin.de\"
 
 DEFINES=$(DEFL) $(DEFI)
 
-LOCAL_LIBRARIES=$(XLIBONLY)
+LOCAL_LIBRARIES=$(XLIBONLY) $(EXTRA_LDFLAGS)
 
 OBJS=skat.o ramsch.o null.o bitmaps.o xio.o xdial.o irc.o text.o
 SRCS=skat.c ramsch.c null.c bitmaps.c xio.c xdial.c irc.c text.c


I had to install a few brew packages.

brew install imake xorgproto libx11 libxext libxt

No comments:

Post a Comment