Linux HOWTOs

About | Home | Search


ERROR: Slooooow dooooown... this page load was delayed.

HOWTO: sdl
Description: Simple Directmedia Layer: Cross-platform multimedia library
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# SDL
# ===
# Below is SDL itself and some commonly used SDL libraries

# For a list of some apps and libraries (with links to their howtos) that
# use SDL, skip down to the bottom

# If you ever want to uninstall SDL (and SDL_image, etc.), skip down to the
# very bottom for instructions

# Create directories for source and tarballs
mkdir -p -m 0700 ~/installed/SDL ~/src/SDL


# SDL 1.2.13
# ==========
# Slackware 11.0 and 12.0's 'sdl' packages include version 1.2.11

# Prerequisites:
# NASM (optional)
# ALSA >= 0.9.0
# aRts (Analog RealTime Synthesizer - KDE's sound server)
# esd/esound >= 0.2.8
# pkg-config
# PulseAudio 0.9
# NAS
# XFree86 or X.org
# DirectFB
# svgalib

# Below I just blow away existing library files before running 'make
# install' to ensure that extra files aren't left behind that are no longer
# needed.  If you run a production system with multiple local users that may
# be using apps that are linked with libSDL, you'll want to skip that part
# below and you should clean up old files manually after you're done
# installing SDL.

# FYI, when I was running Slackware 11.0, this would not build for me
# with the Slackware kernel headers for 2.6 from 'testing', but was OK
# with the regular (2.4) kernel headers package.

cd
test -f installed/SDL/SDL-1.2.13.tar.gz &&
 mv installed/SDL/SDL-1.2.13.tar.gz .
test ! -f SDL-1.2.13.tar.gz &&
 wget http://www.libsdl.org/release/SDL-1.2.13.tar.gz

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "c6660feea2a6834de10bc71b2f8e4d88  SDL-1.2.13.tar.gz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "51fcaa3e1d5c01fd813ea08688780f86b19cf539  SDL-1.2.13.tar.gz" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys A7763BE6 > /dev/null 2>&1 || gpg --recv-keys A7763BE6 ) &&
 wget http://www.libsdl.org/release/SDL-1.2.13.tar.gz.sig &&
  gpg --verify SDL-1.2.13.tar.gz.sig && rm SDL-1.2.13.tar.gz.sig

cd src/SDL
find -maxdepth 1 -type d -name "SDL-*" -exec rm -r {} \;
tar xzvf ~/SDL-1.2.13.tar.gz
cd SDL-1.2.13
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg sdl

# This will zap the include directory if you have an old version of SDL
# installed, which I do to try to avoid having old deprecated files taking
# up space
test -d /usr/include/SDL && rm -r /usr/include/SDL

( cd /usr/lib ; rm -f libSDL.* libSDL-1.2.so.* libSDLmain.a )
make install
ldconfig
chown -R $USER .
chmod -R u+w .

# Become yourself again
exit

cd
rm -f installed/SDL-*.tar.* installed/SDL/SDL-*.tar.*
mv SDL-1.2.13.tar.gz installed/SDL/


# SDL Libraries
# =============
# Install these if the SDL-using application that you're compiling requires
# them.  At the bottom is SDL_Perl (SDL bindings for perl).


# SDL_image 1.2.6
# ===============
# Apps/libs/games that I know of that use this one are:
# (the list will be updated as I come across others)
# Frozen Bubble

# Prerequisites (beyond those listed above):
# SDL >= 1.2.10
# libtiff
# libjpeg
# libpng
# zlib

cd
test -f installed/SDL/SDL_image-1.2.6.tar.gz &&
 mv installed/SDL/SDL_image-1.2.6.tar.gz .
test ! -f SDL_image-1.2.6.tar.gz &&
 wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.6.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_image-*" -exec rm -r {} \;
tar xzvf ~/SDL_image-1.2.6.tar.gz
cd SDL_image-1.2.6
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

rm -f /usr/lib/libSDL_image*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_image-*.tar.*
mv SDL_image-1.2.6.tar.gz installed/SDL/


# SDL_Console 2.1
# ===============
# Prerequisites (beyond those listed above):
# SDL >= 1.2.4
# SDL_image (optional)

cd
test -f installed/SDL/sdlconsole-2.1.tar.gz &&
 mv installed/SDL/sdlconsole-2.1.tar.gz .
