Diff libsdl2-2.30.11 with a libsdl2-2.32.64

/usr/portage/media-libs/libsdl2/libsdl2-2.32.64.ebuild 2026-02-10 11:18:07.214120147 +0300
1
# Copyright 1999-2025 Gentoo Authors
1
# Copyright 2025-2026 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6
inherit cmake-multilib flag-o-matic
6
inherit cmake-multilib dot-a
7 7

  
8
MY_P="SDL2-${PV}"
8
# TODO: switch to new description when non-compat is gone, this is so it is
9
# not displayed on packages.gentoo.org which may be confusing for users
9 10
DESCRIPTION="Simple Direct Media Layer"
11
#DESCRIPTION="Simple Direct Media Layer 2 compatibility wrapper around SDL3"
10 12
HOMEPAGE="https://www.libsdl.org/"
11
SRC_URI="https://www.libsdl.org/release/${MY_P}.tar.gz"
12
S="${WORKDIR}/${MY_P}"
13
SRC_URI="https://www.libsdl.org/release/sdl2-compat-${PV}.tar.gz"
14
S=${WORKDIR}/sdl2-compat-${PV}
13 15

  
14 16
LICENSE="ZLIB"
15 17
SLOT="0"
16
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
17

  
18
IUSE="alsa aqua cpu_flags_ppc_altivec cpu_flags_x86_3dnow cpu_flags_x86_mmx cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 custom-cflags dbus doc fcitx gles1 gles2 +haptic ibus jack +joystick kms libsamplerate nas opengl oss pipewire pulseaudio sndio +sound static-libs test udev +video vulkan wayland X xscreensaver"
19
RESTRICT="!test? ( test )"
20
REQUIRED_USE="
21
	alsa? ( sound )
22
	fcitx? ( dbus )
23
	gles1? ( video )
24
	gles2? ( video )
25
	haptic? ( joystick )
26
	ibus? ( dbus )
27
	jack? ( sound )
28
	kms? ( || ( gles1 gles2 opengl ) )
29
	nas? ( sound )
30
	opengl? ( video )
31
	pulseaudio? ( sound )
32
	sndio? ( sound )
33
	test? ( static-libs )
34
	vulkan? ( video )
35
	wayland? ( gles2 )
36
	xscreensaver? ( X )
18
# unkeyworded for testing
19
#KEYWORDS="~amd64"
20
# this skips most non-compat libsdl2 former IUSE that are not used by revdeps,
21
# albeit it is questionable that some depend on audio alsa/pipewire (note that
22
# static-libs is left out because it is useless for static-only builds given
23
# it will dlopen the shared libsdl3 anyway)
24
#
25
# TODO: either update revdeps to have (+) on no-op IUSE (haptic, joystick,
26
# sound, and video) then cleanup, or don't for less overlay issues and instead
27
# force in profiles to avoid unnecessary rebuilds -- not forced right now given
28
# a >=2.32.50 in profile would force for a potential future non-compat 2.34.0
29
IUSE="
30
	X alsa gles2 +haptic +joystick kms opengl pipewire pulseaudio
31
	+sound test +video vulkan wayland
37 32
"
33
REQUIRED_USE="gles2? ( opengl )"
34
RESTRICT="!test? ( test )"
38 35

  
39
COMMON_DEPEND="
40
	virtual/libiconv[${MULTILIB_USEDEP}]
41
	alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
42
	dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
43
	ibus? ( app-i18n/ibus )
44
	jack? ( virtual/jack[${MULTILIB_USEDEP}] )
45
	kms? (
46
		>=x11-libs/libdrm-2.4.82[${MULTILIB_USEDEP}]
47
		>=media-libs/mesa-9.0.0[${MULTILIB_USEDEP},gbm(+)]
48
	)
49
	libsamplerate? ( media-libs/libsamplerate[${MULTILIB_USEDEP}] )
50
	nas? (
51
		>=media-libs/nas-1.9.4[${MULTILIB_USEDEP}]
52
		>=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}]
53
	)
54
	opengl? (
55
		>=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
56
		>=virtual/glu-9.0-r1[${MULTILIB_USEDEP}]
57
	)
58
	pipewire? ( media-video/pipewire:=[${MULTILIB_USEDEP}] )
59
	pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
