diff options
author | 2021-01-02 20:29:13 +0000 | |
---|---|---|
committer | 2021-01-02 20:29:13 +0000 | |
commit | 46035553bfdd96e63c94e32da0210227ec2e3cf1 (patch) | |
tree | b191f708fb9a2995ba745b2f31cdeeaee4872b7f /gnu/llvm/libcxx/utils/docker/scripts | |
parent | Move Makefiles for libc++ and libc++abi to gnu/lib in preparation for an (diff) | |
download | wireguard-openbsd-46035553bfdd96e63c94e32da0210227ec2e3cf1.tar.xz wireguard-openbsd-46035553bfdd96e63c94e32da0210227ec2e3cf1.zip |
Import libc++ 10.0.1 release.
Diffstat (limited to 'gnu/llvm/libcxx/utils/docker/scripts')
6 files changed, 430 insertions, 0 deletions
diff --git a/gnu/llvm/libcxx/utils/docker/scripts/build_gcc_version.sh b/gnu/llvm/libcxx/utils/docker/scripts/build_gcc_version.sh new file mode 100755 index 00000000000..68aa4c67e3e --- /dev/null +++ b/gnu/llvm/libcxx/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/gnu/llvm/libcxx/utils/docker/scripts/build_llvm_version.sh b/gnu/llvm/libcxx/utils/docker/scripts/build_llvm_version.sh new file mode 100755 index 00000000000..613a7babd33 --- /dev/null +++ b/gnu/llvm/libcxx/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/gnu/llvm/libcxx/utils/docker/scripts/docker_start_buildbots.sh b/gnu/llvm/libcxx/utils/docker/scripts/docker_start_buildbots.sh new file mode 100755 index 00000000000..f47ddcd2481 --- /dev/null +++ b/gnu/llvm/libcxx/utils/docker/scripts/docker_start_buildbots.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -x + +# Update the libc++ sources in the image in order to use the most recent version of +# run_buildbots.sh +cd /libcxx +git pull +/libcxx/utils/docker/scripts/run_buildbot.sh "$@" diff --git a/gnu/llvm/libcxx/utils/docker/scripts/docker_update_bot.sh b/gnu/llvm/libcxx/utils/docker/scripts/docker_update_bot.sh new file mode 100755 index 00000000000..10ff483bb4e --- /dev/null +++ b/gnu/llvm/libcxx/utils/docker/scripts/docker_update_bot.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -x + +cd /libcxx +git pull + + +#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 + + +apt-get update -y +apt-get upgrade -y + +apt-get install sudo -y + +systemctl set-property buildslave.service TasksMax=100000 + +systemctl daemon-reload +service buildslave restart diff --git a/gnu/llvm/libcxx/utils/docker/scripts/install_clang_packages.sh b/gnu/llvm/libcxx/utils/docker/scripts/install_clang_packages.sh new file mode 100755 index 00000000000..94c98d6ad74 --- /dev/null +++ b/gnu/llvm/libcxx/utils/docker/scripts/install_clang_packages.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +#===- libcxx/utils/docker/scripts/install_clang_package.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: install_clang_package.sh [options] + +Install +Available options: + -h|--help show this help message + --version the numeric version of the package to use. +EOF +} + +VERSION="9" + +while [[ $# -gt 0 ]]; do + case "$1" in + --version) + shift + VERSION="$1" + shift + ;; + -h|--help) + show_usage + exit 0 + ;; + *) + echo "Unknown option: $1" + exit 1 + 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 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 + +echo "Testing clang++ version..." +clang++ --version + +# Figure out the libc++ and libc++abi package versions that we want. +if [ "$VERSION" == "" ]; then + VERSION="$(apt-cache search 'libc\+\+-[0-9]-dev' | awk '{print $1}' | awk -F- '{print $2}')" + 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/gnu/llvm/libcxx/utils/docker/scripts/run_buildbot.sh b/gnu/llvm/libcxx/utils/docker/scripts/run_buildbot.sh new file mode 100755 index 00000000000..ce86e10e5a7 --- /dev/null +++ b/gnu/llvm/libcxx/utils/docker/scripts/run_buildbot.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +set -x + +readonly BOT_ROOT=/b +readonly BOT_ROOT_NAME=$1 +readonly BOT_PASS=$2 + +#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 + +apt-get update -y +apt-get upgrade -y + +apt-get install sudo -y + +systemctl set-property buildslave.service TasksMax=100000 + +function setup_numbered_bot() { + local BOT_NAME=$1 + local BOT_DIR=$2 + mkdir -p $BOT_DIR + + buildslave stop $BOT_DIR + chown buildbot:buildbot $BOT_DIR + rm -rf $BOT_DIR/* + + buildslave create-slave --allow-shutdown=signal "$BOT_DIR" "lab.llvm.org:9990" "$BOT_NAME" "$BOT_PASS" + + echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin + + echo "Connecting as $1" + { + uname -a | head -n1 + cmake --version | head -n1 + g++ --version | head -n1 + ld --version | head -n1 + date + lscpu + } > $BOT_DIR/info/host + + +#echo "SLAVE_RUNNER=/usr/bin/buildslave +#SLAVE_ENABLED[1]=\"1\" +#SLAVE_NAME[1]=\"$BOT_NAME\" +#SLAVE_USER[1]=\"buildbot\" +#SLAVE_BASEDIR[1]=\"$BOT_DIR\" +#SLAVE_OPTIONS[1]=\"\" +#SLAVE_PREFIXCMD[1]=\"\"" > $BOT_DIR/buildslave.cfg + + ls $BOT_DIR/ + cat $BOT_DIR/buildbot.tac +} + +function try_start_builder { + local N=$1 + local BOT_DIR="$BOT_ROOT/b$N" + local BOT_NAME="$BOT_ROOT_NAME$N" + + systemctl daemon-reload + service buildslave restart + setup_numbered_bot "$BOT_NAME" "$BOT_DIR" + + systemctl daemon-reload + service buildslave restart + + chown -R buildbot:buildbot $BOT_DIR/ + sudo -u buildbot /usr/bin/buildslave start $BOT_DIR/ + + sleep 30 + cat $BOT_DIR/twistd.log + if grep --quiet "slave is ready" $BOT_DIR/twistd.log; then + return 0 + fi + if grep --quiet "configuration update complete" $BOT_DIR/twistd.log; then + return 0 + fi + if grep "rejecting duplicate slave" $BOT_DIR/twistd.log; then + return 1 + fi + echo "Unknown error" + cat $BOT_DIR/twistd.log + exit 1 +} + +for N in `shuf -i 1-5` +do + if try_start_builder $N; then + break + fi + echo "failed to start any buildbot" + shutdown now +done + +# GCE can restart instance after 24h in the middle of the build. +# Gracefully restart before that happen. +sleep 72000 +while pkill -SIGHUP buildslave; do sleep 5; done; +shutdown now |