Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM ubuntu:latest

RUN mkdir /opt/source
RUN mkdir /opt/workdir

RUN apt-get -y update
RUN apt-get -y install \
clang++-22 \
clang-22 \
cmake \
curl \
libclang-22-dev \
libcurl4-openssl-dev \
libedit-dev \
libzstd-dev \
ninja-build \
zlib1g-dev \
rustup

RUN rustup toolchain install "1.96.1-x86_64-unknown-linux-gnu"
RUN rustup toolchain install "nightly-2026-06-30-x86_64-unknown-linux-gnu"
RUN rustup component add --toolchain "nightly-2026-06-30-x86_64-unknown-linux-gnu" rust-src rustc-dev llvm-tools-preview
RUN rustup component add --toolchain "1.96.1-x86_64-unknown-linux-gnu" rust-src rustc-dev llvm-tools-preview

ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUST_BACKTRACE=full

COPY cpp2rust /opt/source/cpp2rust
COPY libc-dep /opt/source/libc-dep
COPY libcc2rs /opt/source/libcc2rs
COPY libcc2rs-macros /opt/source/libcc2rs-macros
COPY cmake /opt/source/cmake
COPY tests /opt/source/tests

COPY CMakeLists.txt /opt/source/CMakeLists.txt

WORKDIR /opt/source

RUN cmake \
-G Ninja \
-B build \
-D CMAKE_C_COMPILER="$(which clang-22)" \
-D CMAKE_CXX_COMPILER="$(which clang++-22)" \
.; \
cmake --build build -j$(nproc)

WORKDIR /opt/workdir
8 changes: 8 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
build:
image: cpp2rust/local-build:ubuntu
build:
context: .
volumes:
- "$PWD:/opt/workdir"
entrypoint: ./misc/containers/build.sh
25 changes: 25 additions & 0 deletions misc/containers/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env sh

# DO NOT RUN!
# This image is intended to be used from an OCI compose file.

set -eo pipefail

if [ -d "/opt/workdir/build" ]; then
echo "Build directory already exists, moving it."
if [ -d "/opt/workdir/build-backup" ]; then
echo "Build backup directory already exists, exiting as error."
exit 1
else
mv /opt/workdir/build /opt/workdir/build-backup
fi
fi

cmake \
-G Ninja \
-B build \
-D CMAKE_C_COMPILER="$(which clang-22)" \
-D CMAKE_CXX_COMPILER="$(which clang++-22)" \
.

cmake --build build "-j$(nproc)"
Loading