diff --git a/README.md b/README.md index 444107fa32..7154309b06 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Help, Preview builds and device reports are on [Discord](https://discord.gg/JRGA ## Build -Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and `zstd`. +Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, Go, a host C compiler, the x86_64 and i686 MinGW-w64 compilers (i686 with DWARF-2 exceptions, as Debian and Ubuntu ship it; SJLJ builds such as Homebrew's cannot link Rust's `i686-pc-windows-gnu`), GitHub CLI, Python 3 and `zstd`. On x86_64 Linux, Docker also needs an arm64 binfmt handler (`docker run --privileged --rm tonistiigi/binfmt --install arm64`). ```bash tools/build_local.sh diff --git a/tools/xbox/build-local.sh b/tools/xbox/build-local.sh index 979c95b12b..c833a403d0 100755 --- a/tools/xbox/build-local.sh +++ b/tools/xbox/build-local.sh @@ -10,6 +10,12 @@ build=' bash tools/xbox/build.sh ' if [[ $(uname -m) = x86_64 ]]; then + binfmt_magics=$(cat /proc/sys/fs/binfmt_misc/* 2>/dev/null || true) + if [[ $(uname -s) = Linux && $binfmt_magics != *'magic 7f454c460201010000000000000000000200b700'* ]]; then + echo "The Xbox backend tests re-execute their arm64 binaries, which needs an aarch64 binfmt handler on the host." >&2 + echo "Register one with: docker run --privileged --rm tonistiigi/binfmt --install arm64" >&2 + exit 1 + fi cache=${DROIDDECK_XBOX_CACHE:-"${HOME}/.cache/droiddeck-xbox-cross"} platform=linux/amd64 image=droiddeck-xbox-cross:$(shasum -a 256 "$repo/tools/xbox/cross.Dockerfile" | cut -c1-12) @@ -28,4 +34,5 @@ fi mkdir -p "$cache" docker run --rm --platform "$platform" -v "$repo:/src" -v "$cache:/work" -w /src \ -e CARGO_HOME=/work/cargo -e RUSTUP_HOME=/work/rustup -e XBOX_BUILD_DIR=/work/build "$image" \ - bash -lc "set -euo pipefail$build" + bash -lc "set -euo pipefail + trap 'chown -R $(id -u):$(id -g) /work /src/app/src/main/assets/linuxfs 2>/dev/null || true' EXIT$build" diff --git a/tools/xbox/build.sh b/tools/xbox/build.sh index 99bee8c76b..85cdbd3c62 100755 --- a/tools/xbox/build.sh +++ b/tools/xbox/build.sh @@ -16,7 +16,9 @@ cargo build --locked --release --no-default-features --target aarch64-unknown-li if [[ $(uname -m) = aarch64 || -n ${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER:-} ]]; then cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus-cli cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus credential_ - cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ + msixvc_env=() + [[ $(uname -m) = aarch64 ]] || msixvc_env=(RUST_TEST_THREADS=1) + env "${msixvc_env[@]}" cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ fi for binary in xodus-cli xodus-service; do install -m755 "$CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/$binary" "$out/$binary"