summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: bbf3e0090976aba8d932aa2ef661704d6f5ca751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/make -f

#export DH_VERBOSE=1

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/architecture.mk

export CTEST_OUTPUT_ON_FAILURE=1

# Fix segfault on startup: #1068473
ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
  export DEB_CXXFLAGS_MAINT_APPEND = -O1
endif

ifneq (,$(filter $(DEB_HOST_ARCH), armel mips mipsel powerpc))
  export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
endif

%:
	dh $@ --with bash_completion,vim_addon

override_dh_auto_clean:
	dh_auto_clean

	test ! -f third-party/cmake/GNUInstallDirs.cmake.disabled || \
		mv third-party/cmake/GNUInstallDirs.cmake.disabled third-party/cmake/GNUInstallDirs.cmake

override_dh_auto_configure:
	test -f third-party/cmake/GNUInstallDirs.cmake.disabled || \
		mv third-party/cmake/GNUInstallDirs.cmake third-party/cmake/GNUInstallDirs.cmake.disabled

	dh_auto_configure \
		-- \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DICINGA2_RUNDIR=/run \
		-DICINGA2_USER=nagios \
		-DICINGA2_GROUP=nagios \
		-DICINGA2_COMMAND_GROUP=www-data \
		-DICINGA2_GIT_VERSION_INFO=false \
		-DICINGA2_PLUGINDIR=/usr/lib/nagios/plugins \
		-DUSE_SYSTEMD=ON

override_dh_auto_install:
	dh_auto_install

	# remove features-enabled - these will be activated by postinst later
	$(RM) -r debian/tmp/etc/icinga2/features-enabled/*

override_dh_install-arch:
	dh_install -a

	$(RM) debian/libicinga2/usr/lib/*/icinga2/libdb_ido_*

	for dbms in mysql pgsql; do \
		mkdir -p debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/install ; \
		mkdir -p debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/upgrade/$$dbms; \
		cp lib/db_ido_$$dbms/schema/$$dbms.sql debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/install/$$dbms ; \
		for file in lib/db_ido_$$dbms/schema/upgrade/* ; do \
			cp $$file debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/upgrade/$$dbms/`basename $$file .sql`; \
		done; \
	done

override_dh_install-indep:
	dh_install -i

	chmod +x debian/icinga2-common/usr/lib/icinga2/prepare-dirs

	$(RM) debian/icinga2-common/etc/icinga2/features-available/ido-*

override_dh_installinit:
	dh_installinit --name=icinga2

override_dh_installsystemd:
	dh_installsystemd --name=icinga2

override_dh_vim-addon:
	dh_vim-addon -p vim-icinga2

override_dh_compress:
	dh_compress
	dh_compress -p icinga2-doc usr/share/doc/icinga2/markdown/01-about.md

override_dh_missing:
	# Explicitly remove files not included in any package
	$(RM) debian/tmp/etc/bash_completion.d/icinga2
	$(RM) debian/tmp/etc/init.d/icinga2
	$(RM) debian/tmp/usr/lib/*/icinga2/lib*.so
	$(RM) debian/tmp/usr/lib/systemd/system/icinga2.service
	$(RM) debian/tmp/usr/share/doc/icinga2/AUTHORS
	$(RM) debian/tmp/usr/share/doc/icinga2/CHANGELOG.md
	$(RM) debian/tmp/usr/share/doc/icinga2/COPYING
	$(RM) debian/tmp/usr/share/doc/icinga2/COPYING.Exceptions
	$(RM) debian/tmp/usr/share/doc/icinga2/NEWS
	$(RM) debian/tmp/usr/share/doc/icinga2/README.md

	dh_missing --list-missing

# we don't build shared libraries
override_dh_makeshlibs:
	dh_makeshlibs --no-scripts

# vi: noexpandtab ts=4 sw=4 :