Skip to content

Transition from SDL2 to SDL2 Compat + SDL3#2345

Draft
sunshineinabox wants to merge 10 commits intoROCKNIX:nextfrom
sunshineinabox:sdl2-compat
Draft

Transition from SDL2 to SDL2 Compat + SDL3#2345
sunshineinabox wants to merge 10 commits intoROCKNIX:nextfrom
sunshineinabox:sdl2-compat

Conversation

@sunshineinabox
Copy link

@sunshineinabox sunshineinabox commented Feb 22, 2026

Replaces SDL2 build with SDL3 as the core library and SDL2-compat shim, allowing existing SDL2-linked apps to continue working.

Changes in this PR:

  • SDL3 (3.2.30) replaced SDL2
  • SDL2-Compat (2.32.64)
  • SDL2_glesonly: Removed — GLES-only libs are now copied in post_makeinstall_target within the SDL2 package instead
  • App packages (control-gen, list-guid, oga_controls, sdl2text, mako-osd): Updated include paths from build-dir lookups to SYSROOT_PREFIX, and fixed CXX/CFLAGS variable names. (Unsure about the CFLAGS changed, but looked like a typo to me).
  • Patches: DRM resolution and libmali header patches migrated from SDL2 → SDL3.
  • KMSDRM always enabled now

TODOs before merge:

  • Will require testing on multiple devices
  • Currently only building, will start as a draft until I am able to test further (I can test on RK3326 and sm8250)

TODOs Future changes:

  • GL_ES2 is flag is not present in Unix config for SDL2-Compat will need to be fixed upstream, there is a hack to allow building for now
  • SDL2 should more clearly indicate its SDL2-Compat in the future
  • Migrate Rocknix apps to SDL3

More build inheritance resolutions, for host build disable extra subsystems.

resolve gzdoom build error

Do not decouple KMSDRM for now

Adapt patches for SDL3

Force GLES flags sdl2-compat bug

Refactor GLES support handling in SDL2 package.mk

Fix typo

Update CFLAGS to use SYSROOT_PREFIX for SDL2

Dead code (?) resolve path

Resolve build errors
@r3claimer
Copy link
Contributor

Awesome. Definitely something in our todo list. Yes will need lots of testing

@loki666 loki666 self-assigned this Feb 22, 2026
@loki666
Copy link
Contributor

loki666 commented Feb 22, 2026

@sunshineinabox some standalones don't compile

@sunshineinabox
Copy link
Author

I’ll take a look through these logs tonight and work through them. It’s strange I imagine it’s probably related to some device dependent conditionals since I was only building for one device.

This subdirectory is not added due to ENABLE_SDL2_FRONTEND being set to off this patch seems to be applying to dead code not sure why this build error is only showing up now.
@loki666 loki666 assigned loki666 and unassigned loki666 Feb 23, 2026
@loki666
Copy link
Contributor

loki666 commented Feb 23, 2026

@sunshineinabox still failing
SM8550 finished building... I'll test that already

@sunshineinabox
Copy link
Author

sunshineinabox commented Feb 23, 2026

Yea switching from fbdev to EGL introduced more X11 related erros so will have to update those flags then I'll stop making changes so that it can actually be tested. Currently building on my macbook so its been slow goings for builds, unfrotunately!

EDIT: it should also build at e51e49901d2bb0360ddf5041488b4c2681efd95c for all targets.

@sunshineinabox
Copy link
Author

https://github.com/sunshineinabox/distribution/actions/runs/22337426588

Builds now

@sunshineinabox
Copy link
Author

sunshineinabox commented Feb 27, 2026

Some things I've noticed. Seems to work fine with brief testing of emulators (Dreamcast, PSP, N64, GBA, Genesis). Built in apps are broken (I think this is due to SDL2_image, SDL2gfx libraries, but have not made a debug build to confirm, the downside of using a shim. Luckily it has already been ported to SDL3). Still need to test on a more capable device. I cannot test HDMI output so need to ensure the rebased patch works appropriately. Had a heck of a time with formatting of this patch using github codespace so now I'm using vscode locally. Using EGL in PPSSPP will require some guards that prevent defaulting to X11. They are working on transition to SDL3 so I'll wait before putting in effor there and I doubt it will yield significant changes. I think next steps will be migrating built in apps like file manager over to sdl3.


CXX ?= gcc
CCFLAGS = -W -Wall -std=c++11 `sdl2-config --cflags`
CXX ?= g++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these really necessary ?
normally gcc is able to figure out it need to use g++ when compiling .cpp files

maybe it was an issue with you not using docker ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its only cosmetic, gcc silently uses G++ to compile cpp files as you said just for the sake of clairty. I was more curious about the CCFLAGS change, I assume this was a typo when I was looking through, but wanted to ensure that was the case. It seemed like it was never consumed.

Copy link
Contributor

@loki666 loki666 Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed CCFLAGS wasn't used nice spot

but for PR clarity, please keep changes to minium needed
if CXX ?= gcc was working, please keep as is.

it make looks like these changes are needed for SDL3/SDL2 compat migration

that goes for all the other changes in Makefile and package.mk files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, sorry about that!

@loki666
Copy link
Contributor

loki666 commented Feb 28, 2026

some quick tests on SM8650
so far so good, tools, emulators and portmasters + some ports seems fine

I don't think we need to migrate our tools to SDL3... SDL2 compat will stay there for a while

@sunshineinabox
Copy link
Author

I'll have to confirm file manager works on libmali without pr to confirm now that you mention it, ideally it would be easier to just keep sdl2 compat. Will report back after some testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants