File: rules

package info (click to toggle)
xymon 4.3.30-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,384 kB
  • sloc: ansic: 69,137; sh: 3,601; makefile: 863; javascript: 452; perl: 48
file content (141 lines) | stat: -rwxr-xr-x 5,013 bytes parent folder | download
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_MAINT_OPTIONS=hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

S=$(CURDIR)/debian/xymon
C=$(CURDIR)/debian/xymon-client

%:
	dh $@ --with apache2

override_dh_auto_configure:
	USEXYMONPING=y \
	ENABLESSL=y \
	ENABLELDAP=y \
	ENABLELDAPSSL=y \
	XYMONUSER=xymon \
	XYMONTOPDIR=/usr/lib/xymon \
	XYMONVAR=/var/lib/xymon \
	XYMONHOSTURL=/xymon \
	CGIDIR=/usr/lib/xymon/cgi-bin \
	XYMONCGIURL=/xymon-cgi \
	SECURECGIDIR=/usr/lib/xymon/cgi-secure \
	SECUREXYMONCGIURL=/xymon-seccgi \
	HTTPDGID=www-data \
	XYMONLOGDIR=/var/log/xymon \
	XYMONHOSTNAME=localhost \
	XYMONHOSTIP=127.0.0.1 \
	MANROOT=/usr/share/man \
	INSTALLBINDIR=/usr/lib/xymon/server/bin \
	INSTALLETCDIR=/etc/xymon \
	INSTALLWEBDIR=/etc/xymon/web \
	INSTALLEXTDIR=/usr/lib/xymon/server/ext \
	INSTALLTMPDIR=/var/lib/xymon/tmp \
	INSTALLWWWDIR=/var/lib/xymon/www \
	./configure --server \
	--pcrelib $(shell pcre2-config --libs8) \
	--ssllib /usr/lib/$(DEB_HOST_MULTIARCH) \
	--ldaplib /usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_build:
	# preserve some files from upstream tarball:
	tar cf debian/preserve.tar docs/manpages/*/*.html

	env -u LANG LC_ALL=C.UTF-8 TZ=UTC ./build/makehtml.sh $(DEB_VERSION_UPSTREAM)
	MAKEFLAGS=-j1 CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 $(MAKE)

override_dh_clean:
	dh_clean
	debconf-updatepo
	# restore overwritten files from upstream tarball:
	[ ! -f debian/preserve.tar ] || tar xf debian/preserve.tar
	rm -f debian/preserve.tar

override_dh_auto_install:
# SERVER
	MAKEFLAGS=-j1 CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 INSTALLROOT=$S/ $(MAKE) install
	# Static content in /usr/share
	cd $S/var/lib/xymon/www && \
		mv gifs ../../../../usr/share/xymon && ln -s ../../../../usr/share/xymon/gifs . && \
		mv help ../../../../usr/share/xymon && ln -s ../../../../usr/share/xymon/help .
	# Create static gifs
	cd $S/usr/share/xymon/gifs && mkdir static && \
		for gif in *.gif ; do \
			convert "$$gif[0]" xpm:- | convert xpm:- static/$$gif || exit 1 ; \
		done && \
		cd static && ln -s ../*.ico ../*.css .
	# Convert pngs to gifs to fix their names:
	# see https://github.com/xymon-monitoring/xymon/issues/56
	cd $S/usr/share/xymon/gifs && \
		for gif in unknown*.gif ; do \
			mv $$gif $$gif.png ; \
			convert $$gif.png $$gif; \
			rm -f $$gif.png; \
		done
	# We depend on the -client package
	rm -rf $S/usr/lib/xymon/client
	# This needs setuid root
	chmod 4755 $S/usr/lib/xymon/server/bin/xymonping
	# Apache 2.4 style stuff, used by implicit dh_apache2, see also debian/xymon.apache2
	mkdir -p debian/tmp
	mv $S/etc/xymon/xymon-apache.conf debian/tmp/xymon.conf
	# We use a modified version of this as /etc/init.d/xymon
	rm $S/usr/lib/xymon/server/xymon.sh
	# Autogenerated on first install
	rm $S/etc/xymon/hosts.cfg
	# Fix permissions in /var/lib/xymon (dh_fixperms ignores /var)
	chmod a-x $S/var/lib/xymon/www/menu/*.gif $S/var/lib/xymon/www/menu/*.css

# CLIENT
	CFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" PKGBUILD=1 INSTALLROOT=$C/ $(MAKE) install-client
	cd $C/usr/lib/xymon/client && mv etc/* $C/etc/xymon && rmdir etc && ln -s ../../../../etc/xymon etc
	cd $C/usr/lib/xymon/client && rmdir logs && ln -s ../../../../var/log/xymon logs
	cd $C/usr/lib/xymon/client && rmdir tmp && ln -s ../../../../var/lib/xymon/tmp
	# the only command needed in /usr/bin is xymoncmd, its PATH includes our private .../bin
	cd $C/usr/bin && ln -s ../lib/xymon/client/bin/xymoncmd xymoncmd
	cp debian/xymon-client.default.template $C/usr/share/xymon/xymon-client.default.template
ifneq (,$(findstring kfreebsd,$(shell dpkg --print-architecture)))
	# kfreebsd support
	install -m644 debian/kfreebsd.cfg $C/etc/xymon/xymonclient.d/kfreebsd.cfg
else
	# no kfreebsd support
endif

	dh_movefiles --sourcedir=debian/xymon -a
	set -e; cd $S/usr/lib/xymon/server/bin && \
		for f in * ; do \
			if [ -f $C/usr/lib/xymon/client/bin/$$f ] ; then \
				rm -v $$f ; ln -s ../../client/bin/$$f ; \
			fi \
		done
	rmdir $S/usr/share/man/man7

	# move xymond_client to xymon-client package (see #903614):
	mv $S/usr/share/man/man8/xymond_client.8 $C/usr/share/man/man8/
	mv $S/usr/lib/xymon/server/bin/xymond_client $C/usr/lib/xymon/client/bin/
	(cd $S/usr/lib/xymon/server/bin && ln -s ../../client/bin/xymond_client)

override_dh_installdocs:
	dh_installdocs
	mv -v $S/usr/share/doc/xymon/RELEASENOTES $S/usr/share/doc/xymon/NEWS
	mv -v $C/usr/share/doc/xymon-client/RELEASENOTES $C/usr/share/doc/xymon-client/NEWS
	# Fix encoding of CREDITS:
	for f in $C/usr/share/doc/xymon-client/CREDITS $S/usr/share/doc/xymon/CREDITS; do \
		iconv -f ISO-8859-1 -t UTF-8 -o $$f.new $$f; \
		mv $$f.new $$f; \
	done

override_dh_installinit:
	dh_installinit -a -- defaults 98 02

override_dh_fixperms:
	dh_fixperms -a -Xbin/xymonping

# Needed as long as #968170 in dh_apache2/apache2-dev isn't fixed.
override_dh_missing:
	dh_missing --list-missing