#!/usr/bin/env bash set -e if ! [ "${_SOURCED_LIB_BUILD}" = 1 ]; then SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CEPH_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" . "${CEPH_ROOT}/src/script/lib-build.sh" || exit 2 fi trap clean_up_after_myself EXIT ORIGINAL_CCACHE_CONF="$HOME/.ccache/ccache.conf" SAVED_CCACHE_CONF="$HOME/.run-make-check-saved-ccache-conf" function save_ccache_conf() { test -f $ORIGINAL_CCACHE_CONF && cp $ORIGINAL_CCACHE_CONF $SAVED_CCACHE_CONF || true } function restore_ccache_conf() { test -f $SAVED_CCACHE_CONF && mv $SAVED_CCACHE_CONF $ORIGINAL_CCACHE_CONF || true } function clean_up_after_myself() { rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv* restore_ccache_conf } function detect_ceph_dev_pkgs() { local boost_root=/opt/ceph local cmake_opts="" if test -f $boost_root/include/boost/config.hpp; then cmake_opts+=" -DWITH_SYSTEM_BOOST=ON -DBOOST_ROOT=$boost_root" else cmake_opts+=" -DBOOST_J=$(get_processors)" fi source /etc/os-release if [[ "$ID" == "ubuntu" ]]; then case "$VERSION" in *Xenial*) cmake_opts+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF";; *Focal*) cmake_opts+=" -DWITH_SYSTEM_ZSTD=ON";; esac fi echo "$cmake_opts" } function prepare() { local which_pkg="which" if command -v apt-get > /dev/null 2>&1 ; then which_pkg="debianutils" fi if test -f ./install-deps.sh ; then ci_debug "Running install-deps.sh" INSTALL_EXTRA_PACKAGES="ccache git $which_pkg clang lvm2" $DRY_RUN source ./install-deps.sh || return 1 trap clean_up_after_myself EXIT fi if ! type ccache > /dev/null 2>&1 ; then echo "ERROR: ccache could not be installed" exit 1 fi } function configure() { cat <& 2 exit 2;; esac done prepare configure "$cmake_args" build "$@" fi