38 lines
3.6 KiB
TOML
38 lines
3.6 KiB
TOML
|
|
[target.arm-unknown-linux-gnueabihf]
|
||
|
|
# Raspberry Pi Zero / Zero W (ARM1176JZF-S, ARMv6 + hard-float).
|
||
|
|
#
|
||
|
|
# Several workspace crates use native libs via pkg-config (dbus, sqlite, libsecret).
|
||
|
|
# Install the ARMv6/armhf -dev packages inside the cross image so they are available
|
||
|
|
# to the target linker.
|
||
|
|
pre-build = [
|
||
|
|
"dpkg --add-architecture armhf",
|
||
|
|
"apt-get update",
|
||
|
|
"apt-get install -y --no-install-recommends bash pkg-config libc6-dev:armhf libdbus-1-dev:armhf libsystemd-dev:armhf libsqlite3-dev:armhf libsecret-1-dev:armhf",
|
||
|
|
# `cross` doesn't reliably forward PKG_CONFIG_* env vars into the container, so install a tiny
|
||
|
|
# wrapper that selects the correct multiarch pkgconfig dir based on `$TARGET`.
|
||
|
|
"bash -lc 'if [ -x /usr/bin/pkg-config ] && [ ! -x /usr/bin/pkg-config.real ]; then mv /usr/bin/pkg-config /usr/bin/pkg-config.real; fi'",
|
||
|
|
"bash -lc 'printf \"%b\" \"#!/usr/bin/env bash\\nset -euo pipefail\\nREAL=/usr/bin/pkg-config.real\\ncase \\\"\\${TARGET:-}\\\" in\\n arm-unknown-linux-gnueabihf)\\n export PKG_CONFIG_ALLOW_CROSS=1\\n export PKG_CONFIG_SYSROOT_DIR=/\\n export PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig\\n export PKG_CONFIG_PATH=\\\"\\$PKG_CONFIG_LIBDIR\\\"\\n ;;\\n aarch64-unknown-linux-gnu)\\n export PKG_CONFIG_ALLOW_CROSS=1\\n export PKG_CONFIG_SYSROOT_DIR=/\\n export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig\\n export PKG_CONFIG_PATH=\\\"\\$PKG_CONFIG_LIBDIR\\\"\\n ;;\\n *)\\n ;;\\nesac\\nexec \\\"\\$REAL\\\" \\\"\\$@\\\"\\n\" > /usr/bin/pkg-config && chmod +x /usr/bin/pkg-config'",
|
||
|
|
# Sanity checks (use wrapper + armhf search path).
|
||
|
|
"bash -lc 'TARGET=arm-unknown-linux-gnueabihf pkg-config --modversion dbus-1'",
|
||
|
|
"bash -lc 'TARGET=arm-unknown-linux-gnueabihf pkg-config --modversion sqlite3'",
|
||
|
|
"bash -lc 'TARGET=arm-unknown-linux-gnueabihf pkg-config --modversion libsecret-1'",
|
||
|
|
]
|
||
|
|
|
||
|
|
[target.aarch64-unknown-linux-gnu]
|
||
|
|
# Raspberry Pi OS (64-bit) / other aarch64 Linux.
|
||
|
|
#
|
||
|
|
# Use a Debian 11 (bullseye) base so the resulting binaries are compatible with
|
||
|
|
# bullseye's glibc, and to get a system `libsqlite3` new enough for Diesel.
|
||
|
|
image = "debian:bullseye-slim"
|
||
|
|
pre-build = [
|
||
|
|
"dpkg --add-architecture arm64",
|
||
|
|
"apt-get update",
|
||
|
|
"apt-get install -y --no-install-recommends ca-certificates bash pkg-config build-essential gcc-aarch64-linux-gnu libc6-dev:arm64 libdbus-1-dev:arm64 libsystemd-dev:arm64 libsqlite3-dev:arm64 libsecret-1-dev:arm64",
|
||
|
|
# Same wrapper as above (installed once, safe to re-run).
|
||
|
|
"bash -lc 'if [ -x /usr/bin/pkg-config ] && [ ! -x /usr/bin/pkg-config.real ]; then mv /usr/bin/pkg-config /usr/bin/pkg-config.real; fi'",
|
||
|
|
"bash -lc 'printf \"%b\" \"#!/usr/bin/env bash\\nset -euo pipefail\\nREAL=/usr/bin/pkg-config.real\\ncase \\\"\\${TARGET:-}\\\" in\\n arm-unknown-linux-gnueabihf)\\n export PKG_CONFIG_ALLOW_CROSS=1\\n export PKG_CONFIG_SYSROOT_DIR=/\\n export PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig\\n export PKG_CONFIG_PATH=\\\"\\$PKG_CONFIG_LIBDIR\\\"\\n ;;\\n aarch64-unknown-linux-gnu)\\n export PKG_CONFIG_ALLOW_CROSS=1\\n export PKG_CONFIG_SYSROOT_DIR=/\\n export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig\\n export PKG_CONFIG_PATH=\\\"\\$PKG_CONFIG_LIBDIR\\\"\\n ;;\\n *)\\n ;;\\nesac\\nexec \\\"\\$REAL\\\" \\\"\\$@\\\"\\n\" > /usr/bin/pkg-config && chmod +x /usr/bin/pkg-config'",
|
||
|
|
"bash -lc 'TARGET=aarch64-unknown-linux-gnu pkg-config --modversion dbus-1'",
|
||
|
|
"bash -lc 'TARGET=aarch64-unknown-linux-gnu pkg-config --modversion sqlite3'",
|
||
|
|
"bash -lc 'TARGET=aarch64-unknown-linux-gnu pkg-config --modversion libsecret-1'",
|
||
|
|
]
|