Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
BTW, it is probably not hard to get a bit later Cocoa working, at least for 10.5+. For example, here is the history from 2.0.7 release down: https://github.com/libsdl-org/SDL/commits/b89cac6761e9ab48e1b6149a0da90d47baf6f925/src/video/cocoa

There is a breaking commit: https://github.com/libsdl-org/SDL/commit/4a468739f832615dcc21f52e695659e5e93da2cb – but it is small and easy to revert. Otherwise it seems that 10.6 was still supported in 2.0.7 by upstream and fixes for < 10.7 were added (which is what makes it potentially worth bothering with).

Upd. Ah, I think I get what made 2.0.3 a fix-point. This brilliant commit: https://github.com/libsdl-org/SDL/commit/0e45984fa036fff1912c62fee3ed4f5481f3c324
That’s beyond ridiculous.

It probably makes a better sense to look through commit history after 2.0.3 to see if there are some fixes to backport, rather than trying to fix anything later than 2.0.3. The latter will be too much of effort and perhaps not much benefit.
 
Seeing it that way there are a few lines I just commented out, but we may want to protect with #ifdef SOME_VERSION_OR_WHATEVER. Things that are definitely not Tiger, but I don't know what os version they were added.

These kinda bother me:
nscursor = [NSCursor operationNotAllowedCursor];
[windata->nswindow setStyleMask:NSBorderlessWindowMask];
[contentView setWantsBestResolutionOpenGLSurface:YES];

For those you might try protecting them against pre 10.6 and see if they build on your system.

And, as I mentioned, but don't know how to fix off top of my head:
return (BOOL)SDL_SendDropFile([filename UTF8String]);

None of these are critical, but while we're at it, might as well do it right.

Yeah, we do not want to comment them out, since, for example: https://developer.apple.com/documentation/appkit/nscursor/operationnotallowed

This one should be available in 10.0+: https://developer.apple.com/documentation/appkit/nsborderlesswindowmask
Do Apple docs lie (that happens occasionally) or it is disabled due to a bug, not due to being unavailable?
 
Yeah, we do not want to comment them out, since, for example: https://developer.apple.com/documentation/appkit/nscursor/operationnotallowed

This one should be available in 10.0+: https://developer.apple.com/documentation/appkit/nsborderlesswindowmask
Do Apple docs lie (that happens occasionally) or it is disabled due to a bug, not due to being unavailable?
I was solely focused on getting it working, and if it wasn't critical, just bypassing it for the time being to get things running. Apple docs do lie occasionally, and names change quite a bit.

Regardless, those things specifically wouldn't work on Tiger, hence my suggestion of protecting them with maybe 10.6 or higher (who knows about 10.5, but treating it as Tiger is ok for our purposes).

Up to you. I could do more work on newer versions similar to what I did if you wish, with the caveat that I'm on Tiger.
 
I was solely focused on getting it working, and if it wasn't critical, just bypassing it for the time being to get things running. Apple docs do lie occasionally, and names change quite a bit.

Regardless, those things specifically wouldn't work on Tiger, hence my suggestion of protecting them with maybe 10.6 or higher (who knows about 10.5, but treating it as Tiger is ok for our purposes).

Up to you. I could do more work on newer versions similar to what I did if you wish, with the caveat that I'm on Tiger.

Minor update, addressing discussed issues, on top of your patch. This is untested: https://github.com/barracuda156/SDL/commit/02d7a6984b1decd1909372afa7900854856de40a
I will try building now.
 
Hmm...with that sorted, I saw an error about finding libGL...I did:
export SDL_OPENGL_LIBRARY=/usr/X11R6/lib/libGL.dylib

But with SDL_VIDEODRIVER=x11 it now just hangs.

So it looks like switching video drivers at runtime may run into a problem with GL...it may be opening cocoa's GL, which then conflicts with X11 trying to also use GL.

I'll try setting SDL_OPENGL_LIBRARY to point to cocoa's and see if that works...

I'm thinking it may be the GL renderer, which is separate from the way SDL uses GL for video display.

No...export SDL_RENDER_DRIVER=software doesn't help.

export SDL_OPENGL_LIBRARY=/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib doesn't work if the driver is X11, it give GL errors, but using the cocoa driver it has no effect, since that's the GL it's already using.

It is some opengl thing tho, I'm pretty sure.

BTW, which OpenGL is used by Cocoa?
 
