Introduction to SDL2
The Simple DirectMedia Layer Version 2 (SDL2 for short) is a
cross-platform library designed to make it easy to write multimedia
software, such as games and emulators.
Note
If you want, you can instead install SDL3 and
sdl2-compat
as suitable replacements for this package. Wine and ffplay from FFmpeg are known to
work with sdl2-compat.
Note
This may take a while to build. Feel free to do something else
while this is building.
SDL2 Dependencies
Recommended
libxkbcommon-1.11.0, Wayland-Protocols-1.45, and Xorg
Libraries (if those are not present, the corresponding modules
are not built)
Optional
alsa-lib-1.2.14, ibus,
libsamplerate, nasm,
pipewire, PulseAudio-17.0, a window manager or
desktop environment, DirectFB,
fcitx, jack, and sndio
Installation of SDL2
Install SDL2 by running the following commands:
./configure --prefix=/usr &&
make
Now, as the root
user:
make install &&
rm -v /usr/lib/libSDL2*.a
lib32 Installation of SDL2
Install lib32-SDL2 by running the following commands:
make distclean &&
CC="gcc -m32" CXX="g++ -m32" \
PKG_CONFIG_PATH=/usr/lib32/pkgconfig \
./configure --prefix=/usr \
--libdir=/usr/lib32 \
--host=i686-pc-linux-gnu &&
make
Now, as the root
user:
make DESTDIR=$PWD/DESTDIR install &&
rm -v DESTDIR/usr/lib32/libSDL2*.a &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR &&
ldconfig
Command Explanations
Note
Run ./configure
--help for a full list of options.
rm -v
/usr/lib/libSDL2*.a: Normally static libraries can
be disabled with a --disable-static
option to configure, but that breaks the build in this package.
--disable-alsa-shared
: This switch
disables dynamically loading ALSA shared libraries.
--disable-sdl-dlopen
: This switch
disables using dlopen for shared object loading. Loading image
backend libraries like libpng dynamically on the fly does not work.
--disable-x11-shared
: This switch
disables dynamically loading X11 shared libraries.
Contents
Installed Program:
sdl2-config
Installed Libraries:
libSDL2
Installed Directories:
/usr/include/SDL2 and
/usr/lib/cmake/SDL2
Short Descriptions
sdl2-config
|
determines the compile and linker flags that should be
used to compile and link programs that use libSDL2
|
libSDL2
|
contains functions that provide low level access to
audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D frame buffer across multiple platforms
|