Skip to content

Commit a99d06e

Browse files
authored
Build clad (#99)
* Add clad
1 parent 8187303 commit a99d06e

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build
22
on:
33
push:
4+
branches: [main]
45
workflow_dispatch:
56
jobs:
67
build-x86_64:
@@ -9,6 +10,7 @@ jobs:
910
matrix:
1011
image:
1112
- compcert
13+
- clad
1214
- heaptrack
1315
- hylo
1416
- iwyu

Dockerfile.clad

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \
5+
apt install -y -q \
6+
build-essential \
7+
cmake \
8+
curl \
9+
git \
10+
gnupg \
11+
lsb-release \
12+
ninja-build \
13+
pip \
14+
python3 \
15+
software-properties-common \
16+
wget
17+
18+
RUN pip install lit
19+
20+
RUN mkdir -p /root
21+
COPY clad /root/
22+
COPY common.sh /root/
23+
24+
WORKDIR /root

clad/build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
source common.sh
5+
6+
VERSION=$1
7+
if [[ "${VERSION}" = "trunk" ]]; then
8+
VERSION=trunk-$(date +%Y%m%d)
9+
BRANCH=master
10+
REMOTE=heads/${BRANCH}
11+
else
12+
BRANCH=v${VERSION}
13+
REMOTE=tags/${BRANCH}
14+
fi
15+
16+
URL=https://github.com/vgvassilev/clad
17+
CLANG_VERSION=18.1.0
18+
19+
FULLNAME=clad-${VERSION}
20+
OUTPUT=$2/${FULLNAME}.tar.xz
21+
22+
REVISION="$(get_remote_revision "${URL}" "${REMOTE}")"
23+
24+
REVISION="clad-${REVISION}"
25+
LAST_REVISION="${3:-}"
26+
27+
initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
28+
29+
PREFIX=$(pwd)/prefix
30+
LLVM=$(pwd)/llvm
31+
BUILD=$(pwd)/build
32+
SOURCE=$(pwd)/clad
33+
34+
git clone --depth 1 -b llvmorg-${CLANG_VERSION} https://github.com/llvm/llvm-project.git "${LLVM}"
35+
git clone --depth 1 -b "${BRANCH}" "${URL}" "${SOURCE}"
36+
37+
mkdir "${BUILD}"
38+
cd "${BUILD}"
39+
cmake "${LLVM}/llvm" \
40+
-DLLVM_ENABLE_PROJECTS=clang \
41+
-DLLVM_EXTERNAL_PROJECTS=clad \
42+
-DLLVM_EXTERNAL_CLAD_SOURCE_DIR=${SOURCE} \
43+
-DCMAKE_BUILD_TYPE="Release" \
44+
-DLLVM_TARGETS_TO_BUILD=host \
45+
-DLLVM_INSTALL_UTILS=ON \
46+
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
47+
-GNinja
48+
49+
ninja clang-headers
50+
ninja clad
51+
ninja install-clad
52+
53+
complete "${PREFIX}" "${FULLNAME}" "${OUTPUT}"

0 commit comments

Comments
 (0)