Add build for extra library dependencies.

Replace the -libsamplerate parameter with -extra-libs, which builds
a number of extra libraries that Chocolate Doom can now make use of:

  libpng
      - so we can save PNG format screenshots
  libogg / libvorbis / libflac
      - for SDL_mixer, so we can play high quality substitute music
        recordings.

Download all these dependencies from chocolate-doom.org so that we
have a reliable central place that they can be obtained; fetching
them from individual websites is bound to just end in tears.
This commit is contained in:
Simon Howard 2014-04-07 02:41:02 -04:00
parent d2f7fe8dc4
commit a686d26171

View file

@ -277,6 +277,9 @@ fi
git_build=false git_build=false
force_build_sdl=false force_build_sdl=false
build_libsamplerate=false build_libsamplerate=false
build_libflac=false
build_libvorbis=false
build_libpng=false
INSTALL_DIR=$CHOCOLATE_DOOM_DIR/install INSTALL_DIR=$CHOCOLATE_DOOM_DIR/install
INSTALL_COMMAND= INSTALL_COMMAND=
@ -301,8 +304,11 @@ for arg in "$@"; do
# Build libraries from scratch when cross compiling: # Build libraries from scratch when cross compiling:
force_build_sdl=true force_build_sdl=true
;; ;;
"-libsamplerate") "-extra-libs")
build_libsamplerate=true build_libsamplerate=true
build_libpng=true
build_libflac=true
build_libvorbis=true
;; ;;
"-git") "-git")
git_build=true git_build=true
@ -334,6 +340,8 @@ if [ `uname` = "Darwin" ]; then
SDL_BUILD_OPTIONS="--disable-video-x11 $SDL_BUILD_OPTIONS" SDL_BUILD_OPTIONS="--disable-video-x11 $SDL_BUILD_OPTIONS"
CC="gcc -m32" CC="gcc -m32"
export CC export CC
CXX="g++ -m32"
export CXX
LDFLAGS="-lobjc $LDFLAGS" LDFLAGS="-lobjc $LDFLAGS"
else else
LDFLAGS="-Wl,-rpath -Wl,$INSTALL_DIR/lib $LDFLAGS" LDFLAGS="-Wl,-rpath -Wl,$INSTALL_DIR/lib $LDFLAGS"
@ -373,6 +381,40 @@ else
"$SDL_BUILD_OPTIONS $HOST_ARG" "$SDL_BUILD_OPTIONS $HOST_ARG"
fi fi
# Optional libraries first:
if $build_libsamplerate; then
if $force_build_sdl || ! have_header samplerate.h; then
fetch_and_build_module http://www.chocolate-doom.org/depends/ \
libsamplerate 0.1.8 "$HOST_ARG"
fi
fi
if $build_libpng; then
if $force_build_sdl || ! have_header png.h; then
fetch_and_build_module http://www.chocolate-doom.org/depends/ \
libpng 1.6.10 "$HOST_ARG"
fi
fi
if $build_libvorbis; then
if $force_build_sdl || ! have_header vorbis/vorbisfile.h; then
fetch_and_build_module http://www.chocolate-doom.org/depends/ \
libogg 1.3.1 "$HOST_ARG"
fetch_and_build_module http://www.chocolate-doom.org/depends/ \
libvorbis 1.3.4 "$HOST_ARG"
fi
fi
if $build_libflac; then
if $force_build_sdl || ! have_header FLAC/stream_decoder.h; then
flac_opts="--disable-asm-optimizations" # Causes problems
fetch_and_build_module http://www.chocolate-doom.org/depends/ \
flac 1.2.1 "$HOST_ARG $flac_opts"
fi
fi
if $force_build_sdl || ! have_header SDL_net.h; then if $force_build_sdl || ! have_header SDL_net.h; then
# SDL_net not installed; we must build it # SDL_net not installed; we must build it
@ -385,23 +427,21 @@ if $force_build_sdl || ! have_header SDL_mixer.h; then
# SDL_mixer not installed; we must build it # SDL_mixer not installed; we must build it
# Disable dependencies on external libraries for sound file formats: # Disable dependencies on external libraries for sound file formats:
mixer_opts="--disable-music-mod --disable-music-mp3 \
--disable-music-flac-shared --disable-music-ogg-shared"
mixer_opts="--disable-music-mod --disable-music-ogg \ # ...except ones we're building.
--disable-music-flac --disable-music-mp3" if ! $build_libflac; then
mixer_opts="$mixer_opts --disable-music-flac"
fi
if ! $build_libvorbis; then
mixer_opts="$mixer_opts --disable-music-ogg"
fi
fetch_and_build_module http://www.libsdl.org/projects/SDL_mixer/release/ \ fetch_and_build_module http://www.libsdl.org/projects/SDL_mixer/release/ \
SDL_mixer 1.2.12 "$HOST_ARG $mixer_opts" SDL_mixer 1.2.12 "$HOST_ARG $mixer_opts"
fi fi
# Optional libsamplerate support:
if $build_libsamplerate; then
if $force_build_sdl || ! have_header libsamplerate.h; then
fetch_and_build_module http://www.mega-nerd.com/SRC/ \
libsamplerate 0.1.8 "$HOST_ARG"
fi
fi
# Build Chocolate Doom. We can build the stable version or check out # Build Chocolate Doom. We can build the stable version or check out
# the latest code from Git. # the latest code from Git.