Skip to content

Commit

Permalink
s: mirror recent changes in acap-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
apljungquist committed Aug 14, 2024
1 parent e3fdfad commit 848eb1b
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 201 deletions.
74 changes: 48 additions & 26 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG REPO=axisecp
ARG SDK=acap-native-sdk
ARG UBUNTU_VERSION=22.04
ARG VERSION=1.14
ARG VERSION=1.15
ARG BASE_IMAGE=debian:bookworm-20240423

FROM ${REPO}/${SDK}:${VERSION}-aarch64-ubuntu${UBUNTU_VERSION} AS sdk-aarch64
FROM ${REPO}/${SDK}:${VERSION}-armv7hf-ubuntu${UBUNTU_VERSION} AS sdk-armv7hf
FROM ${BASE_IMAGE}
FROM --platform=linux/amd64 ${REPO}/${SDK}:${VERSION}-aarch64-ubuntu${UBUNTU_VERSION} AS sdk-aarch64
FROM --platform=linux/amd64 ${REPO}/${SDK}:${VERSION}-armv7hf-ubuntu${UBUNTU_VERSION} AS sdk-armv7hf
FROM --platform=linux/amd64 ${BASE_IMAGE}

COPY --from=sdk-aarch64 /opt/axis/acapsdk/axis-acap-manifest-tools /opt/axis/acapsdk/axis-acap-manifest-tools
COPY --from=sdk-aarch64 /opt/axis/acapsdk/environment-setup-cortexa53-crypto-poky-linux /opt/axis/acapsdk/environment-setup-cortexa53-crypto-poky-linux
Expand All @@ -16,37 +16,49 @@ COPY --from=sdk-armv7hf /opt/axis/acapsdk/sysroots/armv7hf /opt/axis/acapsdk/sys
COPY --from=sdk-aarch64 /opt/axis/acapsdk/sysroots/x86_64-pokysdk-linux /opt/axis/acapsdk/sysroots/x86_64-pokysdk-linux

