diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index df5d6b6..0000000 --- a/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[target.armv7-unknown-linux-gnueabihf] -linker = "arm7-linux-gnueabihf-gcc-8" diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..b68bffc --- /dev/null +++ b/Cross.toml @@ -0,0 +1,8 @@ +[target.armv7-unknown-linux-gnueabihf] +dockerfile = "./Dockerfile" +context = "." + +[build.env] +passthrough = [ + "RUSTFLAGS", +] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..84e5966 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# Base image for rapsberrypi 3 target +FROM rustembedded/cross:armv7-unknown-linux-gnueabihf + +# Install libdbus libraries and pkg-config +RUN dpkg --add-architecture armhf && \ + apt-get update && \ + apt-get install --assume-yes libdbus-1-dev libdbus-1-dev:armhf pkg-config diff --git a/build b/build new file mode 100755 index 0000000..7777b68 --- /dev/null +++ b/build @@ -0,0 +1,10 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +readonly TARGET_ARCH=armv7-unknown-linux-gnueabihf +readonly LINK_FLAGS='-L /usr/arm-linux-gnueabihf/lib/ -L /usr/lib/arm-linux-gnueabihf/' + +RUSTFLAGS=${LINK_FLAGS} cross build --release --target=${TARGET_ARCH}