1*9356374aSAndroid Build Coastguard Worker#!/bin/bash 2*9356374aSAndroid Build Coastguard Worker# 3*9356374aSAndroid Build Coastguard Worker# Copyright 2019 The Abseil Authors. 4*9356374aSAndroid Build Coastguard Worker# 5*9356374aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 6*9356374aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 7*9356374aSAndroid Build Coastguard Worker# You may obtain a copy of the License at 8*9356374aSAndroid Build Coastguard Worker# 9*9356374aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 10*9356374aSAndroid Build Coastguard Worker# 11*9356374aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 12*9356374aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 13*9356374aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*9356374aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 15*9356374aSAndroid Build Coastguard Worker# limitations under the License. 16*9356374aSAndroid Build Coastguard Worker 17*9356374aSAndroid Build Coastguard Workerset -euox pipefail 18*9356374aSAndroid Build Coastguard Worker 19*9356374aSAndroid Build Coastguard Workerif [[ -z ${ABSEIL_ROOT:-} ]]; then 20*9356374aSAndroid Build Coastguard Worker ABSEIL_ROOT="$(realpath $(dirname ${0})/..)" 21*9356374aSAndroid Build Coastguard Workerfi 22*9356374aSAndroid Build Coastguard Worker 23*9356374aSAndroid Build Coastguard Workerif [[ -z ${LINK_TYPE:-} ]]; then 24*9356374aSAndroid Build Coastguard Worker LINK_TYPE="STATIC DYNAMIC" 25*9356374aSAndroid Build Coastguard Workerfi 26*9356374aSAndroid Build Coastguard Worker 27*9356374aSAndroid Build Coastguard Workersource "${ABSEIL_ROOT}/ci/cmake_common.sh" 28*9356374aSAndroid Build Coastguard Worker 29*9356374aSAndroid Build Coastguard Workersource "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" 30*9356374aSAndroid Build Coastguard Workerreadonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER} 31*9356374aSAndroid Build Coastguard Worker 32*9356374aSAndroid Build Coastguard Worker# Verify that everything works with the standard "cmake && make && make install" 33*9356374aSAndroid Build Coastguard Worker# without building tests or requiring GoogleTest. 34*9356374aSAndroid Build Coastguard Workertime docker run \ 35*9356374aSAndroid Build Coastguard Worker --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp-ro,readonly \ 36*9356374aSAndroid Build Coastguard Worker --tmpfs=/buildfs:exec \ 37*9356374aSAndroid Build Coastguard Worker --workdir=/buildfs \ 38*9356374aSAndroid Build Coastguard Worker --rm \ 39*9356374aSAndroid Build Coastguard Worker ${DOCKER_EXTRA_ARGS:-} \ 40*9356374aSAndroid Build Coastguard Worker ${DOCKER_CONTAINER} \ 41*9356374aSAndroid Build Coastguard Worker /bin/bash -c "cmake /abseil-cpp-ro && make -j$(nproc) && make install" 42*9356374aSAndroid Build Coastguard Worker 43*9356374aSAndroid Build Coastguard Worker# Verify that a more complicated project works. 44*9356374aSAndroid Build Coastguard Workerfor link_type in ${LINK_TYPE}; do 45*9356374aSAndroid Build Coastguard Worker time docker run \ 46*9356374aSAndroid Build Coastguard Worker --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp-ro,readonly \ 47*9356374aSAndroid Build Coastguard Worker --tmpfs=/buildfs:exec \ 48*9356374aSAndroid Build Coastguard Worker --tmpfs=/abseil-cpp:exec \ 49*9356374aSAndroid Build Coastguard Worker --workdir=/abseil-cpp \ 50*9356374aSAndroid Build Coastguard Worker --cap-add=SYS_PTRACE \ 51*9356374aSAndroid Build Coastguard Worker -e "ABSL_GOOGLETEST_VERSION=${ABSL_GOOGLETEST_VERSION}" \ 52*9356374aSAndroid Build Coastguard Worker -e "ABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL}" \ 53*9356374aSAndroid Build Coastguard Worker -e "LINK_TYPE=${link_type}" \ 54*9356374aSAndroid Build Coastguard Worker --rm \ 55*9356374aSAndroid Build Coastguard Worker ${DOCKER_EXTRA_ARGS:-} \ 56*9356374aSAndroid Build Coastguard Worker ${DOCKER_CONTAINER} \ 57*9356374aSAndroid Build Coastguard Worker /bin/bash -c "cp -r /abseil-cpp-ro/* . && CMake/install_test_project/test.sh" 58*9356374aSAndroid Build Coastguard Workerdone 59