sdl2-compat-2.32.64

#### Gaming Linux® From Scratch - Version 13.0

### Chapter 21. Miscellaneous

- Prev

  SDL3-3.4.0

- Next

  GS

- Up
- Home

# sdl2-compat-2.32.64

## Introduction to sdl2-compat

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

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

### sdl2-compat Dependencies

Required
CMake-4.2.3 and SDL3-3.4.0

## 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

## lib32 Installation of sdl2-compat

Install lib32-sdl2-compat by running the following commands:

    rm -rf * &&
    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_test.a &&
    cp -vr DESTDIR/usr/lib32/* /usr/lib32   &&
    rm -rf DESTDIR                          &&
    ldconfig

## Command Explanations

### Note

For a full list of options and values, make sure you are in a build directory, then run cmake -LAH ...

`-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
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` | provides compatibility functions for SDL2 applications using SDL3

- Prev

  SDL3-3.4.0

- Next

  GS

- Up
- Home