mirror of
https://github.com/isledecomp/isle.git
synced 2026-02-28 06:57:37 +00:00
build: add build.sh convenience script for linux
This makes it easier to do rebuilds using docker, because it doesn't actually modify the source tree (so that Git actually understands what you are doing with the chmodding), as all directories touched by docker are temporary, except for `result`, which is the "output". This just contains ISLE.EXE, LEGO1.DLL and LEGO1.lib. Optionally Nix can be used to speed up the "copy the source to somewhere temporary" step. Note that this doesn't work for MacOS, because this script uses `--tmpfs`, which is Linux-only.
This commit is contained in:
parent
68ed0b9353
commit
cf8e90a245
52
docker/build.sh
Executable file
52
docker/build.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
# two `cd`'s so Git can find the root dir even if this script is called from
|
||||||
|
# outside the repo
|
||||||
|
cd $(dirname "${BASH_SOURCE[0]}")
|
||||||
|
cd $(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
# nix-store is way quicker at copying these files and only needs to do it once
|
||||||
|
# if the source doesn't change
|
||||||
|
if whereis nix-store >/dev/null; then
|
||||||
|
SRCDIR="$(nix-store --add $PWD)"
|
||||||
|
else
|
||||||
|
SRCDIR="$(mktemp -d /tmp/isle-src.XXXXXX)"
|
||||||
|
git ls-files -z | xargs -0I{} install -D {} "$SRCDIR/{}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cleanup () {
|
||||||
|
rm -rf "$SRCDIR" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
declare oci_cmd
|
||||||
|
|
||||||
|
if whereis podman >/dev/null; then
|
||||||
|
oci_cmd=podman
|
||||||
|
elif whereis docker >/dev/null; then
|
||||||
|
oci_cmd=docker
|
||||||
|
else
|
||||||
|
echo "No container engine (docker/podman) found!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$oci_cmd" build -t isle "$SRCDIR/docker"
|
||||||
|
|
||||||
|
mkdir -p result
|
||||||
|
rm -rf result/*
|
||||||
|
|
||||||
|
if [[ "x${JOBS:-}" == "x" ]]; then
|
||||||
|
JOBS=$(nproc)
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$oci_cmd" run -it \
|
||||||
|
-e CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" \
|
||||||
|
-v "$SRCDIR":/isle:rw \
|
||||||
|
-e JOBS="$JOBS" \
|
||||||
|
--tmpfs /build \
|
||||||
|
-v ./result:/install \
|
||||||
|
isle
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user