2018-11-18 16:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-17 00:53:00 +01:00
|
|
|
. scripts/lib.sh
|
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
# "booo, bash feature!"
|
|
|
|
declare -A ARCH_TRIPLET CROSS_COMPILE_CC CROSS_COMPILE_CXX
|
|
|
|
ARCH_TRIPLET[amd64]=x86_64-linux-gnu
|
|
|
|
ARCH_TRIPLET[i386]=i386-linux-gnu
|
|
|
|
ARCH_TRIPLET[arm64]=aarch64-linux-gnu
|
|
|
|
ARCH_TRIPLET[armhf]=arm-linux-gnueabihf
|
|
|
|
ARCH_TRIPLET[riscv64]=riscv64-linux-gnu
|
|
|
|
ARCH_TRIPLET[ppc64el]=powerpc64le-linux-gnu
|
|
|
|
CROSS_COMPILE_CC[amd64]=cc
|
|
|
|
CROSS_COMPILE_CC[i386]="cc -m32"
|
|
|
|
CROSS_COMPILE_CXX[amd64]=c++
|
|
|
|
CROSS_COMPILE_CXX[i386]="c++ -m32"
|
|
|
|
for i in arm64 armhf riscv64 ppc64el; do
|
|
|
|
CROSS_COMPILE_CC[$i]=${ARCH_TRIPLET[$i]}-gcc
|
|
|
|
CROSS_COMPILE_CXX[$i]=${ARCH_TRIPLET[$i]}-g++
|
|
|
|
done
|
|
|
|
export PKG_CONFIG_PATH=${ARCH_TRIPLET[$GH_CPU_ARCH]}
|
|
|
|
export CC=${CROSS_COMPILE_CC[$GH_CPU_ARCH]}
|
|
|
|
export CXX=${CROSS_COMPILE_CXX[$GH_CPU_ARCH]}
|
|
|
|
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
APP=xash3d-fwgs
|
|
|
|
APPDIR=$APP.AppDir
|
|
|
|
APPIMAGE=$APP-$ARCH.AppImage
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
APPDIR2=$APP-linux-$ARCH # FIXME: not conforms to libpublic's build arch strings but in parity with xashds directory name
|
|
|
|
APPTARGZ=$APP-linux-$ARCH.tar.gz
|
|
|
|
|
2022-08-25 18:34:18 +02:00
|
|
|
DS=xashds-linux
|
|
|
|
DSDIR=$DS-$ARCH
|
|
|
|
DSTARGZ=$DS-$ARCH.tar.gz
|
2024-11-18 14:53:47 +01:00
|
|
|
N=$(nproc)
|
2022-08-25 18:34:18 +02:00
|
|
|
|
2019-07-20 04:07:22 +02:00
|
|
|
build_sdl2()
|
|
|
|
{
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
cd "$BUILDDIR"/SDL2_src || die
|
2024-07-02 17:59:13 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
# a1ba: let's make something different. Rather than removing features
|
|
|
|
# let's enable everything we can
|
|
|
|
mkdir -p build || die
|
|
|
|
pushd build || die
|
|
|
|
cmake ../ -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$BUILDDIR"/SDL2_linux -DCMAKE_C_FLAGS=-O3 -DSDL_STATIC=OFF || die
|
|
|
|
ninja install -j$((N+1)) || die
|
|
|
|
popd || die
|
2019-07-20 04:07:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_engine()
|
|
|
|
{
|
|
|
|
# Build engine
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
cd "$BUILDDIR" || die
|
2019-07-20 04:07:22 +02:00
|
|
|
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
if [ "$ARCH" = "amd64" ]; 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
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
if [ "$GH_CROSSCOMPILING" != "true" ]; then
|
|
|
|
ENABLE_TESTS="--enable-tests"
|
|
|
|
fi
|
|
|
|
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
if [ "$1" = "dedicated" ]; then
|
2024-11-18 14:53:47 +01:00
|
|
|
./waf configure $AMD64 $ENABLE_TESTS --enable-lto --enable-bundled-deps -d || die_configure
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
elif [ "$1" = "full" ]; then
|
2024-11-18 14:53:47 +01:00
|
|
|
./waf configure $AMD64 $ENABLE_TESTS --enable-lto --enable-bundled-deps -s SDL2_linux --enable-stb --enable-utils || die_configure
|
2019-07-27 13:49:01 +02:00
|
|
|
else
|
|
|
|
die
|
|
|
|
fi
|
|
|
|
|
2024-05-03 14:57:26 +02:00
|
|
|
./waf build || die_configure
|
2019-07-20 04:07:22 +02:00
|
|
|
}
|
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
deploy_engine()
|
2019-07-20 04:07:22 +02:00
|
|
|
{
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
cd "$BUILDDIR" || die
|
2021-11-25 14:57:02 +01:00
|
|
|
./waf install --destdir="$APPDIR" || die
|
2019-07-27 13:49:01 +02:00
|
|
|
cp SDL2_linux/lib/libSDL2-2.0.so.0 "$APPDIR/"
|
2024-11-18 14:53:47 +01:00
|
|
|
if [ "$GH_CPU_ARCH" = "i386" ]; then
|
2022-09-17 13:10:36 +02:00
|
|
|
cp 3rdparty/vgui_support/vgui-dev/lib/vgui.so "$APPDIR/"
|
2019-07-20 04:07:22 +02:00
|
|
|
fi
|
2024-11-18 14:53:47 +01:00
|
|
|
}
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
build_appimage()
|
|
|
|
{
|
|
|
|
deploy_engine
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
cp scripts/gha/linux/AppRun "$APPDIR/AppRun"
|
|
|
|
cp scripts/gha/linux/xash3d-fwgs.desktop "$APPDIR/$APP.desktop"
|
|
|
|
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
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
chmod +x "$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"
|
2024-11-18 14:53:47 +01:00
|
|
|
./appimagetool.AppImage "$APPDIR" "artifacts/$APPIMAGE"
|
|
|
|
}
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
build_engine_tarball()
|
|
|
|
{
|
|
|
|
deploy_engine
|
2019-07-20 04:07:22 +02:00
|
|
|
|
2024-11-18 14:53:47 +01:00
|
|
|
mv "$APPDIR" "$APPDIR2"
|
|
|
|
tar -czvf "artifacts/$APPTARGZ" "$APPDIR2"
|
2019-07-20 04:07:22 +02:00
|
|
|
}
|
|
|
|
|
2022-08-25 18:34:18 +02:00
|
|
|
build_dedicated_tarball()
|
|
|
|
{
|
|
|
|
cd "$BUILDDIR" || die
|
2024-11-18 14:53:47 +01:00
|
|
|
./waf install --destdir="$DSDIR" || die
|
|
|
|
tar -czvf "artifacts/$DSTARGZ" "$DSDIR"
|
2022-08-25 18:34:18 +02:00
|
|
|
}
|
|
|
|
|
2021-12-17 02:09:54 +01:00
|
|
|
mkdir -p artifacts/
|
|
|
|
|
2019-07-27 13:49:01 +02:00
|
|
|
rm -rf build # clean-up build directory
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
build_engine dedicated
|
2022-08-25 18:34:18 +02:00
|
|
|
build_dedicated_tarball
|
2019-07-27 13:49:01 +02:00
|
|
|
|
ci: migrate to GitHub Actions
* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds
* scripts: cleanup of old CI scripts
* scripts: now port to GitHub Actions
* actions: fix extras checkout
* github: remove codeql action, turned out not to be very useful
* github: remove quiet flag on wget
* github: are we allowed to use envvars?
* github: add needed dependencies for linux
* github: install wget for windows
* scripts: convert our CPU architecture naming into what AppImage uses
* github: run scripts with bash explicitly
* github: first try to upload to GitHub Releases, enable amd64 win32 builds
* Use our uploadtool fork
* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts
* gha: try to fix build
* travis: try to fix build
* gha: try to fix upload, fix win32 build
* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build
* gha: add llvm repository, install clang-12 for android
* gha: motomagx: fail fast
* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip
* waifulib: xcompile: respect environment variables when using host compiler for Android
* waifulib: xcompile: use correct environ dict
* gha: try to fix -fuse-ld=lld with clang-12
* waifulib: xcompile: fix typo
* scripts: xcompile: fix motomagx build
* mainui: upgrade
* gha: fix android build, last time
* engine: wscript: disable crashhandler for magx
2021-07-03 19:21:09 +02:00
|
|
|
build_sdl2
|
2022-08-25 18:34:18 +02:00
|
|
|
build_engine full # don't rebuild some common parts twice
|
2024-11-18 14:53:47 +01:00
|
|
|
|
|
|
|
if [ -x appimagetool.AppImage ]; then
|
|
|
|
build_appimage
|
|
|
|
else
|
|
|
|
build_engine_tarball
|
|
|
|
fi
|