From d97556dc55e160220c206d5d0fb0f88bf5b66cfc Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Mon, 10 Mar 2025 23:30:04 +0100 Subject: [PATCH] add script for cross-compilation of bffh --- cross-build.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 cross-build.sh diff --git a/cross-build.sh b/cross-build.sh new file mode 100755 index 0000000..9e26d40 --- /dev/null +++ b/cross-build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# this scripts compiles bffh for all target architectures which are defined in Cross.toml (using cross_rs). +# We use cross_rs because it supports easy and successful cross compilation for different architectures with less efforts +# For this we install podman by default + +# requirements +# - this script only runs on debianoid OS (Debian, Ubuntu, Kubuntu, ... having dpkg) + +echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" +echo -e "installing requirements ..." +echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" +sudo apt install podman +cargo install cross + +echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" +echo -e "gathering some general info ..." +echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" +dpkg-architecture | grep DEB_HOST_ARCH_CPU +dpkg-architecture | grep DEB_HOST_MULTIARCH + +# this generates bffhd and fabfire_provision binary files in target// dir +# we compile for amd64 (x86_64) using native "cargo build --release". Other architectures we use podman + cross_rs +echo -e "\n+++++++++++++++++++++++++++++++++++++++++++" +echo -e "cross-compiling ..." +echo -e "+++++++++++++++++++++++++++++++++++++++++++\n" +time cargo build --release +time cross build --target aarch64-unknown-linux-gnu --release +time cross build --target=armv7-unknown-linux-gnueabihf --release