#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-491

### Chapter 42. Multimedia Libraries and Drivers

- Prev

  SBC-2.2

- Next

  SDL3-3.4.8

- Up
- Home

# sdl2-compat-2.32.68

## Introduction to sdl2-compat

The sdl2-compat package provides a compatibility layer for packages that require SDL2, utilizing SDL3 as the backend.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://www.libsdl.org/release/sdl2-compat-2.32.68.tar.gz

- Download MD5 sum: 1c5594cf711be75ffca88586a4d8781e

- Download size: 2.7 MB

- Estimated disk space required: 63 MB (add 29 MB for tests)

- Estimated build time: 0.1 SBU (add 0.1 SBU for tests)

### sdl2-compat Dependencies

#### Required

CMake-4.3.2 and SDL3-3.4.8

## 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_test.a

## Testing sdl2-compat

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.

## 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_test.a: This command removes a useless static library.

## Contents

Installed Program: sdl2-config
Installed Libraries: libSDL2.so
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.so` | provides compatibility functions for SDL2 applications using SDL3

- Prev

  SBC-2.2

- Next

  SDL3-3.4.8

- Up
- Home