mirror of
https://github.com/isledecomp/isle.git
synced 2026-02-28 06:57:37 +00:00
build: fix MSVC OOM on docker
This commit is contained in:
parent
6a5231e962
commit
f225dd03bc
@ -7,21 +7,6 @@ set -euxo pipefail
|
|||||||
cd $(dirname "${BASH_SOURCE[0]}")
|
cd $(dirname "${BASH_SOURCE[0]}")
|
||||||
cd $(git rev-parse --show-toplevel)
|
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
|
declare OCI_CMD
|
||||||
|
|
||||||
if [ "x${OCI_CMD:-}" = "x" ]; then
|
if [ "x${OCI_CMD:-}" = "x" ]; then
|
||||||
@ -35,6 +20,29 @@ if [ "x${OCI_CMD:-}" = "x" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# on docker, --tmpfs doesn't work correctly with the old MSVC
|
||||||
|
if [ "$OCI_CMD" = "docker" ]; then
|
||||||
|
BUILDDIR="$(mktemp -d /tmp/isle-build.XXXXXX)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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 () {
|
||||||
|
if ! [ "x${BUILDDIR:-}" = "x" ]; then
|
||||||
|
rm -rf "$BUILDDIR" 2>/dev/null
|
||||||
|
fi
|
||||||
|
rm -rf "$SRCDIR" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
"$OCI_CMD" build -t isle "$SRCDIR/docker"
|
"$OCI_CMD" build -t isle "$SRCDIR/docker"
|
||||||
|
|
||||||
mkdir -p result
|
mkdir -p result
|
||||||
@ -44,11 +52,17 @@ if [[ "x${JOBS:-}" == "x" ]]; then
|
|||||||
JOBS=$(nproc)
|
JOBS=$(nproc)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! [ "x${BUILDDIR:-}" = "x" ]; then
|
||||||
|
MOUNT_BUILDDIR=(-v "$BUILDDIR":/build)
|
||||||
|
else
|
||||||
|
MOUNT_BUILDDIR=(--tmpfs /build)
|
||||||
|
fi
|
||||||
|
|
||||||
"$OCI_CMD" run -it \
|
"$OCI_CMD" run -it \
|
||||||
-e CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" \
|
-e CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" \
|
||||||
-v "$SRCDIR":/isle:rw \
|
${MOUNT_BUILDDIR[@]} \
|
||||||
-e JOBS="$JOBS" \
|
-v "$SRCDIR":/isle \
|
||||||
--tmpfs /build \
|
|
||||||
-v ./result:/install \
|
-v ./result:/install \
|
||||||
|
-e JOBS="$JOBS" \
|
||||||
isle
|
isle
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user