test ! -f sdlconsole-2.1.tar.gz &&
 wget http://easynews.dl.sourceforge.net/sourceforge/sdlconsole/\
sdlconsole-2.1.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "sdlconsole-*" -exec rm -r {} \;
tar xzvf ~/sdlconsole-2.1.tar.gz
cd sdlconsole-2.1
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make
su -c "make install ; ldconfig"
cd
rm -f installed/SDL/sdlconsole-*.tar.*
mv sdlconsole-2.1.tar.gz installed/SDL/


# SMPEG
# =====
# The prerequisites are only current as of the time that I wrote this
# because you'll be getting the software from CVS, they may change by the
# time you install SMPEG.
#
# Prerequisites (beyond those listed above):
# autoconf (to create ./configure, etc.)
# cvs (to get SMPEG itself)
# SDL >= 1.2.0
# GTK+ >= 1.2.1
#
# Note: to update smpeg after you first check it out, cd into the source
# directory and run 'cvs update'.

# If you have any trouble updating a version of CVS, just blow it away and
# check out a new copy.

cd ~/src/SDL
test -d ./smpeg && ( cd smpeg ; svn up )
test ! -d ./smpeg &&
 svn co svn://svn.icculus.org/smpeg/trunk smpeg
cd smpeg
test -f Makefile && make distclean
./autogen.sh
./configure --prefix=/usr
make
su -c "make install"
cd
echo "SMPEG was installed from Subversion" > installed/SDL/SMPEG.README
echo "Source is in ~/src/SDL/smpeg" >> installed/SDL/SMPEG.README


# SDL_mixer 1.2.8
# ===============
# Apps/libs/games that I know of that use this one are:
# Frozen Bubble

# Prerequisites (beyond those listed above):
# SDL >= 1.2.10
# libmikmod >= 3.1.10
# libvorbis (if you want Ogg Vorbis support)
# SMPEG (if you want mp3 support) >= 0.4.3

# With previous versions of SDL_mixer I had to pass --disable-smpegtest
# to configure, but that is no longer required for SDL_mixer 1.2.8 and
# SMPEG from Subversion.

cd
test -f installed/SDL/SDL_mixer-1.2.8.tar.gz &&
 mv installed/SDL/SDL_mixer-1.2.8.tar.gz .
test ! -f SDL_mixer-1.2.8.tar.gz &&
 wget http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.8.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_mixer-*" -exec rm -r {} \;
tar xzvf ~/SDL_mixer-1.2.8.tar.gz
cd SDL_mixer-1.2.8
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --disable-smpegtest
make
su -c "make install ; ldconfig"
cd
rm -f installed/SDL/SDL_mixer-*.tar.*
mv SDL_mixer-1.2.8.tar.gz installed/SDL/


# GUIlib 1.2.1
# ===============
# Prerequisites (beyond those listed above):
# SDL >= 1.0.1

cd
test -f installed/SDL/GUIlib-1.2.1.tar.gz &&
 mv installed/SDL/GUIlib-1.2.1.tar.gz .
test ! -f GUIlib-1.2.1.tar.gz &&
 wget http://www.libsdl.org/projects/GUIlib/src/GUIlib-1.2.1.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "GUIlib-*" -exec rm -r {} \;
tar xzvf ~/GUIlib-1.2.1.tar.gz
cd GUIlib-1.2.1
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

test -d /usr/include/GUI && rm -r /usr/include/GUI
( cd /usr/lib ; rm -f libGUI-1.1.* libGUI.* )
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/GUIlib-*.tar.*
mv GUIlib-1.2.1.tar.gz installed/SDL/


# SDL_net 1.2.7
# ===============
# Prerequisites (beyond those listed above):
# SDL >= 1.2.4
# GUIlib (optional; for the demo program)

cd
test -f installed/SDL/SDL_net-1.2.7.tar.gz &&
 mv installed/SDL/SDL_net-1.2.7.tar.gz .
test ! -f SDL_net-1.2.7.tar.gz &&
 wget http://www.libsdl.org/projects/SDL_net/release/SDL_net-1.2.7.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_net-*" -exec rm -r {} \;
tar xzvf ~/SDL_net-1.2.7.tar.gz
cd SDL_net-1.2.7
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become yourself to install it
su

rm -f /usr/lib/libSDL_net*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_net-*.tar.*
mv SDL_net-1.2.7.tar.gz installed/SDL/


