| 1 | #!/bin/bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | export DBUILD_CLIENT="${DBUILD_CLIENT:-0}" |
| 6 | export DBUILD_SERVER="${DBUILD_SERVER:-1}" |
| 7 | export DUSE_HTTP="${DUSE_HTTP:-1}" |
| 8 | export DUSE_CODEC_OPUS="${DUSE_CODEC_OPUS:-1}" |
| 9 | export DUSE_VOIP="${DUSE_VOIP:-1}" |
| 10 | export DCMAKE_INSTALL_PREFIX="${DCMAKE_INSTALL_PREFIX:-~/ioquake3}" |
| 11 | IOQ3REMOTE="${IOQ3REMOTE:-https://github.com/ioquake/ioq3.git}" |
| 12 | CMAKE_OPTS="${CMAKE_OPTS:-}" |
| 13 | |
| 14 | if ! [ -x "$(command -v git)" ] || ! [ -x "$(command -v cmake)" ]; then |
| 15 | echo "This build script requires 'git' and 'cmake' to be installed." >&2 |
| 16 | echo "Please install them through your normal package installation system." >&2 |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | echo " This build process requires all of the ioquake3 dependencies necessary for an ioquake3 server. |
| 21 | If you do not have the necessary dependencies the build will fail. |
| 22 | |
| 23 | Please post a message to https://discourse.ioquake.org/ asking for help and include whatever error messages you received during the compile phase. |
| 24 | |
| 25 | We will be building from the git repo at ${IOQ3REMOTE} |
| 26 | The resulting binary will be installed to ${DCMAKE_INSTALL_PREFIX} |
| 27 | |
| 28 | If you need to change these, please set variables as follows: |
| 29 | |
| 30 | IOQ3REMOTE=https://github.com/something/something.git DCMAKE_INSTALL_PREFIX=~/somewhere $0" |
| 31 | |
| 32 | BUILD_DIR="$(mktemp -d)" |
| 33 | trap "rm -rf $BUILD_DIR" EXIT |
| 34 | |
| 35 | while true; do |
| 36 | read -p "Are you ready to compile ioquake3 from ${IOQ3REMOTE}, and have it installed into $DCMAKE_INSTALL_PREFIX? " yn |
| 37 | case $yn in |
| 38 | [Yy]*) |
| 39 | git clone $IOQ3REMOTE $BUILD_DIR/ioq3 |
| 40 | cd $BUILD_DIR/ioq3 |
| 41 | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ |
| 42 | -DBUILD_CLIENT="$DBUILD_CLIENT" \ |
| 43 | -DBUILD_SERVER="DBUILD_SERVER" \ |
| 44 | -DUSE_HTTP="$DUSE_HTTP" \ |
| 45 | -DUSE_CODEC_OPUS="$USE_CODEC_OPUS" \ |
| 46 | -DUSE_VOIP="$USE_VOIP" \ |
| 47 | -DCMAKE_INSTALL_PREFIX="$DCMAKE_INSTALL_PREFIX" \ |
| 48 | $CMAKE_OPTS |
| 49 | cmake --build build |
| 50 | cmake --install build |
| 51 | exit |
| 52 | ;; |
| 53 | [Nn]*) |
| 54 | echo "aborting installation." |
| 55 | exit |
| 56 | ;; |
| 57 | *) |
| 58 | echo "Please answer yes or no." |
| 59 | ;; |
| 60 | esac |
| 61 | done |