Skip to content

Commit a4324b0

Browse files
author
Jason Zheng
authored
Add support for clspv compiler (compiler-explorer#13)
1 parent 762c781 commit a4324b0

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \
1717
libc6-dev:i386 \
1818
linux-libc-dev \
1919
make \
20+
python3 \
2021
s3cmd \
2122
xz-utils \
2223
texinfo \

build/build-clspv.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
## $1 : version, clspv does not have any and only uses master branch.
4+
## $2 : destination: a directory or S3 path (eg. s3://...)
5+
## $3 : last revision successfully build
6+
7+
set -ex
8+
9+
ROOT=$PWD
10+
VERSION="${1}"
11+
LAST_REVISION="${3}"
12+
13+
if [[ "${VERSION}" != "master" ]]; then
14+
echo "Only support building master"
15+
exit 1
16+
fi
17+
18+
URL="https://github.com/google/clspv.git"
19+
BRANCH="master"
20+
21+
REVISION=$(git ls-remote --heads "${URL}" "refs/heads/${BRANCH}" | cut -f 1)
22+
echo "ce-build-revision:${REVISION}"
23+
24+
if [[ "${REVISION}" == "${LAST_REVISION}" ]]; then
25+
echo "ce-build-status:SKIPPED"
26+
exit
27+
fi
28+
29+
FULLNAME=clspv-${VERSION}-$(date +%Y%m%d)
30+
31+
OUTPUT=${ROOT}/${FULLNAME}.tar.xz
32+
S3OUTPUT=
33+
if [[ $2 =~ ^s3:// ]]; then
34+
S3OUTPUT=$2
35+
else
36+
if [[ -d "${2}" ]]; then
37+
OUTPUT=$2/${FULLNAME}.tar.xz
38+
else
39+
OUTPUT=${2-$OUTPUT}
40+
fi
41+
fi
42+
43+
## From now, no unset variable
44+
set -u
45+
46+
OUTPUT=$(realpath "${OUTPUT}")
47+
48+
git clone --depth 1 "${URL}" --branch "${BRANCH}"
49+
pushd clspv
50+
51+
python3 utils/fetch_sources.py
52+
53+
mkdir build
54+
cmake -S . -B build -G "Unix Makefiles"
55+
cmake --build build
56+
57+
export XZ_DEFAULTS="-T 0"
58+
tar Jcf "${OUTPUT}" --transform "s,^./,./${FULLNAME}/," ./
59+
60+
if [[ -n "${S3OUTPUT}" ]]; then
61+
s3cmd put --rr "${OUTPUT}" "${S3OUTPUT}"
62+
fi
63+
popd

0 commit comments

Comments
 (0)