File tree 4 files changed +38
-1
lines changed
4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 25
25
set -e
26
26
set -x
27
27
28
- CONTAINER=shiftcrypto/firmware_v2:40
28
+ CONTAINER=shiftcrypto/firmware_v2:41
29
29
30
30
if [ " $1 " == " pull" ] ; then
31
31
docker pull " $CONTAINER "
Original file line number Diff line number Diff line change @@ -129,9 +129,18 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/opt/
129
129
RUN rustup target add thumbv7em-none-eabi
130
130
RUN rustup component add rustfmt
131
131
RUN rustup component add clippy
132
+ RUN rustup component add rust-src
132
133
RUN CARGO_HOME=/opt/cargo cargo install cbindgen --version 0.26.0 --locked
133
134
RUN CARGO_HOME=/opt/cargo cargo install bindgen-cli --version 0.69.4 --locked
134
135
136
+ # Until cargo vendor supports vendoring dependencies of the rust std libs we
137
+ # need a copy of this file next to the toml file. It also has to be world
138
+ # writable so that invocations of `cargo vendor` can update it. Below is the
139
+ # tracking issue for `cargo vendor` to support rust std libs.
140
+ # https://github.com/rust-lang/wg-cargo-std-aware/issues/23
141
+ RUN cp "$(rustc --print=sysroot)/lib/rustlib/src/rust/Cargo.lock" "$(rustc --print=sysroot)/lib/rustlib/src/rust/library/test/"
142
+ RUN chmod 777 $(rustc --print=sysroot)/lib/rustlib/src/rust/library/test/Cargo.lock
143
+
135
144
COPY tools/prost-build-proto prost-build-proto
136
145
RUN CARGO_HOME=/opt/cargo cargo install --path prost-build-proto --locked
137
146
Original file line number Diff line number Diff line change @@ -35,3 +35,8 @@ The bottom-most layer are bindings generated from C header files:
35
35
36
36
We generate one header file ` rust.h ` and ever product specific function is ` #ifdeffed ` with
37
37
` RUST_PRODUCT_* ` macro.
38
+
39
+ # Vendoring
40
+
41
+ Run the vendoring script ` vendor.sh ` to vendor dependencies from crates.io. The
42
+ script will ensure that also rust std libs dependencies are vendored.
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ #
3
+ # Script for vendoring our dependencies, including the deps of core/alloc.
4
+ #
5
+ # This script must be called from the <git-project-root>/src/rust directory. It will place the
6
+ # dependencies in a directory called "vendor" in the current working directory.
7
+ #
8
+ # For some reason Cargo needs to find the dependencies of all rust std libs. Since "test" depends
9
+ # on all the other ones, we take the toml-file from it. This means that we vendor libs that we
10
+ # don't use in the end (like hashbrown and getopts).
11
+ #
12
+ # The invocation below depends on the fact that rust std libs "Cargo.lock" has been manually copied
13
+ # to be next to the Cargo.toml file in the test directory.
14
+ #
15
+ # Copying the Cargo.lock file in the rust sysroot image requires root permissions. Therefore it is
16
+ # done in the Dockerfile in our setup.
17
+
18
+ RUST_SYSROOT=" $( rustc --print=sysroot) "
19
+
20
+ RUSTC_BOOTSTRAP=1 cargo vendor \
21
+ --manifest-path Cargo.toml \
22
+ --sync " $RUST_SYSROOT /lib/rustlib/src/rust/library/test/Cargo.toml" \
23
+ vendor
You can’t perform that action at this time.
0 commit comments