# SDL_sound 1.0.1
# ===============
# Prerequisites (beyond those listed above):
# SDL >= 1.2.0
# FLAC (optional)
# SMPEG (optional)
# libmikmod >= 3.1.5 (optional)
# ModPlug (an XMMS plugin; optional)
# Ogg, Vorbis, Speex (optional)

cd
test -f installed/SDL/SDL_sound-1.0.1.tar.gz &&
 mv installed/SDL/SDL_sound-1.0.1.tar.gz .
test ! -f SDL_sound-1.0.1.tar.gz &&
 wget http://icculus.org/SDL_sound/downloads/SDL_sound-1.0.1.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_sound-*" -exec rm -r {} \;
tar xzvf ~/SDL_sound-1.0.1.tar.gz
cd SDL_sound-1.0.1
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --disable-smpegtest
make

# Become root to install it
su

rm -f /usr/lib/libSDL_sound*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_sound-*.tar.*
mv SDL_sound-1.0.1.tar.gz installed/SDL/


# SDL_ttf 2.0.9
# =============
# Prerequisites (beyond those listed above):
# Freetype
# SDL >= 1.2.4

cd
test -f installed/SDL/SDL_ttf-2.0.9.tar.gz &&
 mv installed/SDL/SDL_ttf-2.0.9.tar.gz .
test ! -f SDL_ttf-2.0.9.tar.gz &&
 wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.9.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_ttf-*" -exec rm -r {} \;
tar xzvf ~/SDL_ttf-2.0.9.tar.gz
cd SDL_ttf-2.0.9
test $UID = 0 && chown -R root:root .

# Apply this patch from the freetype folks to update SDL_ttf for freetype
# 2.2.x  If it can't figure out what file to patch, type in SDL_ttf.c
wget -nc http://freetype.sourceforge.net/freetype2/patches/\
SDL_ttf-2.0.7-noftinternals.patch &&
 patch -p1 < SDL_ttf-2.0.7-noftinternals.patch

./configure --prefix=/usr
make

# Become root to install it
su

rm -f /usr/lib/libSDL_ttf*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_ttf-*.tar.*
mv SDL_ttf-2.0.9.tar.gz installed/SDL/


# SDL_gfx 2.0.13
# ==============
# Apps/libs/games that I know of that use this one are:
# ClanLib

# Prerequisites (beyond those listed above):
# SDL >= 1.2.0

cd
test -f installed/SDL/SDL_gfx-2.0.13.tar.gz &&
 mv installed/SDL/SDL_gfx-2.0.13.tar.gz .
test ! -f SDL_gfx-2.0.13.tar.gz &&
 wget http://www.ferzkopp.net/Software/SDL_gfx-2.0/\
SDL_gfx-2.0.13.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_gfx-*" -exec rm -r {} \;
tar xzvf ~/SDL_gfx-2.0.13.tar.gz
cd SDL_gfx-2.0.13
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

rm -f /usr/lib/libSDL_gfx*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_gfx-*.tar.*
mv SDL_gfx-2.0.13.tar.gz installed/SDL/


# SDL_Pango 0.1.2
# ===============
# Apps/libs/games that I know of that use this one are:
# Frozen Bubble

# Prerequisites (beyond those listed above):
# SDL >= 1.2.4
# Pango >= 1.2.0

cd
test -f installed/SDL/SDL_Pango-0.1.2.tar.gz &&
 mv installed/SDL/SDL_Pango-0.1.2.tar.gz .
test ! -f SDL_Pango-0.1.2.tar.gz &&
 wget http://downloads.sf.net/sdlpango/SDL_Pango-0.1.2.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_Pango-*" -exec rm -r {} \;
tar xzvf ~/SDL_Pango-0.1.2.tar.gz
cd SDL_Pango-0.1.2
test $UID = 0 && chown -R root:root .

# Apply this patch if you'll be using SDL::Pango with Frozen Bubble 2.x:
wget -nc http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch &&
 patch -p0 < SDL_Pango-0.1.2-API-adds.patch

./configure --prefix=/usr
make

# Become root to install it
su

rm -f /usr/lib/libSDL_Pango.*
make install
ldconfig

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_Pango-*.tar.*
mv SDL_Pango-0.1.2.tar.gz installed/SDL/


