mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
xbox backend x86 to arm cross compilation
This commit is contained in:
3 files changed
+50
-9
No files matched your search
@@ -1,14 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
cache=${DROIDDECK_XBOX_CACHE:-"${HOME}/.cache/droiddeck-xbox-build"}
|
||||
mkdir -p "$cache"
|
||||
docker run --rm --platform linux/arm64 -v "$repo:/src" -v "$cache:/work" -w /src \
|
||||
-e CARGO_HOME=/work/cargo -e RUSTUP_HOME=/work/rustup -e XBOX_BUILD_DIR=/work/build ubuntu:24.04 bash -lc '
|
||||
set -euo pipefail
|
||||
apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
||||
build-essential pkg-config libssl-dev protobuf-compiler cmake curl git ca-certificates xz-utils python3 >/dev/null
|
||||
build='
|
||||
export PATH=/work/cargo/bin:$PATH
|
||||
if ! command -v rustup >/dev/null; then
|
||||
version=$(python3 -c '\''import json;print(json.load(open("tools/xbox/backend.lock.json"))["rust"])'\'')
|
||||
@@ -16,3 +9,23 @@ docker run --rm --platform linux/arm64 -v "$repo:/src" -v "$cache:/work" -w /src
|
||||
fi
|
||||
bash tools/xbox/build.sh
|
||||
'
|
||||
if [[ $(uname -m) = x86_64 ]]; then
|
||||
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)
|
||||
docker image inspect "$image" >/dev/null 2>&1 \
|
||||
|| docker build --platform "$platform" -t "$image" -f "$repo/tools/xbox/cross.Dockerfile" "$repo/tools/xbox"
|
||||
else
|
||||
cache=${DROIDDECK_XBOX_CACHE:-"${HOME}/.cache/droiddeck-xbox-build"}
|
||||
platform=linux/arm64
|
||||
image=ubuntu:24.04
|
||||
build='
|
||||
apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
||||
build-essential pkg-config libssl-dev protobuf-compiler cmake curl git ca-certificates xz-utils python3 >/dev/null
|
||||
'"$build"
|
||||
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"
|
||||
+1
-1
@@ -13,7 +13,7 @@ export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${CARGO_TARGET_AARCH64_UNKN
|
||||
if [[ $(uname -m) = aarch64 ]]; then export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=cc; fi
|
||||
cd "$source_dir"
|
||||
cargo build --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus-cli -p xodus-service
|
||||
if [[ $(uname -m) = aarch64 ]]; then
|
||||
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_
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN dpkg --add-architecture arm64 \
|
||||
&& sed -i '/^Types:/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources \
|
||||
&& printf '%s\n' \
|
||||
'Types: deb' \
|
||||
'URIs: http://ports.ubuntu.com/ubuntu-ports/' \
|
||||
'Suites: noble noble-updates noble-security' \
|
||||
'Components: main universe restricted multiverse' \
|
||||
'Architectures: arm64' \
|
||||
'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' \
|
||||
> /etc/apt/sources.list.d/ubuntu-ports.sources \
|
||||
&& apt-get update -qq \
|
||||
&& apt-get install -y -qq --no-install-recommends \
|
||||
build-essential pkg-config protobuf-compiler cmake curl git ca-certificates xz-utils python3 \
|
||||
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user \
|
||||
libssl-dev:arm64 libstdc++6:arm64 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ \
|
||||
AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar \
|
||||
PKG_CONFIG_ALLOW_CROSS=1 \
|
||||
PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig \
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64
|
||||
Reference in new issue
Block a user