We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2085

Summary: SDL 1.2.15 fails to build on OSX 10.9 Mavericks – deprecated CGDirectPaletteRef was removed
Product: SDL Reporter: Adrian Petrescu <apetresc>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: apetresc, sezeroz
Version: 1.2.15   
Hardware: x86_64   
OS: Mac OS X (All)   
Attachments: patch to build on OS X 10.9 Mavericks
better fix for compiling for 10.6 and older

Description Adrian Petrescu 2013-09-03 21:47:32 UTC
Created attachment 1320 [details]
patch to build on OS X 10.9 Mavericks

The CGDirectPaletteRef struct no longer exists in 10.9 (it had been previously deprecated) which prevents SDL 1.2.15 from building with the following error:

    In file included from ./src/video/quartz/SDL_QuartzEvents.m:24:
    ./src/video/quartz/SDL_QuartzVideo.h:94:5: error: unknown type name 'CGDirectPaletteRef'
        CGDirectPaletteRef palette;            /* palette of an 8-bit display */
        ^

I was able to make everything compile just by removing that item from the struct, nothing else in libsdl seems to depend on it, but I have *no* idea if this is a valid fix, knowing next to nothing about SDL.

I've attached the patch. Hopefully it's fine.

Cheers,
Adrian Petrescu
Comment 1 Adrian Petrescu 2013-09-03 22:51:32 UTC
I can confirm, anecdotally, that this patch works fine on Mavericks with several SDL-dependent projects such as Gource.
Comment 2 Sam Lantinga 2013-09-05 13:40:21 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/e9466ead70e5
Comment 3 Ozkan Sezer 2013-09-07 04:57:27 UTC
This patch seems wrong: SDL_QuartzVideo.m still plays with the palette member
when compiled for 10.6 and older. I think the following would be a better fix
(also attaching in case it gets mangled) :

--- SDL-1.2/src/video/quartz/SDL_QuartzVideo.h~
+++ SDL-1.2/src/video/quartz/SDL_QuartzVideo.h
@@ -91,6 +91,9 @@
     CGDirectDisplayID  display;            /* 0 == main display (only support single display) */
     const void         *mode;              /* current mode of the display */
     const void         *save_mode;         /* original mode of the display */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+    CGDirectPaletteRef palette;            /* palette of an 8-bit display */
+#endif
     NSOpenGLContext    *gl_context;        /* OpenGL rendering context */
     NSGraphicsContext  *nsgfx_context;     /* Cocoa graphics context */
     Uint32             width, height, bpp; /* frequently used data about the display */
Comment 4 Ozkan Sezer 2013-09-07 04:58:45 UTC
Created attachment 1324 [details]
better fix for compiling for 10.6 and older
Comment 5 Sam Lantinga 2013-09-07 06:38:23 UTC
Yes, that's a better fix. :)
http://hg.libsdl.org/SDL/rev/bbfb41c13a87
Thanks!