60
	sndio? ( media-sound/sndio:=[${MULTILIB_USEDEP}] )
61
	udev? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP}] )
62
	wayland? (
63
		>=dev-libs/wayland-1.20[${MULTILIB_USEDEP}]
64
		gui-libs/libdecor[${MULTILIB_USEDEP}]
65
		>=media-libs/mesa-9.1.6[${MULTILIB_USEDEP},egl(+),gles2(+),wayland]
66
		>=x11-libs/libxkbcommon-0.2.0[${MULTILIB_USEDEP}]
67
	)
68
	X? (
69
		>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
70
		>=x11-libs/libXcursor-1.1.14[${MULTILIB_USEDEP}]
71
		>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
72
		>=x11-libs/libXfixes-6.0.0[${MULTILIB_USEDEP}]
73
		>=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}]
74
		>=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
75
		xscreensaver? ( >=x11-libs/libXScrnSaver-1.2.2-r1[${MULTILIB_USEDEP}] )
76
	)
77
"
36
# libsdl3 is dlopen'ed and USE at build time should not matter except X, it
37
# enables everything else but will not work without libsdl3 support at runtime
78 38
RDEPEND="
79
	${COMMON_DEPEND}
80
	fcitx? ( app-i18n/fcitx:* )
81
	gles1? ( media-libs/mesa[${MULTILIB_USEDEP},gles1(+)] )
82
	gles2? ( media-libs/mesa[${MULTILIB_USEDEP},gles2(+)] )
83
	vulkan? ( media-libs/vulkan-loader )
39
	>=media-libs/libsdl3-3.2.12[X?,alsa?,opengl?,pipewire?,pulseaudio?,vulkan?,wayland?,${MULTILIB_USEDEP}]
84 40
"
85 41
DEPEND="
86
	${COMMON_DEPEND}
87
	gles1? ( media-libs/libglvnd )
88
	gles2? ( media-libs/libglvnd )
89
	ibus? ( dev-libs/glib:2[${MULTILIB_USEDEP}] )
90
	test? ( x11-libs/libX11[${MULTILIB_USEDEP}] )
91
	vulkan? ( dev-util/vulkan-headers )
92
	X? ( x11-base/xorg-proto )
93
"
94
BDEPEND="
95
	virtual/pkgconfig
