diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile.amd64 similarity index 75% rename from .devcontainer/Dockerfile rename to .devcontainer/Dockerfile.amd64 index fe690e4cf1..9bf6977cf2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile.amd64 @@ -1,19 +1,20 @@ -FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm +FROM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm RUN dpkg --add-architecture arm64 \ && apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y --no-install-recommends \ libaom-dev libdav1d-dev libaom-dev:arm64 libdav1d-dev:arm64 \ libclang-dev libgit2-dev libcurl4-openssl-dev libfuzzer-14-dev \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross nasm dav1d qemu-user \ + meson ninja-build \ && rm -rf /var/lib/apt/lists/* RUN rustup target add aarch64-unknown-linux-gnu RUN export CARGO_PROFILE_RELEASE_STRIP=true \ - && cargo install -q cargo-c \ - && cargo install -q cargo-criterion \ - && cargo install -q cargo-fuzz \ + && cargo install -q cargo-c --version "0.9.27+cargo-0.74.0" \ + && cargo install -q cargo-criterion --version "1.1.0" \ + && cargo install -q cargo-fuzz --version "0.11.2" \ && rm -rf /usr/local/cargo/registry -RUN SDE=sde-external-9.14.0-2022-10-25-lin \ - && curl -sSf https://downloadmirror.intel.com/751535/$SDE.tar.xz | tar Jx -C /opt \ +RUN SDE=sde-external-9.27.0-2023-09-13-lin \ + && curl -sSf https://downloadmirror.intel.com/788820/$SDE.tar.xz | tar Jx -C /opt \ && ln -sv /opt/$SDE/sde64 /usr/local/bin/sde64 ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64 ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=aarch64-linux-gnu-gcc diff --git a/.devcontainer/Dockerfile.arm64 b/.devcontainer/Dockerfile.arm64 new file mode 100644 index 0000000000..ecfc0a4bcc --- /dev/null +++ b/.devcontainer/Dockerfile.arm64 @@ -0,0 +1,39 @@ +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm AS cargo-applets +ARG CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu +ARG CARGO_INSTALL_ROOT=/opt/cargo +ARG CARGO_PROFILE_RELEASE_STRIP=true +ARG CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=aarch64-linux-gnu-gcc +ARG PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu=1 +ARG PKG_CONFIG_PATH_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig +ARG PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu=/ +RUN rustup target add aarch64-unknown-linux-gnu +RUN dpkg --add-architecture arm64 \ + && apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu libc6-dev-arm64-cross \ + libcurl4-openssl-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64 \ + && rm -rf /var/lib/apt/lists/* +RUN cargo install cargo-c --version "0.9.27+cargo-0.74.0" \ + && cargo install cargo-criterion --version "1.1.0" \ + && cargo install cargo-fuzz --version "0.11.2" \ + && rm -rf /usr/local/cargo/registry + +FROM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm +RUN dpkg --add-architecture amd64 \ + && apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y --no-install-recommends \ + libaom-dev libdav1d-dev libaom-dev:amd64 libdav1d-dev:amd64 \ + libclang-dev libgit2-dev libcurl4-openssl-dev libfuzzer-14-dev \ + gcc-x86-64-linux-gnu libc6-dev-amd64-cross nasm dav1d qemu-user \ + meson ninja-build \ + && rm -rf /var/lib/apt/lists/* +RUN rustup target add x86_64-unknown-linux-gnu +COPY --from=cargo-applets /opt/cargo /usr/local/cargo +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER=qemu-x86_64 +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=x86_64-linux-gnu-gcc +ENV PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_gnu=1 +ENV PKG_CONFIG_PATH_x86_64_unknown_linux_gnu=/usr/lib/x64_64-linux-gnu/pkgconfig +ENV PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu=/ +ENV CUSTOM_LIBFUZZER_PATH=/usr/lib/llvm-14/lib/libFuzzer.a +LABEL dev.containers.source=https://github.com/xiph/rav1e +LABEL dev.containers.id=rav1e \ No newline at end of file diff --git a/.devcontainer/build.json b/.devcontainer/build-amd64.json similarity index 58% rename from .devcontainer/build.json rename to .devcontainer/build-amd64.json index 5875b1e3dc..28c69077f8 100644 --- a/.devcontainer/build.json +++ b/.devcontainer/build-amd64.json @@ -1,6 +1,6 @@ { "name": "rav1e-devcontainer", "build": { - "dockerfile": "Dockerfile" + "dockerfile": "Dockerfile.amd64" } } \ No newline at end of file diff --git a/.devcontainer/build-arm64.json b/.devcontainer/build-arm64.json new file mode 100644 index 0000000000..25f4517f15 --- /dev/null +++ b/.devcontainer/build-arm64.json @@ -0,0 +1,6 @@ +{ + "name": "rav1e-devcontainer", + "build": { + "dockerfile": "Dockerfile.arm64" + } +} \ No newline at end of file diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index f5f47b1e61..f4591611f3 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/checkout@v4 - name: Install devcontainer-cli run: npm install -g @devcontainers/cli + - name: Register qemu binfmt-misc entries for Docker + run: docker run --privileged --rm tonistiigi/binfmt --install aarch64 - name: Authenticate with ghcr.io run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - name: Build devcontainer image @@ -28,5 +30,11 @@ jobs: IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME VERSION=latest IMAGE_TAG=${IMAGE_ID,,}:$VERSION - devcontainer build --image-name $IMAGE_TAG --push \ - --workspace-folder $PWD --config .devcontainer/build.json \ No newline at end of file + devcontainer build --image-name $IMAGE_TAG-amd64 --platform linux/amd64 --push \ + --workspace-folder $PWD --config .devcontainer/build-amd64.json + devcontainer build --image-name $IMAGE_TAG-arm64 --platform linux/arm64 --push \ + --workspace-folder $PWD --config .devcontainer/build-arm64.json + docker manifest create $IMAGE_TAG \ + --amend $IMAGE_TAG-amd64 \ + --amend $IMAGE_TAG-arm64 + docker manifest push $IMAGE_TAG \ No newline at end of file