RUN apt-get update \
&& apt-get install -y \
&& apt-get install \
--assume-yes \
--no-install-recommends \
build-essential \
ca-certificates \
clang \
curl \
g++-aarch64-linux-gnu \
g++-arm-linux-gnueabihf \
inetutils-ping \
git \
iputils-ping \
libglib2.0-dev \
libssl-dev \
pkg-config \
python3-jsonschema \
&& rm -rf /var/lib/apt/lists/*
sshpass

ENV RUSTUP_HOME=/usr/local/rustup \
ENV PATH=/usr/local/cargo/bin:$PATH \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUSTUP_HOME=/usr/local/rustup

COPY rust-toolchain.toml ./
RUN curl -O "https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init" \
&& echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db rustup-init" | sha256sum -c - \
&& chmod +x rustup-init \
&& ./rustup-init \
--default-host x86_64-unknown-linux-gnu \
--default-toolchain $(grep "channel" rust-toolchain.toml | cut -d '"' -f 2) \
--no-modify-path \
--profile minimal \
-y \
&& rm rustup-init \
&& rustup target add \
aarch64-unknown-linux-gnu \
thumbv7neon-unknown-linux-gnueabihf \
&& rm rust-toolchain.toml \
&& cargo install --git https://github.com/AxisCommunications/acap-rs.git --rev 452583a5898e233ec3e2a391923b8971fe7f342b cargo-acap-sdk
RUN curl \
--output /tmp/rustup-init \
"https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init" \
&& echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db /tmp/rustup-init" \
| sha256sum -c - \
&& chmod +x /tmp/rustup-init \
&& ./tmp/rustup-init \
--no-modify-path \
--no-update-default-toolchain \
-y \
&& rm /tmp/rustup-init \
&& rustup show \
&& cargo install \
--locked \
--git https://github.com/AxisCommunications/acap-rs.git \
--rev 5148b09e77e321a215a18f2f4ab75ec64839265c \
acap-ssh-utils \
cargo-acap-build \
cargo-acap-sdk \
device-manager \
&& rm rust-toolchain.toml

ENV \
SYSROOT_AARCH64=/opt/axis/acapsdk/sysroots/aarch64 \
Expand All @@ -55,8 +67,8 @@ ENV \
ENV \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=--sysroot=${SYSROOT_AARCH64}" \
CC_aarch64_axis_linux_gnu="aarch64-linux-gnu-gcc" \
CXX_aarch64_axis_linux_gnu="aarch64-linux-gnu-g++" \
CC_aarch64_unknown_linux_gnu="aarch64-linux-gnu-gcc" \
CXX_aarch64_unknown_linux_gnu="aarch64-linux-gnu-g++" \
PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu="${SYSROOT_AARCH64}/usr/lib/pkgconfig:${SYSROOT_AARCH64}/usr/share/pkgconfig" \
PKG_CONFIG_PATH_aarch64_unknown_linux_gnu="${SYSROOT_AARCH64}/usr/lib/pkgconfig:${SYSROOT_AARCH64}/usr/share/pkgconfig" \
PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu="${SYSROOT_AARCH64}" \
Expand All @@ -67,3 +79,13 @@ ENV \
PKG_CONFIG_LIBDIR_thumbv7neon_unknown_linux_gnueabihf="${SYSROOT_ARMV7HF}/usr/lib/pkgconfig:${SYSROOT_ARMV7HF}/usr/share/pkgconfig" \
PKG_CONFIG_PATH_thumbv7neon_unknown_linux_gnueabihf="${SYSROOT_ARMV7HF}/usr/lib/pkgconfig:${SYSROOT_ARMV7HF}/usr/share/pkgconfig" \
PKG_CONFIG_SYSROOT_DIR_thumbv7neon_unknown_linux_gnueabihf="${SYSROOT_ARMV7HF}"

# If neither `CARGO_HOME` nor `HOME` is set when launching a container, then cargo will try to
# download crates to this directory. If launched with the `--user` option then this will fail.
# TODO: Replace the example in the README with something that does not mount any volumes.
RUN mkdir /.cargo \
&& chmod a+w /.cargo/

# TODO: Consider removing the content of `CARGO_HOME` instead of `chmod`ing it;
RUN find $CARGO_HOME $RUSTUP_HOME -type d -exec chmod a+rwx {} +
RUN find $CARGO_HOME $RUSTUP_HOME -type f -exec chmod a+rw {} +
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"version": "2.4.4",
"resolved": "ghcr.io/devcontainers/features/common-utils@sha256:85c6505e809cc7c400b21997d7ae6f50811720d591813243f14d98cf2c577041",
"integrity": "sha256:85c6505e809cc7c400b21997d7ae6f50811720d591813243f14d98cf2c577041"
"version": "2.4.5",
"resolved": "ghcr.io/devcontainers/features/common-utils@sha256:e232c240319c4e019467c1099536c5eefebd762cf017d6d50353ed50fbf66ba3",
"integrity": "sha256:e232c240319c4e019467c1099536c5eefebd762cf017d6d50353ed50fbf66ba3"
}
}
}
9 changes: 3 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"name": "acap-rs-app-template",
"build": {
"dockerfile": "../Dockerfile",
"dockerfile": "Dockerfile",
"context": ".."
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/common-utils:2": {}
},
"remoteUser": "${localEnv:USER}",
"containerEnv": {
"CARGO_HOME": "/home/${localEnv:USER}/.cargo"
}
"remoteUser": "${localEnv:USER}"
}
2 changes: 0 additions & 2 deletions .devcontainer/gh/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ updates:
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "cargo"
directory: "/"
schedule:
Expand All @@ -19,8 +18,6 @@ updates:
- "minor"
- "patch"
versioning-strategy: lockfile-only

# Update dependencies under the "features" key in devcontainer.json.
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: cargo install --locked [email protected]
- name: Run checks
- name: Install dev container dependencies
run: npm install -g @devcontainers/[email protected]
- name: Run checks in dev container
run: |
make --always-make check_all
make build
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . make --always-make check_all
devcontainer exec --workspace-folder . make build
58 changes: 0 additions & 58 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 848eb1b

Please sign in to comment.