From eea4a5a3db90824e864c4b575181d47cdf1f76c4 Mon Sep 17 00:00:00 2001 From: Aleksandr Pasechnik Date: Sun, 29 Jun 2025 19:31:45 -0400 Subject: [PATCH] fix builds on macOS Catalina (10.15.7) The `_DARWIN_BETTER_REALPATH` flag fixes the file device reading directories. The colors change fixes an integer size error in the code below it. I have a few other quality of life commits on the `macbuild` branch of my git.sr.ht/~apiarian/uxn fork for more Mac convenience, but the probably don't belong in the main branch of uxn. Maybe we can explore adding them as build flags? - al --- build.sh | 2 +- src/devices/screen.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 75c4921..13ac751 100755 --- a/build.sh +++ b/build.sh @@ -64,7 +64,7 @@ MSYS_NT*|MINGW*) # MSYS2 on Windows fi ;; Darwin) # macOS - CFLAGS="${CFLAGS} -Wno-typedef-redefinition -D_C99_SOURCE" + CFLAGS="${CFLAGS} -Wno-typedef-redefinition -D_C99_SOURCE -D_DARWIN_BETTER_REALPATH" UXNEMU_LDFLAGS="$(sdl2-config --cflags --static-libs)" ;; Linux|*) diff --git a/src/devices/screen.c b/src/devices/screen.c index 4012086..bc6b2dd 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -50,7 +50,8 @@ screen_change(int x1, int y1, int x2, int y2) void screen_palette(void) { - int i, shift, colors[4]; + int i, shift; + unsigned long colors[4]; for(i = 0, shift = 4; i < 4; ++i, shift ^= 4) { Uint8 r = (uxn.dev[0x8 + i / 2] >> shift) & 0xf,