Ok, added: https://github.com/macos-powerpc/po...c7113ac6a0a9e107/devel/libsdl2-cocoa/Portfile

Verified with ffplay6 and lite-xl that it is functional.

Works with mpv too, once I rebuilt it without x11. (There is probably a way to select that at runtime, but I didn’t bother looking for that.)

I could even play 4k video, kinda. It is not really usable on 2.3 Dual, but it does not even freeze, just plays slowly.

Even if it works on par with x11 in terms of performance, it is more convenient – no need in X server.
 
Which opengl: Cocoa uses the one in /System/Library/Frameworks/OpenGL.framework
Tested and verified. If I use the env var to specify that one, there's no effect on Cocoa (it already knew to find it there), but using X11 driver it then can't open a Window (ie have to use the X11 opengl with X11).

Your changes look VERY good, very well done. I'm not at home right now, but will test them when I get a chance.

I tested the cocoa vs x11 drivers with testgl2 and testrendercopyex. The difference in framerate was noticeable, but not earth shattering. In both using cocoa I'd get just over 500 "fps", not sure if that was actually frames or what, but that's the numbers they reported. Running the same tests using the x11 driver showed in the 470 range, so not even 10% faster. But definitely cocoa is more "mac like". I think things like copy paste, drag and dropping icons, multiple windows, and more, will be much smoother using cocoa.
 
Which opengl: Cocoa uses the one in /System/Library/Frameworks/OpenGL.framework
Tested and verified. If I use the env var to specify that one, there's no effect on Cocoa (it already knew to find it there), but using X11 driver it then can't open a Window (ie have to use the X11 opengl with X11).

Your changes look VERY good, very well done. I'm not at home right now, but will test them when I get a chance.

I tested the cocoa vs x11 drivers with testgl2 and testrendercopyex. The difference in framerate was noticeable, but not earth shattering. In both using cocoa I'd get just over 500 "fps", not sure if that was actually frames or what, but that's the numbers they reported. Running the same tests using the x11 driver showed in the 470 range, so not even 10% faster. But definitely cocoa is more "mac like". I think things like copy paste, drag and dropping icons, multiple windows, and more, will be much smoother using cocoa.

I have a real-world benchmark – to play 4K vids without frame dropping and up to 60 FPS. Will try on the Quad – stayed home for a couple of days, and 2.3 is too slow for this task.

Meanwhile:

IMG_5854.png
 
It looks like you have libsdl2-cocoa set up as a port with the new patches. I did selfupdate, and then sudo port install libsdl2-cocoa, but it got 404's trying to fetch SDL2-2.32.6.tar.gz.

Let me know if I did something wrong. Otherwise I can test applying the patches by hand.

So, what is the state of powerpc SDL3? Probably similar, but worse, my guess, right?
 
It looks like you have libsdl2-cocoa set up as a port with the new patches. I did selfupdate, and then sudo port install libsdl2-cocoa, but it got 404's trying to fetch SDL2-2.32.6.tar.gz.

SDL2-2.32.6.tar.gz is the source, so probably you have an old curl. If you do not want to rebuild the base against the modern one, you may download the source manually and place it into /opt/local/var/macports/distfiles/libsdl2-cocoa.
Likely you already have the same in distfiles/libsdl2-powerpc, so then just copy it.

So, what is the state of powerpc SDL3? Probably similar, but worse, my guess, right?

There is not much to test it with, the only port using it is tomato-tox, which seems to work – at least X11 GUI is working.
 
SDL2-2.32.6.tar.gz is the source, so probably you have an old curl. If you do not want to rebuild the base against the modern one, you may download the source manually and place it into /opt/local/var/macports/distfiles/libsdl2-cocoa.
Likely you already have the same in distfiles/libsdl2-powerpc, so then just copy it.



There is not much to test it with, the only port using it is tomato-tox, which seems to work – at least X11 GUI is working.
curl: I admit I totally don't understand what is going on with it and why it is such a pain, but know you'd already posted good info on it...I'll go back and read what you said and see what it involves. If I'm testing stuff, I might as well do it right and "rebuild the base", once I have half a clue what that means ;) (I do understand I have old version, just not how all the moving parts in macports deal with it and how to fix it)

sdl3: tomato-tox, what a weird thing! I had trouble even figuring out what it was. Yeah, there doesn't seem to be anything really compelling for SDL3, so will leave it for another day. (And chances of it "just working" on tiger are likely not good).
 
curl: I admit I totally don't understand what is going on with it and why it is such a pain, but know you'd already posted good info on it

I think that the system curl cannot handle https, which is probably required by GitHub, so you cannot fetch any sources from there. Why it works for most ports is because MacPorts own distfiles allow usage of archaic curl. Since there is no `libsdl2-cocoa` port in MacPorts, neither option works. The same will happen when MacPorts distfiles do not have a needed version of some port’s source.

Solution is to have a proper, working curl. Bootstrap a separate tree in /opt/bootstrap (or anywhere in a separate prefix), configuring it with `--without-startupitems --with-applications-dir=/opt/bootstrap`, once that is installed, rebuild main installation, configuring it with `--with-curlprefix=/opt/bootstrap`. No need to reinstall any ports.
 
Ok, on May 19th you provided detailed instructions on how an /opt/bootstrap can be used to get a better curl and I've tried following them, but ran into problems as it wants to build its own gcc, etc etc etc. We could go into those, but...all of this is just to get a better curl that can handle https, is that correct?

My goal was to get mpv to test a cocoa SDL2 and specifically opengl, and, also to use your macports to get the libsdl2-cocoa to see if that built on tiger with the patches, but I'm wondering if this is worth all the trouble. There's just so many dependencies, trouble with different packages, dealing with curl, etc. I've already installed all the dependencies possible that I could (including at least 4 gcc's), with my bad curl, etc. This has become a bit of a pain, and I think I've lost sight of the original purpose.

So, stepping back, maybe just abandon mpv for now, etc. I'd like to continue testing your macports for tiger, and do my part to make sure it works as much as possible. But am not sure if that's the way, or what still needs testing. If you think debugging the process of doing /opt/bootstrap for a new curl (on tiger) would be a useful thing, maybe that? ie if I don't have a better curl, I'm stuck?
 
Ok, on May 19th you provided detailed instructions on how an /opt/bootstrap can be used to get a better curl and I've tried following them, but ran into problems as it wants to build its own gcc, etc etc etc. We could go into those, but...all of this is just to get a better curl that can handle https, is that correct?

That does not make much practical sense. Keep in mind, I use 10.6 and 10.5, so no idea what 10.4 needs for curl.
You can do much easier then, rebuilding the base against its own curl. Just configure as `--with-curlprefix=/opt/local` and rebuild.

P. S. If you already have a tree in /opt/bootstrap, you may check what it wants with minimal curl:
Code:
sudo port -v install curl -brotli -http2 -idn -psl -zstd
Notice, no -N, so that the command will not start building anything without your approval, it should just calculate and show required dependencies. Refuse to proceed if the list still includes gcc and alikes.
 
Last edited:
@lauland Building against its own curl should work, at least I did that a few times myself, when wanted to save time. (The curl is not “bad”, just the base was configured with /usr/bin/curl by default.)

If this still does not work for w/e reason, let me know, I will build a bootstrap_curl installer for you.
 
@lauland Building against its own curl should work, at least I did that a few times myself, when wanted to save time. (The curl is not “bad”, just the base was configured with /usr/bin/curl by default.)

If this still does not work for w/e reason, let me know, I will build a bootstrap_curl installer for you.
Ok, extremely stupid question maybe. Why not just replace /usr/bin/curl? I know that'd non-standard, modifying the os, possibly evil, may cause incompatibilities, etc etc etc. But seems like it'd be far simpler?

I think you may have already provided a link to a bootstrap_curl...I'll look in the past posts for that.

FYI The /opt/bootstrap build didn't complete due to errors building apple-gcc-42 (or whatever the exact name is). For the record it it failed when "comparing stages".
 
Ok, extremely stupid question maybe. Why not just replace /usr/bin/curl? I know that'd non-standard, modifying the os, possibly evil, may cause incompatibilities, etc etc etc. But seems like it'd be far simpler?

You can move it out and make a symlink to there. Though it will be equivalent to rebuilding against MacPorts own curl, but more fragile.

I think you may have already provided a link to a bootstrap_curl...I'll look in the past posts for that.

There is none for Tiger atm. For 10.5 and 10.6 there is.

FYI The /opt/bootstrap build didn't complete due to errors building apple-gcc-42 (or whatever the exact name is). For the record it it failed when "comparing stages".

Don’t bother building the whole gcc for the sake of curl, IMO, it is really a waste of effort. There are alternative solutions.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.