Introduction to sdl2-compat
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. This package is a compatibility layer and uses
SDL3-3.2.16 under the hood. It provides support
for packages that use SDL2 and have not switched to SDL3, yet.
sdl2-compat Dependencies
Required
CMake
and SDL3-3.2.16
Installation of sdl2-compat
Install sdl2-compat by running the
following commands:
mkdir build &&
cd build &&
cmake -D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_SKIP_INSTALL_RPATH=ON \
-D SDL2COMPAT_STATIC=OFF \
-D SDL2COMPAT_TESTS=OFF \
-W no-dev -G Ninja .. &&
ninja
Now, as the root
user:
ninja install &&
rm -vf /usr/lib/libSDL2*.{,l}a
If you want to build the tests, issue the following commands:
mkdir ../build-tests &&
cd ../build-tests &&
cmake -D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_SKIP_INSTALL_RPATH=ON \
-D SDL2COMPAT_INSTALL_TESTS=ON \
-D SDL2COMPAT_STATIC=OFF \
-D SDL2COMPAT_TESTS=ON \
-W no-dev -G Ninja .. &&
ninja &&
DESTDIR=$PWD/TESTS ninja install
Now you will be able to run the tests in TESTS/usr/libexec/installed-tests/SDL2_compat
.
You will have to run the tests individually. Some of them may need
to be manually killed and audio will need to be working so that you
can hear from the default audio output. Make sure sdl2-compat is installed before running the
tests, or use the LD_PRELOAD
variable to
preload libSDL2.so
from ../build
for each test.
lib32 Installation of sdl2-compat
Install lib32-sdl2-compat by
running the following commands:
cd ../ &&
rm -rf build build-tests &&
mkdir build &&
cd build &&
CC="gcc -m32" CXX="g++ -m32" \
PKG_CONFIG_PATH=/usr/lib32/pkgconfig \
cmake -D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib32 \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_SKIP_INSTALL_RPATH=ON \
-D SDL2COMPAT_STATIC=OFF \
-D SDL2COMPAT_TESTS=OFF \
-W no-dev -G Ninja .. &&
ninja
Now, as the root
user:
DESTDIR=$PWD/DESTDIR ninja install &&
rm -vf DESTDIR/usr/lib32/libSDL2*.{,l}a &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR &&
ldconfig
Command Explanations
-D
CMAKE_SKIP_INSTALL_RPATH=ON
: This switch makes
cmake remove
hardcoded library search paths (rpath) when installing a binary
executable file or a shared library. This package does not need
rpath once it's installed into the standard location, and rpath may
sometimes cause unwanted effects or even security issues.
-D SDL2COMPAT_STATIC=OFF
:
This parameter disables building the static libraries.
-D SDL2COMPAT_TESTS=OFF
:
This parameter disables building the tests.
rm -vf
/usr/lib/libSDL2*.{,l}a: This command removes
useless static 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
|