Skip to content

Instantly share code, notes, and snippets.

@darealshinji
Last active August 29, 2015 14:02
Embed
What would you like to do?
Automates building GZDoom for GNU/Linux
#!/bin/sh
# Install dependencies:
# sudo apt-get install chrpath cmake git libfluidsynth-dev libglew-dev libgtk2.0-dev libsdl1.2-dev
if [ "$(uname)" != "Linux" ] ; then
echo "Not running GNU/Linux"
exit 1
fi
if [ "$(uname -m)" = "x86_64" ]; then
lib=libfmodex64
else
lib=libfmodex
fi
# get latest fmod ex version
changelog=revision_4.44.txt
wget http://www.fmod.org/files/$changelog
pointversion=$(grep -e "Stable branch update" $changelog | cut -d' ' -f2 | head -n1)
version=$(echo $pointversion | sed -e 's/\.//g')
rm -f $changelog
dirname=fmodapi${version}linux
fname=${dirname}.tar.gz
# download fmod ex
if [ ! -f $fname ] ; then
wget "http://www.fmod.org/download/fmodex/api/Linux/$fname"
fi
rm -rf "$dirname"
tar xvf "$fname"
# download GZDoom
rm -rf gzdoom gzdoom-release
git clone https://github.com/coelckers/gzdoom.git
cd gzdoom
mkdir build ../gzdoom-release
# FMOD ex doesn't have a soname entry. The linker will therefore use
# its filename to declare dependencies. Using a different filename allows
# manual library updates without re-linking the GZDoom binary.
cp ../$dirname/api/lib/$lib-$pointversion.so build/libfmodex-4.44.so
cd build
# build GZDoom
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DFORCE_INTERNAL_BZIP2=ON \
-DFORCE_INTERNAL_GME=ON \
-DFORCE_INTERNAL_JPEG=ON \
-DFORCE_INTERNAL_ZLIB=ON \
-DFMOD_LIBRARY=libfmodex-4.44.so \
-DFMOD_INCLUDE_DIR=../../$dirname/api/inc/ ..
make
chrpath -cr '$ORIGIN' gzdoom
chmod 0644 *.pk3 *.so
chmod 0755 gzdoom
cp *.pk3 *.so gzdoom ../../gzdoom-release
cd ../..
#tar cvf - gzdoom-release | xz > "gzdoom-linux-$(uname -m).tar.bz2"
tar cvf - gzdoom-release | bzip2 > "gzdoom-linux-$(uname -m).tar.bz2"
echo ""
echo "gzdoom-linux-$(uname -m).tar.bz2 created."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment