|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2020 Rene Rivera, Sam Darwin |
| 4 | +# Distributed under the Boost Software License, Version 1.0. |
| 5 | +# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) |
| 6 | + |
| 7 | +set -xe |
| 8 | + |
| 9 | +export DRONE_BUILD_DIR=$(pwd) |
| 10 | +export VCS_COMMIT_ID=$DRONE_COMMIT |
| 11 | +export GIT_COMMIT=$DRONE_COMMIT |
| 12 | +export REPO_NAME=$DRONE_REPO |
| 13 | +export USER=$(whoami) |
| 14 | +export CC=${CC:-gcc} |
| 15 | +export PATH=~/.local/bin:/usr/local/bin:$PATH |
| 16 | +export TRAVIS_BUILD_DIR=$(pwd) |
| 17 | +export TRAVIS_BRANCH=$DRONE_BRANCH |
| 18 | +export TRAVIS_EVENT_TYPE=$DRONE_BUILD_EVENT |
| 19 | + |
| 20 | +common_install () { |
| 21 | + if [ -z "$SELF" ]; then |
| 22 | + export SELF=`basename $REPO_NAME` |
| 23 | + fi |
| 24 | + |
| 25 | + git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 |
| 26 | + [ "$SELF" == "boost-ci" ] || cp -prf boost-ci-cloned/ci . |
| 27 | + rm -rf boost-ci-cloned |
| 28 | + |
| 29 | + if [ "$TRAVIS_OS_NAME" == "osx" ]; then |
| 30 | + unset -f cd |
| 31 | + fi |
| 32 | + |
| 33 | + export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" |
| 34 | + export BOOST_CI_SRC_FOLDER=$(pwd) |
| 35 | + |
| 36 | + . ./ci/common_install.sh |
| 37 | + |
| 38 | + if [ ! -d "$BOOST_ROOT/libs/buffers" ]; then |
| 39 | + pushd $BOOST_ROOT/libs |
| 40 | + git clone https://github.com/cppalliance/buffers -b $BOOST_BRANCH --depth 1 |
| 41 | + popd |
| 42 | + fi |
| 43 | + |
| 44 | + if [ ! -d "$BOOST_ROOT/libs/http_proto" ]; then |
| 45 | + pushd $BOOST_ROOT/libs |
| 46 | + git clone https://github.com/cppalliance/http_proto -b $BOOST_BRANCH --depth 1 |
| 47 | + popd |
| 48 | + fi |
| 49 | + |
| 50 | + if [ ! -d "$BOOST_ROOT/libs/ws_proto" ]; then |
| 51 | + pushd $BOOST_ROOT/libs |
| 52 | + git clone https://github.com/cppalliance/ws_proto -b $BOOST_BRANCH --depth 1 |
| 53 | + popd |
| 54 | + fi |
| 55 | + |
| 56 | + pushd $BOOST_ROOT |
| 57 | + $pythonexecutable tools/boostdep/depinst/depinst.py buffers |
| 58 | + $pythonexecutable tools/boostdep/depinst/depinst.py http_proto |
| 59 | + $pythonexecutable tools/boostdep/depinst/depinst.py ws_proto |
| 60 | + $pythonexecutable tools/boostdep/depinst/depinst.py ws_io |
| 61 | + popd |
| 62 | +} |
| 63 | + |
| 64 | +if [[ $(uname) == "Linux" && "$B2_ASAN" == "1" ]]; then |
| 65 | + echo 0 | sudo tee /proc/sys/kernel/randomize_va_space > /dev/null |
| 66 | +fi |
| 67 | + |
| 68 | +if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then |
| 69 | + |
| 70 | +echo '==================================> INSTALL' |
| 71 | + |
| 72 | +common_install |
| 73 | + |
| 74 | +echo '==================================> SCRIPT' |
| 75 | + |
| 76 | +. $BOOST_ROOT/libs/$SELF/ci/build.sh |
| 77 | + |
| 78 | +elif [ "$DRONE_JOB_BUILDTYPE" == "codecov" ]; then |
| 79 | + |
| 80 | +echo '==================================> INSTALL' |
| 81 | + |
| 82 | +common_install |
| 83 | + |
| 84 | +echo '==================================> SCRIPT' |
| 85 | + |
| 86 | +cd $BOOST_ROOT/libs/$SELF |
| 87 | +ci/travis/codecov.sh |
| 88 | + |
| 89 | +elif [ "$DRONE_JOB_BUILDTYPE" == "valgrind" ]; then |
| 90 | + |
| 91 | +echo '==================================> INSTALL' |
| 92 | + |
| 93 | +common_install |
| 94 | + |
| 95 | +echo '==================================> SCRIPT' |
| 96 | + |
| 97 | +cd $BOOST_ROOT/libs/$SELF |
| 98 | +ci/travis/valgrind.sh |
| 99 | + |
| 100 | +elif [ "$DRONE_JOB_BUILDTYPE" == "coverity" ]; then |
| 101 | + |
| 102 | +echo '==================================> INSTALL' |
| 103 | + |
| 104 | +common_install |
| 105 | + |
| 106 | +echo '==================================> SCRIPT' |
| 107 | + |
| 108 | +if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then |
| 109 | +cd $BOOST_ROOT/libs/$SELF |
| 110 | +ci/travis/coverity.sh |
| 111 | +fi |
| 112 | + |
| 113 | +elif [ "$DRONE_JOB_BUILDTYPE" == "cmake1" ]; then |
| 114 | + |
| 115 | +set -xe |
| 116 | + |
| 117 | +echo '==================================> INSTALL' |
| 118 | + |
| 119 | +# already in the image |
| 120 | +# pip install --user cmake |
| 121 | + |
| 122 | +echo '==================================> SCRIPT' |
| 123 | + |
| 124 | +export SELF=`basename $REPO_NAME` |
| 125 | +BOOST_BRANCH=develop && [ "$DRONE_BRANCH" == "master" ] && BOOST_BRANCH=master || true |
| 126 | +echo BOOST_BRANCH: $BOOST_BRANCH |
| 127 | +cd .. |
| 128 | +git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root |
| 129 | +cd boost-root |
| 130 | + |
| 131 | +mkdir -p libs/$SELF |
| 132 | +cp -r $DRONE_BUILD_DIR/* libs/$SELF |
| 133 | +# git submodule update --init tools/boostdep |
| 134 | +git submodule update --init --recursive |
| 135 | + |
| 136 | +# Customizations |
| 137 | +if [ ! -d "$BOOST_ROOT/libs/buffers" ]; then |
| 138 | + pushd $BOOST_ROOT/libs |
| 139 | + git clone https://github.com/cppalliance/buffers -b $BOOST_BRANCH --depth 1 |
| 140 | + popd |
| 141 | +fi |
| 142 | + |
| 143 | +if [ ! -d "$BOOST_ROOT/libs/http_proto" ]; then |
| 144 | + pushd $BOOST_ROOT/libs |
| 145 | + git clone https://github.com/cppalliance/http_proto -b $BOOST_BRANCH --depth 1 |
| 146 | + popd |
| 147 | +fi |
| 148 | + |
| 149 | +if [ ! -d "$BOOST_ROOT/libs/http_proto" ]; then |
| 150 | + pushd $BOOST_ROOT/libs |
| 151 | + git clone https://github.com/cppalliance/ws_proto -b $BOOST_BRANCH --depth 1 |
| 152 | + popd |
| 153 | +fi |
| 154 | + |
| 155 | +cd libs/$SELF |
| 156 | +mkdir __build__ && cd __build__ |
| 157 | +cmake -DCMAKE_INSTALL_PREFIX=~/.local .. |
| 158 | +cmake --build . --target install |
| 159 | + |
| 160 | +elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-superproject" ]; then |
| 161 | + |
| 162 | +echo '==================================> INSTALL' |
| 163 | + |
| 164 | +common_install |
| 165 | + |
| 166 | +echo '==================================> COMPILE' |
| 167 | + |
| 168 | +# Warnings as errors -Werror not building. Remove for now: |
| 169 | +# export CXXFLAGS="-Wall -Wextra -Werror" |
| 170 | +export CXXFLAGS="-Wall -Wextra" |
| 171 | +export CMAKE_OPTIONS=${CMAKE_OPTIONS:--DBUILD_TESTING=ON} |
| 172 | +export CMAKE_SHARED_LIBS=${CMAKE_SHARED_LIBS:-1} |
| 173 | + |
| 174 | +mkdir __build_static |
| 175 | +cd __build_static |
| 176 | +cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \ |
| 177 | + -DBOOST_INCLUDE_LIBRARIES=$SELF .. |
| 178 | +cmake --build . |
| 179 | +ctest --output-on-failure -R boost_$SELF |
| 180 | + |
| 181 | +cd .. |
| 182 | + |
| 183 | +if [ "$CMAKE_SHARED_LIBS" = 1 ]; then |
| 184 | + |
| 185 | +mkdir __build_shared |
| 186 | +cd __build_shared |
| 187 | +cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \ |
| 188 | + -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON .. |
| 189 | +cmake --build . |
| 190 | +ctest --output-on-failure -R boost_$SELF |
| 191 | + |
| 192 | +fi |
| 193 | + |
| 194 | +fi |
0 commit comments