2019-05-20 15:01:40 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-01-31 16:13:32 +00:00
|
|
|
set -ex
|
2019-08-21 06:27:42 +00:00
|
|
|
|
2020-11-25 01:40:49 +00:00
|
|
|
if [ -d .git ]; then
|
2023-10-26 10:48:31 +00:00
|
|
|
git submodule update --init --recursive --progress
|
2020-11-25 01:40:49 +00:00
|
|
|
fi
|
2019-08-21 06:27:42 +00:00
|
|
|
|
2019-10-25 05:20:22 +00:00
|
|
|
: ${BUILD_DIR:=build}
|
|
|
|
: ${CEPH_GIT_DIR:=..}
|
2019-08-21 06:27:42 +00:00
|
|
|
|
|
|
|
if [ -e $BUILD_DIR ]; then
|
|
|
|
echo "'$BUILD_DIR' dir already exists; either rm -rf '$BUILD_DIR' and re-run, or set BUILD_DIR env var to a different directory name"
|
2016-06-22 15:59:48 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2017-06-01 16:25:11 +00:00
|
|
|
|
2021-03-04 06:30:17 +00:00
|
|
|
PYBUILD="3"
|
2024-03-14 21:43:36 +00:00
|
|
|
ARGS="${ARGS} -GNinja"
|
2019-03-02 14:37:38 +00:00
|
|
|
if [ -r /etc/os-release ]; then
|
|
|
|
source /etc/os-release
|
|
|
|
case "$ID" in
|
|
|
|
fedora)
|
2023-11-20 04:43:31 +00:00
|
|
|
if [ "$VERSION_ID" -ge "39" ] ; then
|
|
|
|
PYBUILD="3.12"
|
2021-06-07 09:49:24 +00:00
|
|
|
else
|
2023-11-20 04:43:31 +00:00
|
|
|
# Fedora 37 and above
|
|
|
|
PYBUILD="3.11"
|
2019-03-02 14:37:38 +00:00
|
|
|
fi
|
|
|
|
;;
|
2022-10-30 10:40:38 +00:00
|
|
|
rocky|rhel|centos)
|
2019-03-02 14:37:38 +00:00
|
|
|
MAJOR_VER=$(echo "$VERSION_ID" | sed -e 's/\..*$//')
|
2021-06-03 01:29:19 +00:00
|
|
|
if [ "$MAJOR_VER" -ge "9" ] ; then
|
|
|
|
PYBUILD="3.9"
|
|
|
|
elif [ "$MAJOR_VER" -ge "8" ] ; then
|
2019-07-23 16:43:03 +00:00
|
|
|
PYBUILD="3.6"
|
2019-03-02 14:37:38 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
opensuse*|suse|sles)
|
|
|
|
PYBUILD="3"
|
2019-09-28 14:15:15 +00:00
|
|
|
ARGS+=" -DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
|
2019-10-10 13:27:35 +00:00
|
|
|
ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF"
|
2019-03-02 14:37:38 +00:00
|
|
|
;;
|
2022-08-22 20:46:53 +00:00
|
|
|
ubuntu)
|
|
|
|
MAJOR_VER=$(echo "$VERSION_ID" | sed -e 's/\..*$//')
|
|
|
|
if [ "$MAJOR_VER" -ge "22" ] ; then
|
|
|
|
PYBUILD="3.10"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2019-03-02 14:37:38 +00:00
|
|
|
esac
|
|
|
|
elif [ "$(uname)" == FreeBSD ] ; then
|
|
|
|
PYBUILD="3"
|
2019-09-28 14:15:15 +00:00
|
|
|
ARGS+=" -DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
|
2019-10-10 13:27:35 +00:00
|
|
|
ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF"
|
2019-03-02 14:37:38 +00:00
|
|
|
else
|
|
|
|
echo Unknown release
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-03-04 06:30:17 +00:00
|
|
|
ARGS+=" -DWITH_PYTHON3=${PYBUILD}"
|
2018-11-21 15:14:46 +00:00
|
|
|
|
2024-03-14 21:24:30 +00:00
|
|
|
if type sccache > /dev/null 2>&1 ; then
|
|
|
|
echo "enabling sccache"
|
|
|
|
ARGS+=" -DWITH_SCCACHE=ON"
|
|
|
|
elif type ccache > /dev/null 2>&1 ; then
|
2017-06-01 16:25:11 +00:00
|
|
|
echo "enabling ccache"
|
2019-09-28 14:15:15 +00:00
|
|
|
ARGS+=" -DWITH_CCACHE=ON"
|
2019-02-28 13:49:45 +00:00
|
|
|
fi
|
2017-06-01 16:25:11 +00:00
|
|
|
|
2022-08-05 03:48:30 +00:00
|
|
|
cxx_compiler="g++"
|
|
|
|
c_compiler="gcc"
|
|
|
|
# 20 is used for more future-proof
|
|
|
|
for i in $(seq 20 -1 11); do
|
|
|
|
if type -t gcc-$i > /dev/null; then
|
|
|
|
cxx_compiler="g++-$i"
|
|
|
|
c_compiler="gcc-$i"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
ARGS+=" -DCMAKE_CXX_COMPILER=$cxx_compiler"
|
|
|
|
ARGS+=" -DCMAKE_C_COMPILER=$c_compiler"
|
|
|
|
|
2019-08-21 06:27:42 +00:00
|
|
|
mkdir $BUILD_DIR
|
|
|
|
cd $BUILD_DIR
|
2018-07-06 05:25:23 +00:00
|
|
|
if type cmake3 > /dev/null 2>&1 ; then
|
|
|
|
CMAKE=cmake3
|
|
|
|
else
|
|
|
|
CMAKE=cmake
|
|
|
|
fi
|
2019-10-25 05:20:22 +00:00
|
|
|
${CMAKE} $ARGS "$@" $CEPH_GIT_DIR || exit 1
|
2019-10-24 17:17:59 +00:00
|
|
|
set +x
|
2016-06-30 14:51:55 +00:00
|
|
|
|
2016-10-03 18:52:38 +00:00
|
|
|
# minimal config to find plugins
|
2016-06-30 14:51:55 +00:00
|
|
|
cat <<EOF > ceph.conf
|
2019-06-28 05:46:30 +00:00
|
|
|
[global]
|
2016-06-30 14:51:55 +00:00
|
|
|
plugin dir = lib
|
|
|
|
erasure code dir = lib
|
|
|
|
EOF
|
|
|
|
|
|
|
|
echo done.
|
2019-10-24 07:57:57 +00:00
|
|
|
|
2020-05-13 21:07:55 +00:00
|
|
|
if [[ ! "$ARGS $@" =~ "-DCMAKE_BUILD_TYPE" ]]; then
|
2019-10-24 07:57:57 +00:00
|
|
|
cat <<EOF
|
2018-12-10 23:46:50 +00:00
|
|
|
|
|
|
|
****
|
|
|
|
WARNING: do_cmake.sh now creates debug builds by default. Performance
|
|
|
|
may be severely affected. Please use -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
|
|
|
if a performance sensitive build is required.
|
|
|
|
****
|
|
|
|
EOF
|
2019-10-24 07:57:57 +00:00
|
|
|
fi
|
|
|
|
|