-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e37d15e
commit a552e1d
Showing
4 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |