diff options
Diffstat (limited to 'utils/docker')
-rwxr-xr-x | utils/docker/build_docker_image.sh | 109 | ||||
-rw-r--r-- | utils/docker/debian9/Dockerfile | 193 | ||||
-rw-r--r-- | utils/docker/docker-compose.yml | 14 | ||||
-rwxr-xr-x | utils/docker/scripts/build_gcc.sh | 91 | ||||
-rwxr-xr-x | utils/docker/scripts/build_gcc_version.sh | 108 | ||||
-rwxr-xr-x | utils/docker/scripts/build_install_llvm.sh | 114 | ||||
-rwxr-xr-x | utils/docker/scripts/build_llvm_version.sh | 106 | ||||
-rwxr-xr-x | utils/docker/scripts/checkout_git.sh | 7 | ||||
-rwxr-xr-x | utils/docker/scripts/install_clang_packages.sh | 31 | ||||
-rwxr-xr-x | utils/docker/scripts/run_buildbot.sh | 15 |
10 files changed, 405 insertions, 383 deletions
diff --git a/utils/docker/build_docker_image.sh b/utils/docker/build_docker_image.sh deleted file mode 100755 index 0d2d6d313..000000000 --- a/utils/docker/build_docker_image.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -#===- libcxx/utils/docker/build_docker_image.sh ----------------------------===// -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===----------------------------------------------------------------------===// -set -e - -IMAGE_SOURCE="" -DOCKER_REPOSITORY="" -DOCKER_TAG="" - -function show_usage() { - cat << EOF -Usage: build_docker_image.sh [options] [-- [cmake_args]...] - -Available options: - General: - -h|--help show this help message - Docker-specific: - -s|--source image source dir (i.e. debian8, nvidia-cuda, etc) - -d|--docker-repository docker repository for the image - -t|--docker-tag docker tag for the image - -Required options: --source and --docker-repository. - -For example, running: -$ build_docker_image.sh -s debian9 -d mydocker/debian9-clang -t latest -will produce two docker images: - mydocker/debian9-clang-build:latest - an intermediate image used to compile - clang. - mydocker/clang-debian9:latest - a small image with preinstalled clang. -Please note that this example produces a not very useful installation, since it -doesn't override CMake defaults, which produces a Debug and non-boostrapped -version of clang. -EOF -} - -while [[ $# -gt 0 ]]; do - case "$1" in - -h|--help) - show_usage - exit 0 - ;; - -s|--source) - shift - IMAGE_SOURCE="$1" - shift - ;; - -d|--docker-repository) - shift - DOCKER_REPOSITORY="$1" - shift - ;; - -t|--docker-tag) - shift - DOCKER_TAG="$1" - shift - ;; - *) - echo "Unknown argument $1" - exit 1 - ;; - esac -done - - -command -v docker >/dev/null || - { - echo "Docker binary cannot be found. Please install Docker to use this script." - exit 1 - } - -if [ "$IMAGE_SOURCE" == "" ]; then - echo "Required argument missing: --source" - exit 1 -fi - -if [ "$DOCKER_REPOSITORY" == "" ]; then - echo "Required argument missing: --docker-repository" - exit 1 -fi - -SOURCE_DIR=$(dirname $0) -if [ ! -d "$SOURCE_DIR/$IMAGE_SOURCE" ]; then - echo "No sources for '$IMAGE_SOURCE' were found in $SOURCE_DIR" - exit 1 -fi - -BUILD_DIR=$(mktemp -d) -trap "rm -rf $BUILD_DIR" EXIT -echo "Using a temporary directory for the build: $BUILD_DIR" - -cp -r "$SOURCE_DIR/$IMAGE_SOURCE" "$BUILD_DIR/$IMAGE_SOURCE" -cp -r "$SOURCE_DIR/scripts" "$BUILD_DIR/scripts" - - -if [ "$DOCKER_TAG" != "" ]; then - DOCKER_TAG=":$DOCKER_TAG" -fi - -echo "Building ${DOCKER_REPOSITORY}${DOCKER_TAG} from $IMAGE_SOURCE" -docker build -t "${DOCKER_REPOSITORY}${DOCKER_TAG}" \ - -f "$BUILD_DIR/$IMAGE_SOURCE/Dockerfile" \ - "$BUILD_DIR" -echo "Done" diff --git a/utils/docker/debian9/Dockerfile b/utils/docker/debian9/Dockerfile index 8dc43f401..f93670b48 100644 --- a/utils/docker/debian9/Dockerfile +++ b/utils/docker/debian9/Dockerfile @@ -1,14 +1,13 @@ -#===- libcxx/utils/docker/debian9/Dockerfile -------------------------===// +#===- libcxx/utils/docker/debian9/Dockerfile --------------------------------------------------===// # -# The LLVM Compiler Infrastructure +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===----------------------------------------------------------------------===// +#===-------------------------------------------------------------------------------------------===// # Setup the base builder image with the packages we'll need to build GCC and Clang from source. -FROM launcher.gcr.io/google/debian9:latest as builder-base +FROM launcher.gcr.io/google/debian9:latest AS builder-base LABEL maintainer "libc++ Developers" RUN apt-get update && \ @@ -34,52 +33,127 @@ RUN apt-get update && \ autoconf \ binutils-dev \ binutils-gold \ - software-properties-common && \ + software-properties-common \ + gnupg \ + apt-transport-https \ + systemd \ + sysvinit-utils && \ update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \ - update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10 + update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10 && \ + rm -rf /var/lib/apt/lists/* + + +# Build GCC versions +FROM builder-base as gcc-48-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-4.8.5 --branch gcc-4_8_5-release \ + --cherry-pick ec1cc0263f156f70693a62cf17b254a0029f4852 -# Build GCC 4.9 for testing our C++11 against FROM builder-base as gcc-49-builder LABEL maintainer "libc++ Developers" -ADD scripts/build_gcc.sh /tmp/build_gcc.sh +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-4.9.4 --branch gcc-4_9_4-release + +FROM builder-base as gcc-5-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-5 --branch gcc-5_5_0-release + +FROM builder-base as gcc-6-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-6 --branch gcc-6_5_0-release + +FROM builder-base as gcc-7-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-7 --branch gcc-7_4_0-release + +FROM builder-base as gcc-8-builder +LABEL maintainer "libc++ Developers" -RUN git clone --depth=1 --branch gcc-4_9_4-release git://gcc.gnu.org/git/gcc.git /tmp/gcc-4.9.4 -RUN cd /tmp/gcc-4.9.4/ && ./contrib/download_prerequisites -RUN /tmp/build_gcc.sh --source /tmp/gcc-4.9.4 --to /opt/gcc-4.9.4 +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-8 --branch gcc-8_2_0-release -# Build GCC ToT for testing in all dialects. FROM builder-base as gcc-tot-builder LABEL maintainer "libc++ Developers" -ADD scripts/build_gcc.sh /tmp/build_gcc.sh +ADD scripts/build_gcc_version.sh /tmp/build_gcc_version.sh +RUN /tmp/build_gcc_version.sh --install /opt/gcc-tot --branch master + +# Build additional LLVM versions +FROM builder-base as llvm-36-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.6 --branch release/3.6.x + +FROM builder-base as llvm-37-builder +LABEL maintainer "libc++ Developers" -RUN git clone --depth=1 git://gcc.gnu.org/git/gcc.git /tmp/gcc-tot -RUN cd /tmp/gcc-tot && ./contrib/download_prerequisites -RUN /tmp/build_gcc.sh --source /tmp/gcc-tot --to /opt/gcc-tot +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.7 --branch release/3.7.x + +FROM builder-base as llvm-38-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.8 --branch release/3.8.x + +FROM builder-base as llvm-39-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-3.9 --branch release/3.9.x -# Build LLVM 4.0 which is used to test against a "legacy" compiler. FROM builder-base as llvm-4-builder LABEL maintainer "libc++ Developers" -ADD scripts/checkout_git.sh /tmp/checkout_git.sh -ADD scripts/build_install_llvm.sh /tmp/build_install_llvm.sh +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-4.0 --branch release/4.x -RUN /tmp/checkout_git.sh --to /tmp/llvm-4.0 -p clang -p compiler-rt --branch release_40 -RUN /tmp/build_install_llvm.sh \ - --install /opt/llvm-4.0 \ - --source /tmp/llvm-4.0 \ - --build /tmp/build-llvm-4.0 \ - -i install-clang -i install-clang-headers \ - -i install-compiler-rt \ - -- \ - -DCMAKE_BUILD_TYPE=RELEASE \ - -DLLVM_ENABLE_ASSERTIONS=ON +FROM builder-base as llvm-5-builder +LABEL maintainer "libc++ Developers" -# Stage 2. Produce a minimal release image with build results. -FROM launcher.gcr.io/google/debian9:latest +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-5.0 --branch release/5.x + +FROM builder-base as llvm-6-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-6.0 --branch release/6.x + +FROM builder-base as llvm-7-builder LABEL maintainer "libc++ Developers" +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-7.0 --branch release/7.x + +FROM builder-base as llvm-8-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-8.0 --branch release/8.x + +FROM builder-base as llvm-tot-builder +LABEL maintainer "libc++ Developers" + +ADD scripts/build_llvm_version.sh /tmp/build_llvm_version.sh +RUN /tmp/build_llvm_version.sh --install /opt/llvm-tot --branch master + + +#===-------------------------------------------------------------------------------------------===// +# buildslave +#===-------------------------------------------------------------------------------------------===// +FROM builder-base AS buildbot + # Copy over the GCC and Clang installations COPY --from=gcc-49-builder /opt/gcc-4.9.4 /opt/gcc-4.9.4 COPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot @@ -89,27 +163,40 @@ RUN ln -s /opt/gcc-4.9.4/bin/gcc /usr/local/bin/gcc-4.9 && \ ln -s /opt/gcc-4.9.4/bin/g++ /usr/local/bin/g++-4.9 RUN apt-get update && \ - apt-get install -y \ - ca-certificates \ - gnupg \ - build-essential \ - apt-transport-https \ - curl \ - software-properties-common - -RUN apt-get install -y --no-install-recommends \ - systemd \ - sysvinit-utils \ - cmake \ - subversion \ - git \ - ninja-build \ - gcc-multilib \ - g++-multilib \ - python \ - buildbot-slave + apt-get install -y --no-install-recommends \ + bash-completion \ + buildbot-slave \ + && rm -rf /var/lib/apt/lists/* ADD scripts/install_clang_packages.sh /tmp/install_clang_packages.sh RUN /tmp/install_clang_packages.sh && rm /tmp/install_clang_packages.sh RUN git clone https://git.llvm.org/git/libcxx.git /libcxx + +#===-------------------------------------------------------------------------------------------===// +# compiler-zoo +#===-------------------------------------------------------------------------------------------===// +FROM buildbot AS compiler-zoo +LABEL maintainer "libc++ Developers" + +# Copy over the GCC and Clang installations +COPY --from=gcc-48-builder /opt/gcc-4.8.5 /opt/gcc-4.8.5 +COPY --from=gcc-49-builder /opt/gcc-4.9.4 /opt/gcc-4.9.4 +COPY --from=gcc-5-builder /opt/gcc-5 /opt/gcc-5 +COPY --from=gcc-6-builder /opt/gcc-6 /opt/gcc-6 +COPY --from=gcc-7-builder /opt/gcc-7 /opt/gcc-7 +COPY --from=gcc-8-builder /opt/gcc-8 /opt/gcc-8 +COPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot + +COPY --from=llvm-36-builder /opt/llvm-3.6 /opt/llvm-3.6 +COPY --from=llvm-37-builder /opt/llvm-3.7 /opt/llvm-3.7 +COPY --from=llvm-38-builder /opt/llvm-3.8 /opt/llvm-3.8 +COPY --from=llvm-39-builder /opt/llvm-3.9 /opt/llvm-3.9 +COPY --from=llvm-4-builder /opt/llvm-4.0 /opt/llvm-4.0 +COPY --from=llvm-5-builder /opt/llvm-5.0 /opt/llvm-5.0 +COPY --from=llvm-6-builder /opt/llvm-6.0 /opt/llvm-6.0 +COPY --from=llvm-7-builder /opt/llvm-7.0 /opt/llvm-7.0 +COPY --from=llvm-8-builder /opt/llvm-8.0 /opt/llvm-8.0 +COPY --from=llvm-tot-builder /opt/llvm-tot /opt/llvm-tot + + diff --git a/utils/docker/docker-compose.yml b/utils/docker/docker-compose.yml new file mode 100644 index 000000000..5e8e5a4a7 --- /dev/null +++ b/utils/docker/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.4' +services: + buildbot: + build: + context: . + dockerfile: debian9/Dockerfile + target: buildbot + image: ericwf/libcxx-buildbot-base:latest + compiler-zoo: + build: + context: . + dockerfile: debian9/Dockerfile + target: compiler-zoo + image: ericwf/compiler-zoo:latest diff --git a/utils/docker/scripts/build_gcc.sh b/utils/docker/scripts/build_gcc.sh deleted file mode 100755 index 85feb16ac..000000000 --- a/utils/docker/scripts/build_gcc.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -#===- libcxx/utils/docker/scripts/build-gcc.sh ----------------------------===// -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===-----------------------------------------------------------------------===// - -set -e - - -function show_usage() { - cat << EOF -Usage: build-gcc.sh [options] - -Run autoconf with the specified arguments. Used inside docker container. - -Available options: - -h|--help show this help message - --source the source path from which to run the configuration. - --to destination directory where to install the targets. -Required options: --to, at least one --install-target. - -All options after '--' are passed to CMake invocation. -EOF -} - -GCC_INSTALL_DIR="" -GCC_SOURCE_DIR="" - -while [[ $# -gt 0 ]]; do - case "$1" in - --to) - shift - GCC_INSTALL_DIR="$1" - shift - ;; - --source) - shift - GCC_SOURCE_DIR="$1" - shift - ;; - -h|--help) - show_usage - exit 0 - ;; - *) - echo "Unknown option: $1" - exit 1 - esac -done - -if [ "$GCC_INSTALL_DIR" == "" ]; then - echo "No install directory. Please specify the --to argument." - exit 1 -fi - -if [ "$GCC_SOURCE_DIR" == "" ]; then - echo "No source directory. Please specify the --source argument." - exit 1 -fi - -GCC_NAME=`basename $GCC_SOURCE_DIR` -GCC_BUILD_DIR="/tmp/gcc-build-root/build-$GCC_NAME" - -mkdir -p "$GCC_INSTALL_DIR" -mkdir -p "$GCC_BUILD_DIR" -pushd "$GCC_BUILD_DIR" - -# Run the build as specified in the build arguments. -echo "Running configuration" -$GCC_SOURCE_DIR/configure --prefix=$GCC_INSTALL_DIR \ - --disable-bootstrap --disable-libgomp --disable-libitm \ - --disable-libvtv --disable-libcilkrts --disable-libmpx \ - --disable-liboffloadmic --disable-libcc1 --enable-languages=c,c++ - -NPROC=`nproc` -echo "Running build with $NPROC threads" -make -j$NPROC - -echo "Installing to $GCC_INSTALL_DIR" -make install -j$NPROC - -popd - -# Cleanup. -rm -rf "$GCC_BUILD_DIR" - -echo "Done"
\ No newline at end of file diff --git a/utils/docker/scripts/build_gcc_version.sh b/utils/docker/scripts/build_gcc_version.sh new file mode 100755 index 000000000..68aa4c67e --- /dev/null +++ b/utils/docker/scripts/build_gcc_version.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +#===- libcxx/utils/docker/scripts/build-gcc.sh ----------------------------===// +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===-----------------------------------------------------------------------===// + +set -e + +function show_usage() { + cat << EOF +Usage: build_gcc_version.sh [options] + +Run autoconf with the specified arguments. Used inside docker container. + +Available options: + -h|--help show this help message + --branch the branch of gcc you want to build. + --cherry-pick a commit hash to apply to the GCC sources. + --install destination directory where to install the targets. +Required options: --install and --branch + +All options after '--' are passed to CMake invocation. +EOF +} + +GCC_INSTALL_DIR="" +GCC_BRANCH="" +CHERRY_PICK="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --install) + shift + GCC_INSTALL_DIR="$1" + shift + ;; + --branch) + shift + GCC_BRANCH="$1" + shift + ;; + --cherry-pick) + shift + CHERRY_PICK="$1" + shift + ;; + -h|--help) + show_usage + exit 0 + ;; + *) + echo "Unknown option: $1" + exit 1 + esac +done + +if [ "$GCC_INSTALL_DIR" == "" ]; then + echo "No install directory. Please specify the --install argument." + exit 1 +fi + +if [ "$GCC_BRANCH" == "" ]; then + echo "No branch specified. Please specify the --branch argument." + exit 1 +fi + +set -x + +NPROC=`nproc` +TMP_ROOT="$(mktemp -d -p /tmp)" +GCC_SOURCE_DIR="$TMP_ROOT/gcc" +GCC_BUILD_DIR="$TMP_ROOT/build" + +echo "Cloning source directory for branch $GCC_BRANCH" +git clone --branch "$GCC_BRANCH" --single-branch --depth=1 git://gcc.gnu.org/git/gcc.git $GCC_SOURCE_DIR + +pushd "$GCC_SOURCE_DIR" +if [ "$CHERRY_PICK" != "" ]; then + git fetch origin trunk --unshallow # Urg, we have to get the entire history. This will take a while. + git cherry-pick --no-commit -X theirs "$CHERRY_PICK" +fi +./contrib/download_prerequisites +popd + + +mkdir "$GCC_BUILD_DIR" +pushd "$GCC_BUILD_DIR" + +# Run the build as specified in the build arguments. +echo "Running configuration" +$GCC_SOURCE_DIR/configure --prefix=$GCC_INSTALL_DIR \ + --disable-bootstrap --disable-libgomp --disable-libitm \ + --disable-libvtv --disable-libcilkrts --disable-libmpx \ + --disable-liboffloadmic --disable-libcc1 --enable-languages=c,c++ + +echo "Running build with $NPROC threads" +make -j$NPROC +echo "Installing to $GCC_INSTALL_DIR" +make install -j$NPROC +popd + +# Cleanup. +rm -rf "$TMP_ROOT" + +echo "Done"
\ No newline at end of file diff --git a/utils/docker/scripts/build_install_llvm.sh b/utils/docker/scripts/build_install_llvm.sh deleted file mode 100755 index 6f19a96a1..000000000 --- a/utils/docker/scripts/build_install_llvm.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash -#===- llvm/utils/docker/scripts/build_install_llvm.sh ---------------------===// -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===-----------------------------------------------------------------------===// - -set -e - -function show_usage() { - cat << EOF -Usage: build_install_llvm.sh [options] -- [cmake-args] - -Run cmake with the specified arguments. Used inside docker container. -Passes additional -DCMAKE_INSTALL_PREFIX and puts the build results into -the directory specified by --to option. - -Available options: - -h|--help show this help message - -i|--install-target name of a cmake install target to build and include in - the resulting archive. Can be specified multiple times. - --install destination directory where to install the targets. - --source location of the source tree. - --build location to use as the build directory. -Required options: --to, --source, --build, and at least one --install-target. - -All options after '--' are passed to CMake invocation. -EOF -} - -CMAKE_ARGS="" -CMAKE_INSTALL_TARGETS="" -CLANG_INSTALL_DIR="" -CLANG_SOURCE_DIR="" -CLANG_BUILD_DIR="" - -while [[ $# -gt 0 ]]; do - case "$1" in - -i|--install-target) - shift - CMAKE_INSTALL_TARGETS="$CMAKE_INSTALL_TARGETS $1" - shift - ;; - --source) - shift - CLANG_SOURCE_DIR="$1" - shift - ;; - --build) - shift - CLANG_BUILD_DIR="$1" - shift - ;; - --install) - shift - CLANG_INSTALL_DIR="$1" - shift - ;; - --) - shift - CMAKE_ARGS="$*" - shift $# - ;; - -h|--help) - show_usage - exit 0 - ;; - *) - echo "Unknown option: $1" - exit 1 - esac -done - -if [ "$CLANG_SOURCE_DIR" == "" ]; then - echo "No source directory. Please pass --source." - exit 1 -fi - -if [ "$CLANG_BUILD_DIR" == "" ]; then - echo "No build directory. Please pass --build" - exit 1 -fi - -if [ "$CMAKE_INSTALL_TARGETS" == "" ]; then - echo "No install targets. Please pass one or more --install-target." - exit 1 -fi - -if [ "$CLANG_INSTALL_DIR" == "" ]; then - echo "No install directory. Please specify the --to argument." - exit 1 -fi - -echo "Building in $CLANG_BUILD_DIR" -mkdir -p "$CLANG_BUILD_DIR" -pushd "$CLANG_BUILD_DIR" - -# Run the build as specified in the build arguments. -echo "Running build" -cmake -GNinja \ - -DCMAKE_INSTALL_PREFIX="$CLANG_INSTALL_DIR" \ - $CMAKE_ARGS \ - "$CLANG_SOURCE_DIR" -ninja $CMAKE_INSTALL_TARGETS - -popd - -# Cleanup. -rm -rf "$CLANG_BUILD_DIR" - -echo "Done" diff --git a/utils/docker/scripts/build_llvm_version.sh b/utils/docker/scripts/build_llvm_version.sh new file mode 100755 index 000000000..613a7babd --- /dev/null +++ b/utils/docker/scripts/build_llvm_version.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +#===- libcxx/utils/docker/scripts/build_install_llvm_version_default.sh -----------------------===// +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===-------------------------------------------------------------------------------------------===// + +set -e + +function show_usage() { + cat << EOF +Usage: build_install_llvm.sh [options] -- [cmake-args] + +Run cmake with the specified arguments. Used inside docker container. +Passes additional -DCMAKE_INSTALL_PREFIX and puts the build results into +the directory specified by --to option. + +Available options: + -h|--help show this help message + --install destination directory where to install the targets. + --branch the branch or tag of LLVM to build +Required options: --install, and --version. + +All options after '--' are passed to CMake invocation. +EOF +} + +LLVM_BRANCH="" +CMAKE_ARGS="" +LLVM_INSTALL_DIR="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --install) + shift + LLVM_INSTALL_DIR="$1" + shift + ;; + --branch) + shift + LLVM_BRANCH="$1" + shift + ;; + --) + shift + CMAKE_ARGS="$*" + shift $# + ;; + -h|--help) + show_usage + exit 0 + ;; + *) + echo "Unknown option: $1" + exit 1 + esac +done + + +if [ "$LLVM_INSTALL_DIR" == "" ]; then + echo "No install directory. Please specify the --install argument." + exit 1 +fi + +if [ "$LLVM_BRANCH" == "" ]; then + echo "No install directory. Please specify the --branch argument." + exit 1 +fi + +if [ "$CMAKE_ARGS" == "" ]; then + CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RELEASE '-DCMAKE_C_FLAGS=-gline-tables-only' '-DCMAKE_CXX_FLAGS=-gline-tables-only' -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" +fi + +set -x + +TMP_ROOT="$(mktemp -d -p /tmp)" +LLVM_SOURCE_DIR="$TMP_ROOT/llvm-project" +LLVM_BUILD_DIR="$TMP_ROOT/build" +LLVM="$LLVM_SOURCE_DIR/llvm" + +git clone --branch $LLVM_BRANCH --single-branch --depth=1 https://github.com/llvm/llvm-project.git $LLVM_SOURCE_DIR + +pushd "$LLVM_SOURCE_DIR" + +# Setup the source-tree using the old style layout +ln -s $LLVM_SOURCE_DIR/libcxx $LLVM/projects/libcxx +ln -s $LLVM_SOURCE_DIR/libcxxabi $LLVM/projects/libcxxabi +ln -s $LLVM_SOURCE_DIR/compiler-rt $LLVM/projects/compiler-rt +ln -s $LLVM_SOURCE_DIR/clang $LLVM/tools/clang +ln -s $LLVM_SOURCE_DIR/clang-tools-extra $LLVM/tools/clang/tools/extra + +popd + +# Configure and build +mkdir "$LLVM_BUILD_DIR" +pushd "$LLVM_BUILD_DIR" +cmake -GNinja "-DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_DIR" $CMAKE_ARGS $LLVM +ninja install +popd + +# Cleanup +rm -rf "$TMP_ROOT/" + +echo "Done" diff --git a/utils/docker/scripts/checkout_git.sh b/utils/docker/scripts/checkout_git.sh index 222700229..2c5563b43 100755 --- a/utils/docker/scripts/checkout_git.sh +++ b/utils/docker/scripts/checkout_git.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash #===- llvm/utils/docker/scripts/checkout.sh ---------------------===// # -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===-----------------------------------------------------------------------===// diff --git a/utils/docker/scripts/install_clang_packages.sh b/utils/docker/scripts/install_clang_packages.sh index fabee0e81..94c98d6ad 100755 --- a/utils/docker/scripts/install_clang_packages.sh +++ b/utils/docker/scripts/install_clang_packages.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash #===- libcxx/utils/docker/scripts/install_clang_package.sh -----------------===// # -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===-----------------------------------------------------------------------===// @@ -21,7 +20,7 @@ Available options: EOF } -VERSION="" +VERSION="9" while [[ $# -gt 0 ]]; do case "$1" in @@ -40,12 +39,29 @@ while [[ $# -gt 0 ]]; do esac done - +set -x curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - add-apt-repository -s "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs) main" apt-get update -apt-get install -y --no-install-recommends clang +apt-get upgrade -y +apt-get install -y --no-install-recommends "clang-$VERSION" + +# FIXME(EricWF): Remove this once the clang packages are no longer broken. +if [ -f "/usr/local/bin/clang" ]; then + echo "clang already exists" + exit 1 +else + CC_BINARY="$(which clang-$VERSION)" + ln -s "$CC_BINARY" "/usr/local/bin/clang" +fi +if [ -f "/usr/local/bin/clang++" ]; then + echo "clang++ already exists" + exit 1 +else + CXX_BINARY="$(which clang++-$VERSION)" + ln -s "$CXX_BINARY" "/usr/local/bin/clang++" +fi echo "Testing clang version..." clang --version @@ -59,6 +75,7 @@ if [ "$VERSION" == "" ]; then echo "Installing version '$VERSION'" fi +apt-get purge -y "libc++-$VERSION-dev" "libc++abi-$VERSION-dev" apt-get install -y --no-install-recommends "libc++-$VERSION-dev" "libc++abi-$VERSION-dev" echo "Done" diff --git a/utils/docker/scripts/run_buildbot.sh b/utils/docker/scripts/run_buildbot.sh index 45f5a1cf6..c135fc4af 100755 --- a/utils/docker/scripts/run_buildbot.sh +++ b/utils/docker/scripts/run_buildbot.sh @@ -5,9 +5,14 @@ BOT_DIR=/b BOT_NAME=$1 BOT_PASS=$2 -mkdir -p $BOT_DIR +pushd /tmp +curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh +bash install-monitoring-agent.sh +curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh +bash install-logging-agent.sh --structured +popd -#curl "https://repo.stackdriver.com/stack-install.sh" | bash -s -- --write-gcm +mkdir -p $BOT_DIR apt-get update -y apt-get upgrade -y @@ -15,9 +20,9 @@ apt-get upgrade -y # FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the # debian packages. # WARNING: If you're not a buildbot, DO NOT RUN! -apt-get install lld-8 +apt-get install lld-9 rm /usr/bin/ld -ln -s /usr/bin/lld-8 /usr/bin/ld +ln -s /usr/bin/lld-9 /usr/bin/ld systemctl set-property buildslave.service TasksMax=100000 @@ -59,4 +64,4 @@ grep "slave is ready" $BOT_DIR/twistd.log || shutdown now # Gracefully restart before that happen. sleep 72000 while pkill -SIGHUP buildslave; do sleep 5; done; -shutdown now
\ No newline at end of file +shutdown now |