diff --git a/.cargo/config.toml b/.cargo/config.toml index 6df6788..10ee1c4 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,3 @@ [target.armv7-unknown-linux-musleabihf] -linker = "/usr/local/Cellar/arm-linux-gnueabihf-binutils/2.36.1/bin/arm-linux-gnueabihf-ld" +#linker = "/usr/local/Cellar/arm-linux-gnueabihf-binutils/2.36.1/bin/arm-linux-gnueabihf-ld" +linker = "/usr/bin/arm-linux-gnueabihf-ld" diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..ca181e2 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,19 @@ +kind: pipeline +type: exec +name: toolchain + +steps: +- name: build + commands: + - docker build -t drone_rust:1.50-musl . + +--- +kind: pipeline +type: docker +name: s0_meter + +steps: +- name: checkout + image: drone_rust:1.50-musl + commands: + - cargo build --release --target=armv7-unknown-linux-musleabihf --features="rppal" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf736e9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM rust:1.50-slim + +# RUN apk add --no-cache musl-dev binutils-arm-none-eabi +RUN apt-get update +RUN apt-get -y upgrade +RUN apt-get -y install binutils-arm-linux-gnueabihf musl-dev +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* +RUN rustup target add armv7-unknown-linux-musleabihf + +#WORKDIR /usr/src/s0_meter +#COPY . . + +#RUN cargo test diff --git a/build_with_docker.sh b/build_with_docker.sh new file mode 100755 index 0000000..5ef003f --- /dev/null +++ b/build_with_docker.sh @@ -0,0 +1,27 @@ +#/bin/bash + +WORK_DIR=/usr/src/s0_meter +RUST_VERSION=1.50 +RUST_IMG_FLAVOR=musl + +# docker run \ +# --rm \ +# --user "$(id -u):$(id -g)" \ +# -v "$PWD":"$WORK_DIR" \ +# -w "$WORK_DIR" \ +# drone_rust:$RUST_VERSION-$RUST_IMG_FLAVOR \ +# /bin/sh -c "echo Build: ; cargo build && echo Test: ; cargo test" + +docker run \ + --rm \ + --user "$(id -u):$(id -g)" \ + -v "$PWD":"$WORK_DIR" \ + -w "$WORK_DIR" \ + drone_rust:$RUST_VERSION-$RUST_IMG_FLAVOR \ + cargo build --release --target=armv7-unknown-linux-musleabihf --features="rppal" + + + +exit + +# rust:$RUST_VERSION-$RUST_IMG_FLAVOR \