2019-05-20 15:01:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -x
|
2016-06-22 15:59:48 +00:00
|
|
|
git submodule update --init --recursive
|
|
|
|
if test -e build; then
|
|
|
|
echo 'build dir already exists; rm -rf build and re-run'
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-06-01 16:25:11 +00:00
|
|
|
|
2018-11-21 15:14:46 +00:00
|
|
|
PYBUILD="2"
|
2019-03-02 14:37:38 +00:00
|
|
|
if [ -r /etc/os-release ]; then
|
|
|
|
source /etc/os-release
|
|
|
|
case "$ID" in
|
|
|
|
fedora)
|
|
|
|
if [ "$VERSION_ID" -ge "29" ] ; then
|
2019-07-23 16:43:03 +00:00
|
|
|
PYBUILD="3.7"
|
2019-03-02 14:37:38 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
rhel|centos)
|
|
|
|
MAJOR_VER=$(echo "$VERSION_ID" | sed -e 's/\..*$//')
|
|
|
|
if [ "$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"
|
|
|
|
WITH_RADOSGW_AMQP_ENDPOINT="OFF"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
elif [ "$(uname)" == FreeBSD ] ; then
|
|
|
|
PYBUILD="3"
|
|
|
|
WITH_RADOSGW_AMQP_ENDPOINT="OFF"
|
|
|
|
else
|
|
|
|
echo Unknown release
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-23 16:43:03 +00:00
|
|
|
if [[ "$PYBUILD" =~ ^3(\..*)?$ ]] ; then
|
|
|
|
ARGS="$ARGS -DWITH_PYTHON2=OFF -DWITH_PYTHON3=${PYBUILD} -DMGR_PYTHON_VERSION=${PYBUILD}"
|
2018-11-21 15:14:46 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-19 14:13:15 +00:00
|
|
|
if type ccache > /dev/null 2>&1 ; then
|
2017-06-01 16:25:11 +00:00
|
|
|
echo "enabling ccache"
|
2017-07-19 22:02:02 +00:00
|
|
|
ARGS="$ARGS -DWITH_CCACHE=ON"
|
2017-06-01 16:25:11 +00:00
|
|
|
fi
|
2019-02-28 13:49:45 +00:00
|
|
|
if [ -n "$WITH_RADOSGW_AMQP_ENDPOINT" ] ; then
|
|
|
|
ARGS="$ARGS -DWITH_RADOSGW_AMQP_ENDPOINT=$WITH_RADOSGW_AMQP_ENDPOINT"
|
|
|
|
fi
|
2017-06-01 16:25:11 +00:00
|
|
|
|
2016-06-22 15:59:48 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2018-07-06 05:25:23 +00:00
|
|
|
if type cmake3 > /dev/null 2>&1 ; then
|
|
|
|
CMAKE=cmake3
|
|
|
|
else
|
|
|
|
CMAKE=cmake
|
|
|
|
fi
|
2018-09-17 16:02:44 +00:00
|
|
|
${CMAKE} -DCMAKE_BUILD_TYPE=Debug $ARGS "$@" .. || exit 1
|
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.
|
2018-12-10 23:46:50 +00:00
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
****
|
|
|
|
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
|