5 trap clean_up_after_myself EXIT
7 ORIGINAL_CCACHE_CONF
="$HOME/.ccache/ccache.conf"
8 SAVED_CCACHE_CONF
="$HOME/.run-make-check-saved-ccache-conf"
10 function save_ccache_conf
() {
11 test -f $ORIGINAL_CCACHE_CONF && cp $ORIGINAL_CCACHE_CONF $SAVED_CCACHE_CONF || true
14 function restore_ccache_conf
() {
15 test -f $SAVED_CCACHE_CONF && mv $SAVED_CCACHE_CONF $ORIGINAL_CCACHE_CONF || true
18 function clean_up_after_myself
() {
19 rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv
*
23 function get_processors
() {
24 # get_processors() depends on coreutils nproc.
25 if test -n "$NPROC" ; then
28 if test $
(nproc
) -ge 2 ; then
36 function detect_ceph_dev_pkgs
() {
38 local boost_root
=/opt
/ceph
39 if test -f $boost_root/include
/boost
/config.hpp
; then
40 cmake_opts
+=" -DWITH_SYSTEM_BOOST=ON -DBOOST_ROOT=$boost_root"
42 cmake_opts
+=" -DBOOST_J=$(get_processors)"
45 source /etc
/os-release
46 if [[ "$ID" == "ubuntu" ]] && [[ "$VERSION" =~ .
*Xenial
*.
]]; then
47 cmake_opts
+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=NO"
54 local which_pkg
="which"
55 source /etc
/os-release
56 if test -f /etc
/redhat-release
; then
57 if ! type bc > /dev
/null
2>&1 ; then
58 echo "Please install bc and re-run."
61 if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
62 install_cmd
="dnf -y install"
64 install_cmd
="yum install -y"
66 elif type zypper
> /dev
/null
2>&1 ; then
67 install_cmd
="zypper --gpg-auto-import-keys --non-interactive install --no-recommends"
68 elif type apt-get
> /dev
/null
2>&1 ; then
69 install_cmd
="apt-get install -y"
70 which_pkg
="debianutils"
73 if ! type sudo
> /dev
/null
2>&1 ; then
74 echo "Please install sudo and re-run. This script assumes it is running"
75 echo "as a normal user with the ability to run commands as root via sudo."
78 if [ -n "$install_cmd" ]; then
79 $DRY_RUN sudo
$install_cmd ccache
$which_pkg
81 echo "WARNING: Don't know how to install packages" >&2
82 echo "This probably means distribution $ID is not supported by run-make-check.sh" >&2
85 if ! type ccache
> /dev
/null
2>&1 ; then
86 echo "ERROR: ccache could not be installed"
90 if test -f .
/install-deps.sh
; then
91 $DRY_RUN source .
/install-deps.sh ||
return 1
92 trap clean_up_after_myself EXIT
96 Note that the binaries produced by this script do not contain correct time
97 and git version information, which may make them unsuitable for debugging
101 # remove the entropy generated by the date/time embedded in the build
102 $DRY_RUN export SOURCE_DATE_EPOCH
="946684800"
103 $DRY_RUN ccache
-o sloppiness
=time_macros
104 $DRY_RUN ccache
-o run_second_cpp
=true
105 if [ -n "$JENKINS_HOME" ]; then
106 # Build host has plenty of space available, let's use it to keep
107 # various versions of the built objects. This could increase the cache hit
108 # if the same or similar PRs are running several times
109 $DRY_RUN ccache
-o max_size
=100G
111 echo "Current ccache max_size setting:"
112 ccache
-p |
grep max_size
114 $DRY_RUN ccache
-sz # Reset the ccache statistics and show the current configuration
117 function configure
() {
118 local cmake_build_opts
=$
(detect_ceph_dev_pkgs
)
119 $DRY_RUN .
/do_cmake.sh
$cmake_build_opts $@ ||
return 1
125 BUILD_MAKEOPTS
=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
126 test "$BUILD_MAKEOPTS" && echo "make will run with option(s) $BUILD_MAKEOPTS"
127 $DRY_RUN make $BUILD_MAKEOPTS $targets ||
return 1
128 $DRY_RUN ccache
-s # print the ccache statistics to evaluate the efficiency
131 DEFAULT_MAKEOPTS
=${DEFAULT_MAKEOPTS:--j$(get_processors)}
133 if [ "$0" = "$BASH_SOURCE" ]; then
135 if [ `uname` = FreeBSD
]; then
136 GETOPT
=/usr
/local
/bin
/getopt
141 options
=$
(${GETOPT} --name "$0" --options "" --longoptions "cmake-args:" -- "$@")
142 if [ $?
-ne 0 ]; then
145 eval set -- "${options}"
155 echo "bad option $1" >& 2
160 configure
"$cmake_args"