]> git.proxmox.com Git - ceph.git/blob - ceph/do_cmake.sh
bump version to 17.2.5-pve1
[ceph.git] / ceph / do_cmake.sh
1 #!/usr/bin/env bash
2 set -ex
3
4 if [ -d .git ]; then
5 git submodule update --init --recursive
6 fi
7
8 : ${BUILD_DIR:=build}
9 : ${CEPH_GIT_DIR:=..}
10
11 if [ -e $BUILD_DIR ]; then
12 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"
13 exit 1
14 fi
15
16 PYBUILD="3"
17 ARGS="-GNinja"
18 if [ -r /etc/os-release ]; then
19 source /etc/os-release
20 case "$ID" in
21 fedora)
22 if [ "$VERSION_ID" -ge "35" ] ; then
23 PYBUILD="3.10"
24 elif [ "$VERSION_ID" -ge "33" ] ; then
25 PYBUILD="3.9"
26 elif [ "$VERSION_ID" -ge "32" ] ; then
27 PYBUILD="3.8"
28 else
29 PYBUILD="3.7"
30 fi
31 ;;
32 rhel|centos)
33 MAJOR_VER=$(echo "$VERSION_ID" | sed -e 's/\..*$//')
34 if [ "$MAJOR_VER" -ge "9" ] ; then
35 PYBUILD="3.9"
36 elif [ "$MAJOR_VER" -ge "8" ] ; then
37 PYBUILD="3.6"
38 fi
39 ;;
40 opensuse*|suse|sles)
41 PYBUILD="3"
42 ARGS+=" -DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
43 ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF"
44 ;;
45 esac
46 elif [ "$(uname)" == FreeBSD ] ; then
47 PYBUILD="3"
48 ARGS+=" -DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
49 ARGS+=" -DWITH_RADOSGW_KAFKA_ENDPOINT=OFF"
50 else
51 echo Unknown release
52 exit 1
53 fi
54
55 ARGS+=" -DWITH_PYTHON3=${PYBUILD}"
56
57 if type ccache > /dev/null 2>&1 ; then
58 echo "enabling ccache"
59 ARGS+=" -DWITH_CCACHE=ON"
60 fi
61
62 mkdir $BUILD_DIR
63 cd $BUILD_DIR
64 if type cmake3 > /dev/null 2>&1 ; then
65 CMAKE=cmake3
66 else
67 CMAKE=cmake
68 fi
69 ${CMAKE} $ARGS "$@" $CEPH_GIT_DIR || exit 1
70 set +x
71
72 # minimal config to find plugins
73 cat <<EOF > ceph.conf
74 [global]
75 plugin dir = lib
76 erasure code dir = lib
77 EOF
78
79 echo done.
80
81 if [[ ! "$ARGS $@" =~ "-DCMAKE_BUILD_TYPE" ]]; then
82 cat <<EOF
83
84 ****
85 WARNING: do_cmake.sh now creates debug builds by default. Performance
86 may be severely affected. Please use -DCMAKE_BUILD_TYPE=RelWithDebInfo
87 if a performance sensitive build is required.
88 ****
89 EOF
90 fi
91