ceph/do_cmake.sh
Nathan Cutler a691122a4e build/ops: do_cmake.sh: automate py3 build options for certain distros
Before this patch, run-make-check.sh was setting the cmake options for
py3 build based only on the absence of a python2 binary in the system.
This was not sufficiently deterministic, and it didn't help folks who
run do_cmake.sh directly.

With this patch, we explicitly force the py3 build in do_cmake.sh, for
those OS types/versions we know need it.

Fixes: https://tracker.ceph.com/issues/37330
Signed-off-by: Nathan Cutler <ncutler@suse.com>
2018-11-21 16:51:16 +01:00

51 lines
1019 B
Bash
Executable File

#!/bin/sh -x
git submodule update --init --recursive
if test -e build; then
echo 'build dir already exists; rm -rf build and re-run'
exit 1
fi
PYBUILD="2"
source /etc/os-release
case "$ID" in
fedora)
if [ "$VERSION_ID" -ge "29" ] ; then
PYBUILD="3"
fi
;;
rhel|centos)
MAJOR_VER=$(echo "$VERSION_ID" | sed -e 's/\..*$//')
if [ "$MAJOR_VER" -ge "8" ] ; then
PYBUILD="3"
fi
;;
opensuse*|suse|sles)
PYBUILD="3"
;;
esac
if [ "$PYBUILD" = "3" ] ; then
ARGS="$ARGS -DWITH_PYTHON2=OFF -DWITH_PYTHON3=ON -DMGR_PYTHON_VERSION=3"
fi
if type ccache > /dev/null 2>&1 ; then
echo "enabling ccache"
ARGS="$ARGS -DWITH_CCACHE=ON"
fi
mkdir build
cd build
if type cmake3 > /dev/null 2>&1 ; then
CMAKE=cmake3
else
CMAKE=cmake
fi
${CMAKE} -DCMAKE_BUILD_TYPE=Debug $ARGS "$@" .. || exit 1
# minimal config to find plugins
cat <<EOF > ceph.conf
plugin dir = lib
erasure code dir = lib
EOF
echo done.