@@ -4,12 +4,12 @@ set -exo pipefail
4
4
export PATH=" /usr/lib/ccache:/usr/lib64/ccache:$PATH "
5
5
export CCACHE_DIR=/icinga2/ccache
6
6
export CTEST_OUTPUT_ON_FAILURE=1
7
- CMAKE_OPTS=' '
7
+ CMAKE_OPTS=()
8
8
9
9
case " $DISTRO " in
10
10
amazonlinux:2)
11
11
amazon-linux-extras install -y epel
12
- yum install -y bison ccache cmake3 gcc-c++ flex ninja-build \
12
+ yum install -y bison ccache cmake3 gcc-c++ flex ninja-build system-rpm-config \
13
13
{libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel
14
14
15
15
yum install -y bzip2 tar wget
@@ -24,28 +24,30 @@ case "$DISTRO" in
24
24
25
25
ln -vs /usr/bin/cmake3 /usr/local/bin/cmake
26
26
ln -vs /usr/bin/ninja-build /usr/local/bin/ninja
27
- CMAKE_OPTS= ' -DBOOST_INCLUDEDIR =/boost_1_69_0 -DBOOST_LIBRARYDIR =/boost_1_69_0/stage/lib'
27
+ CMAKE_OPTS+=(-DBOOST_{INCLUDEDIR =/boost_1_69_0,LIBRARYDIR =/boost_1_69_0/stage/lib})
28
28
export LD_LIBRARY_PATH=/boost_1_69_0/stage/lib
29
29
;;
30
30
31
31
amazonlinux:20* )
32
- dnf install -y bison cmake flex gcc-c++ ninja-build \
32
+ dnf install -y amazon-rpm-config bison cmake flex gcc-c++ ninja-build \
33
33
{boost,libedit,mariadb1\* ,ncurses,openssl,postgresql,systemd}-devel
34
34
;;
35
35
36
36
debian:* |ubuntu:* )
37
37
apt-get update
38
- DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y bison \
39
- ccache cmake flex g++ lib{boost-all,edit,mariadb,ncurses,pq,ssl,systemd}-dev ninja-build tzdata
38
+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y \
39
+ bison ccache cmake dpkg-dev flex g++ ninja-build tzdata \
40
+ lib{boost-all,edit,mariadb,ncurses,pq,ssl,systemd}-dev
40
41
;;
41
42
42
43
fedora:* )
43
- dnf install -y bison ccache cmake flex gcc-c++ ninja-build \
44
+ dnf install -y bison ccache cmake flex gcc-c++ ninja-build redhat-rpm-config \
44
45
{boost,libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel
45
46
;;
46
47
47
48
* suse* )
48
- zypper in -y bison ccache cmake flex gcc-c++ ninja {lib{edit,mariadb,openssl},ncurses,postgresql,systemd}-devel \
49
+ zypper in -y bison ccache cmake flex gcc-c++ ninja rpm-config-SUSE \
50
+ {lib{edit,mariadb,openssl},ncurses,postgresql,systemd}-devel \
49
51
libboost_{context,coroutine,filesystem,iostreams,program_options,regex,system,test,thread}-devel
50
52
;;
51
53
@@ -61,22 +63,33 @@ case "$DISTRO" in
61
63
;;
62
64
esac
63
65
64
- dnf install -y bison ccache cmake gcc-c++ flex ninja-build \
66
+ dnf install -y bison ccache cmake gcc-c++ flex ninja-build redhat-rpm-config \
65
67
{boost,libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel
66
68
;;
67
69
esac
68
70
71
+ case " $DISTRO " in
72
+ debian:* |ubuntu:* )
73
+ CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON)
74
+ source <( dpkg-buildflags --export=sh)
75
+ ;;
76
+ * )
77
+ CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS=" $( rpm -E ' %{optflags} %{?march_flag}' ) " )
78
+ export LDFLAGS=" $( rpm -E ' %{?build_ldflags}' ) "
79
+ ;;
80
+ esac
81
+
69
82
mkdir /icinga2/build
70
83
cd /icinga2/build
71
84
72
85
cmake \
73
86
-GNinja \
74
- -DCMAKE_BUILD_TYPE=Release \
87
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
75
88
-DICINGA2_UNITY_BUILD=ON \
76
89
-DUSE_SYSTEMD=ON \
77
90
-DICINGA2_USER=$( id -un) \
78
91
-DICINGA2_GROUP=$( id -gn) \
79
- $ CMAKE_OPTS ..
92
+ " ${ CMAKE_OPTS[@]} " ..
80
93
81
94
ninja -v
82
95
0 commit comments