Created
August 19, 2020 11:50
-
-
Save kwk/f28163c0a562a31eddf685f5951ba5be to your computer and use it in GitHub Desktop.
Build LLVM in container
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
#!/bin/bash | |
set -x | |
set -e | |
python_version=3.7 | |
mkdir -p build | |
cd build | |
# TODO(kwk): What about CCache? | |
cmake \ | |
../llvm \ | |
-DCMAKE_INSTALL_PREFIX=myinstalldir \ | |
-G "Ninja" \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_C_COMPILER=gcc \ | |
-DCMAKE_CXX_COMPILER=g++ \ | |
-DLLVM_ENABLE_PROJECTS="lldb;clang;clang-tools-extra;lld;debuginfo-tests" \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ | |
-DLLDB_EXPORT_ALL_SYMBOLS=1 \ | |
-DBUILD_SHARED_LIBS=On \ | |
-DLLVM_BUILD_INSTRUMENTED_COVERAGE=Off \ | |
-DLLVM_CCACHE_BUILD=Off \ | |
-DLLVM_ENABLE_IDE=On \ | |
-DLLVM_ENABLE_ASSERTIONS=On \ | |
-DLLVM_USE_SPLIT_DWARF=On \ | |
-DLLVM_LIT_ARGS="-sv -j 1" | |
cmake --build . --config RelWithDebInfo --target all | |
cmake --build . --config RelWithDebInfo --target check-all |
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
FROM fedora:32 | |
LABEL maintainer="Konrad Kleine <kkleine@redhat.com>" | |
LABEL author="Konrad Kleine <kkleine@redhat.com>" | |
LABEL description="An image to build and test LLVM" | |
ENV LANG=en_US.utf8 | |
RUN echo -e "\ | |
[buildkite-agent] \n\ | |
name = Buildkite Pty Ltd \n\ | |
baseurl = https://yum.buildkite.com/buildkite-agent/stable/x86_64/ \n\ | |
enabled = 1 \n\ | |
priority = 1 \n\ | |
gpgcheck = 0\ | |
" > /etc/yum.repos.d/buildkite-agent.repo | |
RUN dnf install -y \ | |
buildkite-agent \ | |
clang \ | |
cmake \ | |
doxygen \ | |
doxygen \ | |
gcc \ | |
git \ | |
graphviz \ | |
htop \ | |
libedit-devel \ | |
libxml2-devel \ | |
ninja-build \ | |
python3-psutil \ | |
python3 \ | |
python3-devel \ | |
vim \ | |
wget \ | |
xz-devel \ | |
zip \ | |
&& yum clean all | |
COPY build.sh /build.sh | |
RUN chmod +x /build.sh | |
# This is the secret you should set from outside | |
ENV BUILDKITE_AGENT_TOKEN="<REPLACE_ME>" | |
# Adapt this to whatever docker base image this builds on and what settings you have configured LLVM with | |
ENV BUILDKITE_AGENT_TAGS="os=fedora,osversion=32,arch=x86_64,build_type=relwithdebinfo,cc=gcc,cxx=g++,parallel_lit_tests=no" | |
# Ensure we only download the latest version and not more | |
ENV BUILDKITE_GIT_CLONE_FLAGS="-v --depth=1" | |
# Prepend timestamps on each line of output. | |
ENV BUILDKITE_TIMESTAMP_LINES=1 | |
# Don't automatically run ssh-keyscan before checkout | |
ENV BUILDKITE_NO_SSH_KEYSCAN=1 | |
# Start an HTTP server on this addr:port that returns whether the agent is healthy, disabled by default | |
ENV BUILDKITE_AGENT_HEALTH_CHECK_ADDR="0.0.0.0:9090" | |
# 9090 health port (see BUILDKITE_AGENT_HEALTH_CHECK_ADDR) | |
EXPOSE \ | |
9090/tcp \ | |
# We check the health of the container by checking the BUILDKITE_AGENT_HEALTH_CHECK_ADDR | |
# https://docs.docker.com/engine/reference/builder/#healthcheck) | |
HEALTHCHECK --interval=5m --timeout=3s \ | |
CMD curl -f http://0.0.0.0:9090/ || exit 1 | |
ENTRYPOINT [\ | |
"/usr/bin/buildkite-agent", \ | |
"start" \ | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment