Skip to content

Commit 232285e

Browse files
Add CCC (Claude's C Compiler) builder (#122)
Add Dockerfile and build script for CCC, a C compiler written in Rust by Claude Opus 4.6 targeting x86-64, i686, AArch64, and RISC-V 64. - Dockerfile.ccc: minimal Ubuntu 22.04 + rustup stable - ccc/build.sh: clones and builds from main branch - Add ccc to CI matrix 🤖 Generated by LLM (Claude, via OpenClaw) Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
1 parent 91c9c0d commit 232285e

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
image:
12+
- ccc
1213
- compcert
1314
- clad
1415
- heaptrack

Dockerfile.ccc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu:22.04
2+
3+
RUN DEBIAN_FRONTEND=noninteractive apt-get --assume-yes update \
4+
&& DEBIAN_FRONTEND=noninteractive apt-get --assume-yes \
5+
--no-install-recommends install \
6+
build-essential \
7+
ca-certificates \
8+
curl \
9+
git \
10+
xz-utils
11+
12+
RUN curl --proto '=https' --tlsv1.2 --silent --show-error --fail https://sh.rustup.rs \
13+
| sh -s -- \
14+
-y \
15+
--no-modify-path \
16+
--default-toolchain stable \
17+
--profile minimal
18+
19+
RUN mkdir -p /root
20+
COPY ccc /root/
21+
COPY common.sh /root/
22+
23+
WORKDIR /root

ccc/build.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
## $1 : version (only "main" supported)
4+
## $2 : destination directory
5+
## $3 : last revision successfully built
6+
7+
set -ex
8+
source common.sh
9+
source "$HOME/.cargo/env"
10+
11+
VERSION="${1}"
12+
LAST_REVISION="${3:-}"
13+
14+
if [[ "${VERSION}" != "main" ]]; then
15+
echo "Only support building main"
16+
exit 1
17+
fi
18+
19+
URL="https://github.com/anthropics/claudes-c-compiler.git"
20+
BRANCH="main"
21+
REVISION=$(get_remote_revision "${URL}" "heads/${BRANCH}")
22+
23+
FULLNAME=ccc-${VERSION}-$(date +%Y%m%d)
24+
OUTPUT=$(realpath "$2/${FULLNAME}.tar.xz")
25+
26+
initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
27+
28+
git clone --depth 1 "${URL}" --branch "${BRANCH}"
29+
cd claudes-c-compiler
30+
31+
cargo build --release
32+
33+
# Install binaries into a clean directory
34+
mkdir -p /tmp/ccc-install
35+
cp target/release/ccc target/release/ccc-x86 target/release/ccc-arm \
36+
target/release/ccc-riscv target/release/ccc-i686 /tmp/ccc-install/
37+
# Include the standard headers shipped with ccc
38+
if [[ -d include ]]; then
39+
cp -r include /tmp/ccc-install/
40+
fi
41+
42+
complete /tmp/ccc-install "${FULLNAME}" "${OUTPUT}"

0 commit comments

Comments
 (0)