Skip to content

Commit

Permalink
Add vast build. CC @xlauko
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Jan 15, 2024
1 parent e37d15e commit a552e1d
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
image: ['misc', 'rocm', 'compcert', 'rust-cg-gcc', 'rust-linux', 'iwyu', 'lc3', 'nasm', 'hylo', 'heaptrack']
image:
- compcert
- heaptrack
- hylo
- iwyu
- lc3
- misc
- nasm
- rocm
- rust-cg-gcc
- rust-linux
- vast
steps:
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2
Expand Down
36 changes: 36 additions & 0 deletions Dockerfile.vast
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y -q && apt upgrade -y -q
RUN apt-get install -y -q \
build-essential \
curl \
git \
patchelf \
lld \
ninja-build \
python3-pip \
ssh \
software-properties-common

RUN curl -sL https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3-linux-x86_64.tar.gz \
| tar zx -C /usr --strip-components=1

RUN bash -c "$(curl -s -o - https://apt.llvm.org/llvm.sh)" 17

RUN apt-get install -y -q \
libstdc++-12-dev \
llvm-17 \
libmlir-17 \
libmlir-17-dev \
mlir-17-tools \
libclang-17-dev

RUN pip3 install lit

RUN mkdir -p /root
COPY vast /root/
COPY common.sh /root/

WORKDIR /root
3 changes: 3 additions & 0 deletions vast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Builder for Vast

This is the build setup for [VAST](https://github.com/trailofbits/vast).
59 changes: 59 additions & 0 deletions vast/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

## $1 : version
## $2 : destination: a directory
## $3 : last revision: a revision descriptor which may be fetched from the cache.

set -exu
source common.sh

ROOT=$(pwd)
VERSION=$1
URL="https://github.com/trailofbits/vast"

if echo "${VERSION}" | grep 'trunk'; then
VERSION=trunk-$(date +%Y%m%d)
BRANCH=master
REVISION=$(get_remote_revision "${URL}" "heads/${BRANCH}")
else
BRANCH=${VERSION}
REVISION=$(get_remote_revision "${URL}" "tags/${BRANCH}")
fi

FULLNAME=vast-${VERSION}.tar.xz
OUTPUT=${ROOT}/${FULLNAME}
LAST_REVISION="${3:-}"

if [[ -d "${2}" ]]; then
OUTPUT=$2/${FULLNAME}
else
OUTPUT=${2-$OUTPUT}
fi

initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"

STAGING_DIR=/opt/compiler-explorer/vast-${VERSION}

rm -rf "vast-${VERSION}"
git clone -q --depth 1 --recursive --single-branch -b "${BRANCH}" "${URL}" "vast-${VERSION}"

cd "vast-${VERSION}"

cmake --preset ninja-multi-default \
--toolchain ./cmake/lld.toolchain.cmake \
--install-prefix "${STAGING_DIR}" \
-DLLVM_EXTERNAL_LIT=/usr/local/bin/lit \
-DCMAKE_INSTALL_RPATH:PATH="\$ORIGIN/../lib" \
-DCMAKE_PREFIX_PATH="/usr/lib/llvm-17;/usr/lib/llvm-17/lib/cmake/mlir;/usr/lib/llvm-17/lib/cmake/clang"

cmake --build --preset ninja-rel
cmake --install ./builds/ninja-multi-default

# Copy all shared object dependencies into the release directory to create a hermetic build, per
# Compiler Explorer requirements. Update rpath for these objects to $ORIGIN.
# To ensure we only muck with rpaths for these objects, do this work in a temporary directory.
# This code copied and modified from compiler-explorer/cobol-builder/build/build.sh
cp $(ldd "${STAGING_DIR}/bin/vast-front" | grep -E '=> /' | grep -Ev 'lib(pthread|c|dl|rt).so' | awk '{print $3}') "${STAGING_DIR}/lib"
patchelf --set-rpath '$ORIGIN/../lib' $(find ${STAGING_DIR}/lib/ -name \*.so\*)

complete "${STAGING_DIR}" "vast-${VERSION}" "${OUTPUT}"

0 comments on commit a552e1d

Please sign in to comment.