96
	doc? (
97
		app-text/doxygen
98
		media-gfx/graphviz
42
	${RDEPEND}
43
	X? (
44
		x11-base/xorg-proto
45
		x11-libs/libX11
99 46
	)
100
	wayland? ( >=dev-util/wayland-scanner-1.20 )
101 47
"
102 48

  
103
MULTILIB_WRAPPED_HEADERS=(
104
	/usr/include/SDL2/SDL_config.h
105
	/usr/include/SDL2/SDL_platform.h
106
	/usr/include/SDL2/begin_code.h
107
	/usr/include/SDL2/close_code.h
108
)
109

  
110
src_prepare() {
111
	cmake_src_prepare
112

  
113
	# Unbundle some headers.
114
	rm -r src/video/khronos || die
115
	ln -s "${ESYSROOT}/usr/include" src/video/khronos || die
116
}
117

  
118 49
src_configure() {
119
	use custom-cflags || strip-flags
50
	lto-guarantee-fat
120 51

  
121 52
	local mycmakeargs=(
122
		-DSDL_STATIC=$(usex static-libs)
123
		-DSDL_SYSTEM_ICONV=ON
124
		-DSDL_GCC_ATOMICS=ON
125
		-DSDL_AUDIO=$(usex sound)
126
		-DSDL_VIDEO=$(usex video)
127
		-DSDL_JOYSTICK=$(usex joystick)
128
		-DSDL_HAPTIC=$(usex haptic)
129
		-DSDL_POWER=ON
130
		-DSDL_FILESYSTEM=ON
131
		-DSDL_TIMERS=ON
132
		-DSDL_FILE=ON
133
		-DSDL_LOADSO=ON
134
		-DSDL_ASSEMBLY=ON
135
		-DSDL_ALTIVEC=$(usex cpu_flags_ppc_altivec)
136
		-DSDL_SSEMATH=$(usex cpu_flags_x86_sse)
137
		-DSDL_MMX=$(usex cpu_flags_x86_mmx)
138
		-DSDL_3DNOW=$(usex cpu_flags_x86_3dnow)
139
		-DSDL_SSE=$(usex cpu_flags_x86_sse)
140
		-DSDL_SSE2=$(usex cpu_flags_x86_sse2)
141
		-DSDL_SSE3=$(usex cpu_flags_x86_sse3)
142
		-DSDL_OSS=$(usex oss)
143
		-DSDL_ALSA=$(usex alsa)
144
		-DSDL_ALSA_SHARED=OFF
145
		-DSDL_JACK=$(usex jack)
146
		-DSDL_JACK_SHARED=OFF
147
		-DSDL_ESD=OFF
148
		-DSDL_PIPEWIRE=$(usex pipewire)
149
		-DSDL_PIPEWIRE_SHARED=OFF
150
		-DSDL_PULSEAUDIO=$(usex pulseaudio)
151
		-DSDL_PULSEAUDIO_SHARED=OFF
152
		-DSDL_ARTS=OFF
153
		-DSDL_LIBSAMPLERATE=$(usex libsamplerate)
154
		-DSDL_LIBSAMPLERATE_SHARED=OFF
155
		-DSDL_WERROR=OFF
156
		-DSDL_NAS=$(usex nas)
157
		-DSDL_NAS_SHARED=OFF
158
		-DSDL_SNDIO=$(usex sndio)
159
		-DSDL_SNDIO_SHARED=OFF
160
		-DSDL_DISKAUDIO=$(usex sound)
161
		-DSDL_DUMMYAUDIO=$(usex sound)
162
		-DSDL_WAYLAND=$(usex wayland)
163
		-DSDL_WAYLAND_SHARED=OFF
164
		-DSDL_WAYLAND_LIBDECOR=$(usex wayland)
165
		-DSDL_WAYLAND_LIBDECOR_SHARED=OFF
166
		-DSDL_RPI=OFF
167
		-DSDL_X11=$(usex X)
168
		-DSDL_X11_SHARED=OFF
169
		-DSDL_X11_XSCRNSAVER=$(usex xscreensaver)
170
		-DSDL_COCOA=$(usex aqua)
171
		-DSDL_DIRECTFB=OFF
172
		-DSDL_FUSIONSOUND=OFF
173
		-DSDL_KMSDRM=$(usex kms)
174
		-DSDL_KMSDRM_SHARED=OFF
175
		-DSDL_DUMMYVIDEO=$(usex video)
176
		-DSDL_OPENGL=$(usex opengl)
177
		-DSDL_OPENGLES=$(use gles1 || use gles2 && echo ON || echo OFF)
178
		-DSDL_VULKAN=$(usex vulkan)
179
		-DSDL_LIBUDEV=$(usex udev)
180
		-DSDL_DBUS=$(usex dbus)
181
		-DSDL_IBUS=$(usex ibus)
182
		-DSDL_CCACHE=OFF
183
		-DSDL_DIRECTX=OFF
184
		-DSDL_RPATH=OFF
185
		-DSDL_VIDEO_RENDER_D3D=OFF
186
		-DSDL_TESTS=$(usex test)
53
		-DSDL2COMPAT_TESTS=$(usex test)
54
		-DSDL2COMPAT_X11=$(usex X)
187 55
	)
56

  
188 57
	cmake-multilib_src_configure
189 58
}
190 59

  
191
src_compile() {
192
	multilib-minimal_src_compile
193

  
194
	if use doc; then
195
		cd docs || die
196
		doxygen || die
197
	fi
198
}
60
src_install() {
61
	cmake-multilib_src_install
199 62

  
200
src_test() {
201
	unset SDL_GAMECONTROLLERCONFIG SDL_GAMECONTROLLER_USE_BUTTON_LABELS
202
	cmake-multilib_src_test
203
}
63
	strip-lto-bytecode
204 64

  
205
multilib_src_install_all() {
206
	rm -r "${ED}"/usr/share/licenses/ || die
207
	dodoc {BUGS,CREDITS,README-SDL,TODO,WhatsNew}.txt README.md docs/README*.md
208
	use doc && dodoc -r docs/output/html/
65
	rm -r -- "${ED}"/usr/share/licenses || die
209 66
}
Thank you!