diff --git a/bin/build b/bin/build index e8013d1..f2b5455 100755 --- a/bin/build +++ b/bin/build @@ -68,6 +68,15 @@ print_info "Target architecture: $ARCH" print_info "Build workspace: $BUILD_OUTPUT_DIR" print_info "Final output: $REPO_DIR" +# Setup QEMU for aarch64 builds on x86_64 hosts +if [[ "$(uname -m)" == "x86_64" && "$ARCH" == "aarch64" ]]; then + # Check if QEMU is already working + if ! docker run --rm --platform linux/arm64 alpine:3.21 /bin/true >/dev/null 2>&1; then + print_info "Setting up QEMU for ARM64 emulation..." + setup_qemu + fi +fi + # Clean build-output directory to start fresh print_info "Cleaning build workspace..." rm -rf "$BUILD_OUTPUT_DIR"/* diff --git a/helpers/docker-helpers.sh b/helpers/docker-helpers.sh index 6c51501..e40c54d 100644 --- a/helpers/docker-helpers.sh +++ b/helpers/docker-helpers.sh @@ -13,6 +13,15 @@ check_docker() { fi } +setup_qemu() { + # Setup QEMU for building ARM64 packages on x86_64 hosts + if ! docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes >/dev/null 2>&1; then + print_error "Failed to setup QEMU for ARM64 emulation" + exit 1 + fi + print_success "QEMU ARM64 emulation enabled" +} + build_docker_image() { local build_dir="$1" local arch="${2:-x86_64}"