# SDL_Perl 2.1.3
# ==============
# The latest version according to the SourceForge project is 2.1.2,
# but I found 2.1.3 here:
# http://search.cpan.org/CPAN/authors/id/D/DG/DGOEHRIG/
# http://search.cpan.org/dist/SDL_Perl/

# Apps/libs/games that I know of that use this one are:
# Frozen Bubble 2.x
#  (FB 1.x requires SDL_Perl 1.20.x)

# There are/were at least these web sites for SDL_Perl:
# http://sourceforge.net/projects/sdlpl/
# http://sdlperl.org/ (redirects elsewhere)
# http://sdl.perl.org/
# http://bloodgate.com/perl/sdl/sdl_perl.html

# Prerequisites (beyond those listed above):
# SDL >= 1.2.6
# SDL_image >= 1.2.2
# smpeg >= 0.4.4
# SDL_mixer >= 1.2.5
# SDL_net >= 1.2.4
# SDL_ttf >= 2.0.5
# SDL_gfx >= 2.0.3

# Install required perl modules:
su -c "perl -MCPAN -e shell"
o conf make_install_arg UNINST=1
o conf prerequisites_policy follow
install Module::Build
install Test::Simple
install YAML
exit

cd
test -f installed/SDL/SDL_Perl-2.1.3.tar.gz &&
 mv installed/SDL/SDL_Perl-2.1.3.tar.gz .
test ! -f SDL_Perl-2.1.3.tar.gz &&
 wget http://search.cpan.org/CPAN/authors/id/D/DG/DGOEHRIG/\
SDL_Perl-2.1.3.tar.gz
cd src/SDL
find -maxdepth 1 -type d -name "SDL_perl-*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "SDL_Perl-*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "SDL-Perl-*" -exec rm -r {} \;
tar xzvf ~/SDL_Perl-2.1.3.tar.gz
cd SDL_Perl-2.1.3
test $UID = 0 && chown -R root:root .
chmod -R u+w .
perl Build.PL
./Build

# Become root to install it
su

find /usr/lib/perl5 -type d -name SDL -exec rm -r {} \;
find /usr/lib/perl5 -type d -name SDL_perl -exec rm -r {} \;
find /usr/lib/perl5 -type f -name SDL.pm -exec rm {} \;
find /usr/lib/perl5 -type f -name "SDL_perl.*" -exec rm {} \;
( cd /usr/man/man3 ; rm -f SDL.3 SDL::*.3 SDLKey.3 SDL_*.3 )
./Build install
chown -R $USER .

# Fix a bug that is with Module::Build (according to what I've read)
# that causes the files to go into the wrong place.  Replace these
# example paths with your actual ones:
mv /usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi/auto/src/SDL* \
/usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi/auto/

# Become yourself again
exit

cd
rm -f installed/SDL/SDL_perl-*.tar.* installed/SDL/SDL_Perl-*.tar.* \
 installed/SDL/SDL-Perl-*.tar.*
mv SDL_Perl-2.1.3.tar.gz installed/SDL/


# After installing/upgrading SDL, you may need to reinstall apps that use it
# like these:
# avifile
# ffmpeg
# gnomemeeting
# gstreamer
# libstk
# lve
# mjpegtools
# mpeg2dec
# mpeg4ip
# mplayer
# Ogg Theora
# transcode
# wxpython
# xine
# zgv
# ...and lots of other applications, games, and libraries


# If you ever want to uninstall SDL, this should do it:
cd
su
test -d src/SDL-* && ( cd src/SDL-* ; make uninstall )
for pfx in /usr ${pfx}/local; do
  ( cd ${pfx}/bin ; rm -f playsound sdl-config )
  test -d ${pfx}/include/GUI && rm -r ${pfx}/include/GUI
  test -d ${pfx}/include/SDL && rm -r ${pfx}/include/SDL
  test -d ${pfx}/include/SDL_console && rm -r ${pfx}/include/SDL_console
  ( cd ${pfx}/lib ; rm -f libSDL.* libSDL-*.so.* libSDLmain.a libSDL_* \
   libGUI-*.so.* libGUI.* )
  ( cd ${pfx}/man/man3 ; rm -f SDLKey.3 SDL_*.3 )
  rm -f ${pfx}/share/aclocal/sdl.m4
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "SDL-*" -exec rm -r {} \;
rm -f ~/installed/SDL-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>