scripts: enhance cross-compilation setup by adding apt-get update and removing redundant installations

This commit is contained in:
lovasoa
2025-10-05 10:45:31 +02:00
parent b278764b18
commit 0bd5a06a20
+3 -10
View File
@@ -1,9 +1,11 @@
#!/bin/bash
set -euo pipefail
set -euox pipefail
TARGETARCH="$1"
BUILDARCH="$2"
apt-get update
if [ "$TARGETARCH" = "$BUILDARCH" ]; then
# Native build
rustup target list --installed > /tmp/TARGET
@@ -16,24 +18,15 @@ elif [ "$TARGETARCH" = "arm64" ]; then
echo "aarch64-unknown-linux-gnu" > /tmp/TARGET
echo "aarch64-linux-gnu-gcc" > /tmp/LINKER
apt-get update
apt-get install -y gcc-aarch64-linux-gnu libgcc-s1-arm64-cross pkg-config
LIBDIR="/usr/aarch64-linux-gnu/lib"
# Also install gcc for aarch64 to get libgcc
apt-get install -y gcc-aarch64-linux-gnu
elif [ "$TARGETARCH" = "arm" ]; then
echo "armv7-unknown-linux-gnueabihf" > /tmp/TARGET
echo "arm-linux-gnueabihf-gcc" > /tmp/LINKER
apt-get update
apt-get install -y gcc-arm-linux-gnueabihf libgcc-s1-armhf-cross cmake libclang1 clang pkg-config
# Ensure gcc-arm-linux-gnueabihf is available
apt-get install -y gcc-arm-linux-gnueabihf
cargo install --force --locked bindgen-cli
SYSROOT=$(arm-linux-gnueabihf-gcc -print-sysroot)