From 64b5c16dc3549d49050100697308cbc51616f0e3 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Sun, 16 Aug 2026 20:57:23 +0200 Subject: [PATCH] Add linux_arm64 builds for Ebitengine and Bevy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Batocera and the ES-family distributions run on ARM as much as on x86_64 — Raspberry Pi, Odroid, the retro handhelds — and a linux_x64 binary installs there but will not start. There was no Linux ARM asset kind at all: KINDS had linux_x86 and linux_x64 and mac_arm64, but nothing for 64-bit ARM Linux. Registering the kind is deliberately separate from producing it: a platform service only includes BuildLinuxArm64 once its pipeline builds the artifact, otherwise /api/builds would report it missing for every release. Hence Ebitengine and Bevy only. Godot needs a Linux arm64 export preset in each game repo first; LÖVE fuses an upstream AppImage that ships x86_64 only; TIC-80's export command has no ARM target. Ebitengine needs cgo on Linux, so binary_build gained a cross-compiler argument — and unsets CC for native targets, otherwise a build after the ARM one silently picks up the cross gcc. Verified by cross-compiling both demos in the rebuilt images: each produced a genuine AArch64 ELF (e_machine 183), not a silent fallback. Co-Authored-By: Claude Opus 5 (1M context) --- app/models/warp_engine/release_asset.rb | 2 +- .../platforms/builds/build_linux_arm64.rb | 28 +++++++++++++++++++ .../platforms/bevy/pipeline.yaml.erb | 11 +++++++- .../warp_engine/platforms/bevy/service.rb | 1 + .../platforms/ebitengine/pipeline.yaml.erb | 10 +++++-- .../platforms/ebitengine/service.rb | 1 + lib/warp_engine/version.rb | 2 +- 7 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 app/services/concerns/warp_engine/platforms/builds/build_linux_arm64.rb diff --git a/app/models/warp_engine/release_asset.rb b/app/models/warp_engine/release_asset.rb index 001d69e..c197510 100644 --- a/app/models/warp_engine/release_asset.rb +++ b/app/models/warp_engine/release_asset.rb @@ -1,7 +1,7 @@ module WarpEngine class ReleaseAsset < ApplicationRecord KINDS = %w[cartridge source html docs - win_x86 win_x64 linux_x86 linux_x64 + win_x86 win_x64 linux_x86 linux_x64 linux_arm64 mac_x64 mac_arm64 mac_universal].freeze belongs_to :release diff --git a/app/services/concerns/warp_engine/platforms/builds/build_linux_arm64.rb b/app/services/concerns/warp_engine/platforms/builds/build_linux_arm64.rb new file mode 100644 index 0000000..a150c8e --- /dev/null +++ b/app/services/concerns/warp_engine/platforms/builds/build_linux_arm64.rb @@ -0,0 +1,28 @@ +module WarpEngine + module Platforms + module Builds + # Linux on 64-bit ARM: Raspberry Pi 4/5, Odroid, and the retro handhelds. + # Batocera and the ES-family distributions run on these as much as on + # x86_64, and an x64 binary installs there but will not start — which is + # why this is a separate kind rather than something linux_x64 can cover. + # + # Include this in a platform service only once its pipeline actually + # produces the artifact: registering the kind makes /api/builds report it + # as missing for every release until then. + module BuildLinuxArm64 + extend ActiveSupport::Concern + + included do + register_expected_kind "linux_arm64" + end + + private + + def linux_arm64_asset_path(versioned) + path = full_path("#{versioned}-linux-arm64.zip") + { "linux_arm64" => path } if File.file?(path) + end + end + end + end +end diff --git a/app/services/warp_engine/platforms/bevy/pipeline.yaml.erb b/app/services/warp_engine/platforms/bevy/pipeline.yaml.erb index 272aca1..209431c 100644 --- a/app/services/warp_engine/platforms/bevy/pipeline.yaml.erb +++ b/app/services/warp_engine/platforms/bevy/pipeline.yaml.erb @@ -65,6 +65,15 @@ steps: CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \ cargo build --release --target x86_64-pc-windows-gnu pack_binary "win-x64" "target/x86_64-pc-windows-gnu/release/<%= name %>.exe" "<%= name %>.exe" + # linux-arm64: Raspberry Pi, Odroid, retro handhelds. pkg-config has to + # be told it may cross, and pointed at the arm64 .pc files, otherwise + # alsa-sys/libudev-sys pick up the host x86_64 libraries. + echo "==> Building linux-arm64 binary" + PKG_CONFIG_ALLOW_CROSS=1 \ + PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ + cargo build --release --target aarch64-unknown-linux-gnu + pack_binary "linux-arm64" "target/aarch64-unknown-linux-gnu/release/<%= name %>" "<%= name %>" - name: upload image: alpine @@ -81,7 +90,7 @@ steps: META_DST="<%= name %>-$VERSION.metadata.json" cp $META_SRC $META_DST BINS="" - for slug in win-x64 linux-x64; do + for slug in win-x64 linux-x64 linux-arm64; do [ -f "<%= name %>-$VERSION-$slug.zip" ] && BINS="$BINS <%= name %>-$VERSION-$slug.zip" done for f in $FILE $META_DST $BINS; do diff --git a/app/services/warp_engine/platforms/bevy/service.rb b/app/services/warp_engine/platforms/bevy/service.rb index 01cf885..4d82477 100644 --- a/app/services/warp_engine/platforms/bevy/service.rb +++ b/app/services/warp_engine/platforms/bevy/service.rb @@ -6,6 +6,7 @@ module WarpEngine include Builds::BuildWeb include Builds::BuildWinX64 include Builds::BuildLinuxX64 + include Builds::BuildLinuxArm64 label "Bevy" end diff --git a/app/services/warp_engine/platforms/ebitengine/pipeline.yaml.erb b/app/services/warp_engine/platforms/ebitengine/pipeline.yaml.erb index 1450b47..4aab67d 100644 --- a/app/services/warp_engine/platforms/ebitengine/pipeline.yaml.erb +++ b/app/services/warp_engine/platforms/ebitengine/pipeline.yaml.erb @@ -44,11 +44,14 @@ steps: # helper: builds one target + zips it with a single root folder # (unix zip keeps the executable bit) binary_build() { - B_GOOS="$1"; B_GOARCH="$2"; B_CGO="$3"; B_EXT="$4"; B_TARGET="$5" + B_GOOS="$1"; B_GOARCH="$2"; B_CGO="$3"; B_EXT="$4"; B_TARGET="$5"; B_CC="$6" PKG_DIR="<%= name %>-$VERSION-$B_TARGET" echo "==> Building $PKG_DIR" rm -rf "$PKG_DIR" "$PKG_DIR.zip" mkdir -p "$PKG_DIR" + # cgo cross-compile needs an explicit cross gcc; a native build must + # not see CC at all, otherwise go picks the wrong compiler + if [ -n "$B_CC" ]; then export CC="$B_CC"; else unset CC; fi CGO_ENABLED=$B_CGO GOOS=$B_GOOS GOARCH=$B_GOARCH go build -o "$PKG_DIR/<%= name %>$B_EXT" . if [ -f LICENSE ]; then cp LICENSE "$PKG_DIR/"; fi if [ -f README.md ]; then cp README.md "$PKG_DIR/"; fi @@ -56,10 +59,13 @@ steps: rm -rf "$PKG_DIR" echo "==> $PKG_DIR.zip kesz" } - # CI (linux builder) builds these three: + # CI (linux builder) builds these four: binary_build "windows" "386" "0" ".exe" "win-x86" binary_build "windows" "amd64" "0" ".exe" "win-x64" binary_build "linux" "amd64" "1" "" "linux-x64" + # linux-arm64: Raspberry Pi, Odroid, retro handhelds — cgo cross-build + # against the arm64 X11/GL/ALSA headers in the builder image + binary_build "linux" "arm64" "1" "" "linux-arm64" "aarch64-linux-gnu-gcc" - name: artifact image: alpine diff --git a/app/services/warp_engine/platforms/ebitengine/service.rb b/app/services/warp_engine/platforms/ebitengine/service.rb index e5cfa11..d053972 100644 --- a/app/services/warp_engine/platforms/ebitengine/service.rb +++ b/app/services/warp_engine/platforms/ebitengine/service.rb @@ -7,6 +7,7 @@ module WarpEngine include Builds::BuildWinX86 include Builds::BuildWinX64 include Builds::BuildLinuxX64 + include Builds::BuildLinuxArm64 include Builds::BuildMacX64 include Builds::BuildMacArm64 diff --git a/lib/warp_engine/version.rb b/lib/warp_engine/version.rb index 7349cc2..b66d2a7 100644 --- a/lib/warp_engine/version.rb +++ b/lib/warp_engine/version.rb @@ -1,3 +1,3 @@ module WarpEngine - VERSION = "0.2.0" + VERSION = "0.3.0" end