SDL 1, SDL 2 and SDL 3


     1. INTRODUCTION
     2. INSTALLING SDL 2.0
     3. INSTALLING SDL 3.0


1. INTRODUCTION

Site: https://libsdl.org/

SDL is a collection of 3 libraries, i.e. 3 different versions: SDL 1, SDL 2 and
SDL 3, with a few differences between them. Program "tyr-quake" was made to use
version 2, but compatibility programs have also been created.

The libraries, compatibility programs and some download links are listed below.

SDL 3.0 and SDL 2.0:
-------------------

https://github.com/libsdl-org/SDL

"Simple DirectMedia Layer (SDL for short) is a cross-platform library designed
to make it easy to write multi-media software, such as games and emulators."

https://github.com/libsdl-org/SDL/releases

sdl2-compat:
-----------

https://github.com/libsdl-org/sdl2-compat

"This code is a compatibility layer; it provides a binary and source
compatible API for programs written against SDL2, but it uses SDL3 behind the
scenes."

https://github.com/libsdl-org/sdl2-compat/releases

SDL 1.2 and a few older versions of SDL 2.0:
-------------------------------------------

https://sourceforge.net/projects/libsdl/

https://sourceforge.net/projects/libsdl/files/SDL/

sdl12-compat:
------------

https://github.com/libsdl-org/sdl12-compat

"This code is a compatibility layer; it provides a binary and source
compatible API for programs written against SDL 1.2, but it uses SDL 2.0
behind the scenes. If you are writing new code, please target SDL 3.0 directly
and do not use this layer."

https://github.com/libsdl-org/sdl12-compat/releases

Actually, if you want to support the highest number of hardware devices and
operating systems, SDL 1.2 is the best library to use. The program will
function with:

SDL 1.2

sdl12-compat and SDL 2.0

sdl12-compat, sdl2-compat and SDL 3.0

So if you don't need the additional features of SDL 2.0 or SDL 3.0, your
program written for SDL 1.2 will have the highest support. The program will
compile in the same way regardless of whether you use SDL 1.2 or sdl12-compat.

As shown below, some new GNU/Linux distributions are providing the
compatibility programs instead of the initial libraries. The next 2 pages are
also available at https://web.archive.org/:

https://fedoraproject.org/wiki/Changes/SDL12onSDL2 (about Fedora 35)

"SDL 1.2 development ended long ago, with SDL 2.0 replacing it. However, many
older games still use SDL 1.2 and cannot change to SDL 2.0. In order to help
move SDL 1.2 games into the modern world, let's replace SDL 1.2 with
sdl12-compat, which uses SDL 2.0."

https://discussion.fedoraproject.org/t/f42-change-proposal-replace-sdl-2-with-sdl2-compat-using-sdl-3-self-contained/138987

"SDL 2 feature development ended some time ago with efforts being focused on
SDL 3. However, many older games still use SDL 2 and cannot change to SDL 3.
In order to continue to support SDL 2 games in the modern world, let’s replace
SDL 2 with sdl2-compat, which uses SDL 3. This also has the effect of moving
SDL 1.2 games to SDL3 through sdl12-compat running on sdl2-compat."

You should install SDL 1, SDL 2 or SDL 3 from the addresses mentioned above or,
at least, get the SDL-devel, SDL2-devel or SDL3-devel package for your
GNU/Linux distribution.

Another download link:

https://www.libsdl.org/release/


2. INSTALLING SDL 2.0

If you don't have SDL2-devel installed, download SDL 2:

https://www.libsdl.org/release/

For instance: SDL2-2.32.10.tar.gz

Extract the archive and install the program. You can install it in directory
/opt/local or anywhere else you want, or simply not specify any directory and
let it install in the default locations (less recommended). First:

cd /opt/
su -c 'mkdir local'
su -c 'chown username local;chgrp username local'

Then enter directory SDL2-2.32.10 and type:

./configure --prefix=/opt/local/SDL2
make
make install

After installation, add a file named "sdl2-config" with the following contents
to directory ~/bin:

/opt/local/SDL2/bin/sdl2-config $1 $2

Directory ~/bin should be in your path, check by typing:

echo $PATH


3. INSTALLING SDL 3.0

If you don't have SDL3-devel installed, download and install cmake and SDL 3:

https://cmake.org/download/

Get the source code - for instance: file cmake-4.1.2.tar.gz

https://www.libsdl.org/release/

Same here, for instance: SDL3-3.2.24.tar.gz

Extract the archives and install the programs. You can install them in
directory /opt/local or anywhere else you want, or simply not specify any
directory and let them install in the default locations (less recommended).
First:

cd /opt/
su -c 'mkdir local'
su -c 'chown username local;chgrp username local'

Enter directory cmake-4.1.2, with command cd, and type:

./configure --prefix=/opt/local/cmake
make
make install
cd ~
ln -s /opt/local/cmake/bin/cmake bin/cmake

Directory ~/bin should be in your path, check by typing:

echo $PATH

Then enter directory SDL3-3.2.24 and type:

cmake -DCMAKE_INSTALL_PREFIX=/opt/local/SDL3
make
make install

No need to type "mkdir build" and "cd build". After installation, type:

su
Password:
ln -s /opt/local/SDL3/lib64/pkgconfig/sdl3.pc /usr/lib64/pkgconfig/sdl3.pc
exit

Then if you don't have SDL3 for your distribution installed, type:

su -c 'ln -s /opt/local/SDL3/lib64/libSDL3.so.0 /usr/lib64/libSDL3.so.0'
