When USE="sdl" is enabled for media-libs/gegl (tested on version 0.4.36-r1), the ebuild configures the package to enable sdl1, even though sdl2 support is available. After modifying the ebuild to enable sdl2 support instead, I was still able to compile gegl without issues. Other distributions (checked with Clear Linux and Arch) build gegl with sdl2 support as well. Unless there are any reasons not to, I'd suggest for Gentoo to do the same.
Sorry for delay. I wanted to add new USE flag on version bump. The meson.build script allows to turn on/off sdl1 and sdl2 support simultaneously or independent. Therefore it will be possible to switch of sdl1 support in media-libs/gegl-0.4.38 package.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf8d9fa7c9bf8fd6f4291216eacbcc2cea9d6ddb commit bf8d9fa7c9bf8fd6f4291216eacbcc2cea9d6ddb Author: Sergey Torokhov <torokhov-s-a@yandex.ru> AuthorDate: 2022-08-29 22:28:49 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-08-31 22:26:33 +0000 media-libs/gegl: 0.4.38 version bump Use 'filter-lto' to allow build in LTO profiles. Add USE="sdl2" flag. Closes: https://bugs.gentoo.org/859901 Closes: https://bugs.gentoo.org/860246 Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru> Signed-off-by: Sam James <sam@gentoo.org> media-libs/gegl/Manifest | 1 + media-libs/gegl/gegl-0.4.38.ebuild | 156 +++++++++++++++++++++++++++++++++++++ media-libs/gegl/gegl-9999.ebuild | 14 ++-- media-libs/gegl/metadata.xml | 1 + 4 files changed, 167 insertions(+), 5 deletions(-)