ruby2d icon indicating copy to clipboard operation
ruby2d copied to clipboard

Improve compatibility: check if SDL2 is available, fallback to SDL if not

Open barracuda156 opened this issue 2 years ago • 0 comments

It fails to build on 10.6 due to a hardcoded error-out:

/opt/local/bin/gcc-mp-13 -I. -I/opt/local/include/ruby-3.3.0/ppc-darwin10.0.0d2 -I/opt/local/include/ruby-3.3.0/ruby/backward -I/opt/local/include/ruby-3.3.0 -I. -I/opt/local/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -std=c99 -fno-common -std=c11  -I../../assets/include  -arch ppc -o canvas.o -c canvas.c
In file included from ../../assets/include/SDL2/SDL_config.h:25,
                 from ../../assets/include/SDL2/SDL_stdinc.h:31,
                 from ../../assets/include/SDL2/SDL_main.h:25,
                 from ../../assets/include/SDL2/SDL.h:32,
                 from ruby2d.h:102,
                 from canvas.c:3:
../../assets/include/SDL2/SDL_platform.h:112:3: error: #error SDL for Mac OS X only supports deploying on 10.7 and above.
  112 | # error SDL for Mac OS X only supports deploying on 10.7 and above.
      |   ^~~~~
make: *** [canvas.o] Error 1

make failed, exit code 2

This is incorrect behavior, in fact. What should be done instead, is:

  1. Check whether SDL2 is available externally (since it is supported on 10.6 Intel presently and likely will be supported for PowerPC via X11 backend too).
  2. If it is not, then fallback to SDL, provided this can be supported.

barracuda156 avatar Mar 16 '24 16:03 barracuda156