2018-11-18 16:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-17 00:53:00 +01:00
|
|
|
. scripts/lib.sh
|
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
if [ "$1" = "dedicated" ]; then
|
|
|
|
APP=xashds
|
|
|
|
APPNAME=$APP-linux-$ARCH # since we have no extension, mark executable name that it for linux
|
|
|
|
else # elif [ "$1" = "full" ]; then
|
|
|
|
APP=xash3d-fwgs
|
|
|
|
APPNAME=$APP-$ARCH
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! "$ARCH" ]; then
|
2019-07-25 03:50:57 +02:00
|
|
|
ARCH=i686
|
|
|
|
fi
|
2019-07-20 04:07:22 +02:00
|
|
|
|
|
|
|
# set up ccache
|
2018-11-18 16:33:32 +01:00
|
|
|
export CC="ccache gcc"
|
|
|
|
export CXX="ccache g++"
|
2018-12-12 02:19:17 +01:00
|
|
|
|
2019-07-20 04:07:22 +02:00
|
|
|
|
|
|
|
build_sdl2()
|
|
|
|
{
|
2019-07-27 13:49:01 +02:00
|
|
|
cd "$TRAVIS_BUILD_DIR"/SDL2_src || die
|
2019-07-25 03:50:57 +02:00
|
|
|
if [ "$ARCH" = "i686" ]; then
|
2019-07-20 04:07:22 +02:00
|
|
|
export CFLAGS="-msse2 -march=i686 -m32 -ggdb -O2"
|
2019-07-25 03:50:57 +02:00
|
|
|
export LDFLAGS="-m32"
|
2019-07-20 04:07:22 +02:00
|
|
|
fi
|
|
|
|
./configure --disable-render --disable-haptic --disable-power --disable-filesystem \
|
|
|
|
--disable-file --disable-libudev --disable-dbus --disable-ibus \
|
|
|
|
--disable-ime --disable-fcitx \
|
|
|
|
--enable-alsa-shared --enable-pulseaudio-shared \
|
|
|
|
--enable-wayland-shared --enable-x11-shared \
|
|
|
|
--prefix / || die # get rid of /usr/local stuff
|
|
|
|
make -j2 || die
|
2019-07-27 13:49:01 +02:00
|
|
|
mkdir -p "$TRAVIS_BUILD_DIR"/SDL2_linux
|
|
|
|
make install DESTDIR="$TRAVIS_BUILD_DIR"/SDL2_linux || die
|
2019-07-20 04:07:22 +02:00
|
|
|
export CFLAGS=""
|
2019-07-25 03:50:57 +02:00
|
|
|
export LDFLAGS=""
|
2019-07-20 04:07:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_engine()
|
|
|
|
{
|
|
|
|
# Build engine
|
2019-07-27 13:49:01 +02:00
|
|
|
cd "$TRAVIS_BUILD_DIR" || die
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2019-07-26 16:25:46 +02:00
|
|
|
if [ "$ARCH" = "x86_64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
|
2019-07-27 13:49:01 +02:00
|
|
|
AMD64="-8"
|
2019-07-20 04:07:22 +02:00
|
|
|
fi
|
2019-07-27 13:49:01 +02:00
|
|
|
|
|
|
|
if [ "$APP" = "xashds" ]; then
|
2019-10-18 06:45:05 +02:00
|
|
|
./waf configure -T release -d -W $AMD64 || die
|
2019-07-27 13:49:01 +02:00
|
|
|
elif [ "$APP" = "xash3d-fwgs" ]; then
|
|
|
|
APPDIR=$APPNAME.AppDir
|
2019-07-27 14:33:03 +02:00
|
|
|
./waf configure --sdl2=SDL2_linux -T release --enable-stb --prefix="$APPDIR" -W $AMD64 || die
|
2019-07-27 13:49:01 +02:00
|
|
|
else
|
|
|
|
die
|
|
|
|
fi
|
|
|
|
|
2019-07-20 04:07:22 +02:00
|
|
|
./waf build || die
|
|
|
|
}
|
|
|
|
|
|
|
|
build_appimage()
|
|
|
|
{
|
2019-07-27 13:49:01 +02:00
|
|
|
APPDIR=$APPNAME.AppDir
|
|
|
|
APPIMAGE=$APPNAME.AppImage
|
|
|
|
|
|
|
|
cd "$TRAVIS_BUILD_DIR" || die
|
2019-07-20 04:07:22 +02:00
|
|
|
|
|
|
|
./waf install || die
|
|
|
|
|
|
|
|
# Generate extras.pak
|
2019-07-27 13:49:01 +02:00
|
|
|
python3 scripts/makepak.py xash-extras/ "$APPDIR/extras.pak"
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
cp SDL2_linux/lib/libSDL2-2.0.so.0 "$APPDIR/"
|
2019-07-25 03:50:57 +02:00
|
|
|
if [ "$ARCH" = "i686" ]; then
|
2019-07-27 13:49:01 +02:00
|
|
|
cp vgui-dev/lib/vgui.so "$APPDIR/"
|
2019-07-20 04:07:22 +02:00
|
|
|
fi
|
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
cat > "$APPDIR"/AppRun << 'EOF'
|
2019-07-20 04:07:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ "$XASH3D_BASEDIR" = "" ]; then
|
|
|
|
export XASH3D_BASEDIR=$PWD
|
|
|
|
fi
|
|
|
|
echo "Xash3D FWGS installed as AppImage."
|
|
|
|
echo "Base directory is $XASH3D_BASEDIR. Set XASH3D_BASEDIR environment variable to override this"
|
|
|
|
|
|
|
|
export XASH3D_EXTRAS_PAK1="${APPDIR}"/extras.pak
|
|
|
|
export LD_LIBRARY_PATH="${APPDIR}":$LD_LIBRARY_PATH
|
|
|
|
${DEBUGGER} "${APPDIR}"/xash3d "$@"
|
|
|
|
exit $?
|
|
|
|
EOF
|
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
chmod +x "$APPDIR"/xash3d "$APPDIR"/AppRun # Engine launcher & engine launcher script
|
2019-07-20 04:07:22 +02:00
|
|
|
|
|
|
|
echo "Contents of AppImage: "
|
2019-07-27 13:49:01 +02:00
|
|
|
ls -R "$APPDIR"
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
wget "https://raw.githubusercontent.com/FWGS/fwgs-artwork/master/xash3d/icon_512.png" -O "$APPDIR/$APP.png"
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
cat > "$APPDIR/$APP.desktop" <<EOF
|
2019-07-20 04:07:22 +02:00
|
|
|
[Desktop Entry]
|
|
|
|
Name=$APP
|
|
|
|
Icon=$APP
|
|
|
|
Type=Application
|
|
|
|
Exec=AppRun
|
|
|
|
Categories=Game;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$ARCH.AppImage"
|
2019-07-27 13:49:01 +02:00
|
|
|
chmod +x "appimagetool-$ARCH.AppImage"
|
|
|
|
./appimagetool-$ARCH.AppImage "$APPDIR" "$APPIMAGE"
|
2019-07-20 04:07:22 +02:00
|
|
|
}
|
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
rm -rf build # clean-up build directory
|
|
|
|
|
|
|
|
if [ $APP != "xashds" ]; then
|
|
|
|
build_sdl2
|
|
|
|
fi
|
2019-07-20 04:07:22 +02:00
|
|
|
build_engine
|
2019-07-27 13:49:01 +02:00
|
|
|
if [ $APP != "xashds" ]; then
|
|
|
|
build_appimage
|
|
|
|
else
|
|
|
|
mv build/engine/xash $APPNAME
|
|
|
|
fi
|