Skip to content

Commit

Permalink
Merge pull request #84 from LedgerHQ/xch/rust-needs
Browse files Browse the repository at this point in the history
Update for Rust needs
  • Loading branch information
xchapron-ledger authored Sep 15, 2023
2 parents 41c98c5 + dd70dc6 commit cef2cfd
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [3.4.0] - 2023-09-15

### Changed
- Bump Stax SDK versions
- Bump Rust stable version to 1.72.0

### Added
- cargo-ledger version 1.1.0
- llvm15 tools

## [3.3.0] - 2023-09-01

### Changed
Expand Down
22 changes: 15 additions & 7 deletions full/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

ARG RUST_STABLE_VERSION=1.72.0
ARG RUST_NIGHTLY_VERSION=nightly-2022-12-02

# Add curl for Rust buildchain
RUN apk add curl

# Define rustup/cargo home directories
ENV RUSTUP_HOME=/opt/rustup \
CARGO_HOME=/opt/.cargo
Expand All @@ -9,15 +15,17 @@ RUN apk add rustup
# Adding cargo binaries to PATH
ENV PATH=${CARGO_HOME}/bin:${PATH}

# Installing rustup and setting the default toolchain to the 1.67.0 stable channel.
RUN rustup-init --default-toolchain 1.67.0 -y
# Installing rustup and setting the default toolchain to the RUST_STABLE_VERSION stable channel.
RUN rustup-init --default-toolchain $RUST_STABLE_VERSION -y

# Installing nightly channel version 1.67.0 as well.
RUN rustup install nightly-2022-12-02
# Installing nightly channel version RUST_NIGHTLY_VERSION as well.
RUN rustup install $RUST_NIGHTLY_VERSION

# Adding ARMV6M target to the installed toolchains
RUN rustup target add thumbv6m-none-eabi --toolchain 1.67.0
RUN rustup target add thumbv6m-none-eabi --toolchain nightly-2022-12-02
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_NIGHTLY_VERSION

# Adding rust-src component to nightly channel
RUN rustup component add rust-src --toolchain nightly-2022-12-02
RUN rustup component add rust-src --toolchain $RUST_NIGHTLY_VERSION

# Add cargo ledger (needs a version of Rust >= 1.70)
RUN cargo install --locked --git=https://github.com/LedgerHQ/cargo-ledger.git --rev 1.1.0 cargo-ledger
28 changes: 21 additions & 7 deletions legacy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ ARG DEBIAN_FRONTEND=noninteractive

ARG LLVM_VERSION=12

ARG RUST_STABLE_VERSION=1.72.0
ARG RUST_NIGHTLY_VERSION=nightly-2022-12-02

RUN apt-get update && apt-get upgrade -qy
RUN apt-get install -qy \
clang-$LLVM_VERSION \
cmake \
curl \
wget \
gpg-agent \
software-properties-common \
git \
lld-$LLVM_VERSION \
make \
Expand Down Expand Up @@ -43,19 +49,27 @@ ENV PATH=/opt/gcc-arm-none-eabi-10.3-2021.10/bin:$PATH \
# Adding cargo binaries to PATH
ENV PATH=${CARGO_HOME}/bin:${PATH}

# Installing rustup to manage rust toolchains and setting the default toolchain to the 1.67.0 stable channel
# Installing rustup to manage rust toolchains and setting the default toolchain to the RUST_STABLE_VERSION stable channel
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain 1.67.0 -y
sh -s -- --default-toolchain $RUST_STABLE_VERSION -y

# Installing nightly channel version 1.67.0 as well.
RUN rustup install nightly-2022-12-02
# Installing nightly channel version RUST_NIGHTLY_VERSION as well.
RUN rustup install $RUST_NIGHTLY_VERSION

# Adding ARMV6M target to the installed toolchains
RUN rustup target add thumbv6m-none-eabi --toolchain 1.67.0
RUN rustup target add thumbv6m-none-eabi --toolchain nightly-2022-12-02
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_NIGHTLY_VERSION

# Adding rust-src component to nightly channel
RUN rustup component add rust-src --toolchain nightly-2022-12-02
RUN rustup component add rust-src --toolchain $RUST_NIGHTLY_VERSION

# Add cargo ledger (needs a version of Rust >= 1.70)
RUN cargo install --locked --git=https://github.com/LedgerHQ/cargo-ledger.git --rev 1.1.0 cargo-ledger

# Adding LLVM-15 APT repository and installing it
RUN wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main"
RUN apt-get update \
&& apt-get install -y --no-install-recommends llvm-15

# Python package to load app onto device
RUN pip3 install ledgerblue
Expand Down
11 changes: 9 additions & 2 deletions lite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ ENV LANG C.UTF-8

RUN apk update
RUN apk upgrade

# Adding LLVM-15 APT repository and installing it
# LLVM-15 is only present starting from the v3.17 Alpine version
RUN apk add --repository=http://dl-cdn.alpinelinux.org/alpine/v3.17/main llvm15
RUN ln -s /usr/lib/llvm15/bin/llvm-objcopy /usr/bin/llvm-objcopy-15
RUN ln -s /usr/lib/llvm15/bin/llvm-nm /usr/bin/llvm-nm-15

RUN apk add \
bash \
clang \
Expand Down Expand Up @@ -76,9 +83,9 @@ ENV NANOSP_SDK=/opt/nanosplus-secure-sdk
RUN git -C "$LEDGER_SECURE_SDK" worktree add "$NANOSP_SDK" v1.8.0
RUN echo nanos2 > $NANOSP_SDK/.target

# Latest Stax SDK (OS stax_1.3.0-rc3 => based on API_LEVEL 12)
# Latest Stax SDK (OS stax_1.3.0-rc4 => based on API_LEVEL 13)
ENV STAX_SDK=/opt/stax-secure-sdk
RUN git -C "$LEDGER_SECURE_SDK" worktree add "$STAX_SDK" v12.3.0
RUN git -C "$LEDGER_SECURE_SDK" worktree add "$STAX_SDK" v13.0.0
RUN echo stax > $STAX_SDK/.target

# Default SDK
Expand Down

0 comments on commit cef2cfd

Please sign in to comment.