#!/usr/bin/make -f # debian/rules makefile for nagios4 # Last modified: # $Id$ # export DH_VERBOSE=1 export DEB_BUILD_HARDENING=1 b := $(shell pwd)/debian export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) # -Wall disabled until source is fixed to not print tons of warnings with it. :) #CFLAGS = -Wall -g CFLAGS = -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif SHELL = /bin/sh -e CONFIGURE = CFLAGS='$(CFLAGS)' ./configure --prefix=/usr \ --mandir=/usr/share/man \ --bindir=/usr/sbin \ --sbindir=/usr/lib/cgi-bin/nagios4 \ --datadir=/usr/share/nagios4/htdocs \ --sysconfdir=/etc/nagios4 \ --infodir=/usr/share/info \ --libexecdir=/usr/lib/nagios/plugins \ --localstatedir=/var/lib/nagios4 \ --enable-event-broker \ --enable-embedded-perl \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-command-user=nagios \ --with-command-group=nagios \ --with-init-dir=/etc/init.d \ --with-lockfile=/var/run/nagios4/nagios4.pid \ --with-mail=/usr/bin/mail \ --with-perlcache \ --build=$(DEB_BUILD_GNU_TYPE) \ --host=$(DEB_HOST_GNU_TYPE) \ --with-htmurl=/nagios4 \ --with-cgiurl=/cgi-bin/nagios4 clean: dh_testdir -a dh_testroot -a if test -f Makefile; then make distclean; fi rm -f install-stamp configure-stamp build-stamp fix-configs-stamp rm -rf debian-configs -rm contrib/perlxsi.c find -type d -name autom4te.cache -print0 | xargs -0 -r rm -rf \; -rm -f platform.h auto-include.h find -type d -name build -print0 | xargs -0 -r rm -rf \; dh_clean fix-configs: fix-configs-stamp fix-configs-stamp: configure-stamp mkdir -p debian-configs sed -e '/Sample CGI/ s/\([0-9]\.[0-9]\.[0-9]\)//' \ -e '/Last Modified/,+1 d' \ sample-config/cgi.cfg > debian-configs/cgi.cfg sed -e '/Sample Main Config/ s/\([0-9]\.[0-9]\.[0-9]\)//' \ -e '/Last Modified/ d' \ sample-config/nagios.cfg > debian-configs/nagios.cfg sed -e '/SAMPLE COMMAND DEFINITIONS/ s/\([0-9]\.[0-9]\.[0-9]\)//' \ -e '/Last Modified/,+1 d' \ -e '/^#$$/ d' sample-config/template-object/commands.cfg > debian-configs/commands.cfg configure: configure-stamp configure-stamp: dh_testdir -a @echo "Doing $@" if test -f Makefile; then make clean; fi ln -sf /usr/share/misc/config.sub . ln -sf /usr/share/misc/config.guess . rm -f config.cache $(CONFIGURE) touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir -a @echo "Doing $@" $(MAKE) all make -C contrib touch build-stamp install: install-stamp install-stamp: build-stamp fix-configs-stamp @echo "Doing $@" dh_testdir -a dh_testroot -a dh_installdirs -a -i # zero out INSTALL_OPTS to prevent chowning at build-time make install-unstripped DESTDIR=$b/tmp INSTALL_OPTS="" # move some arch-indep stuff to the other packages chgrp www-data ${b}/nagios4-common/var/cache/nagios4 chmod g+s ${b}/nagios4-common/var/cache/nagios4 chown root:www-data ${b}/nagios4-common/var/lib/nagios4/rw chmod 700 ${b}/nagios4-common/var/lib/nagios4/rw mv debian/tmp/usr/sbin/nagios ${b}/nagios4-core/usr/sbin/nagios4 mv debian/tmp/usr/sbin/nagiostats ${b}/nagios4-core/usr/sbin/nagios4stats dh_link -i dh_lintian dh_installdocs -i dh_installman -a -pnagios4 dh_installlogrotate dh_installchangelogs -i dh_install -i dh_installinit --name nagios4 -- defaults 30 18 dh_installexamples chmod 755 ${b}/nagios4-common/var/lib/nagios4 rm ${b}/nagios4-common/etc/nagios4/cgi.cfg touch install-stamp binary: binary-arch binary-indep binary-arch: install-stamp @echo "Doing $@" dh_testdir -a dh_testroot -a dh_link -a dh_installchangelogs -a dh_installdocs -a dh_installdebconf -a dh_install -a chmod 600 ${b}/nagios4-common/etc/nagios4/resource.cfg # fix permissions of p1 #chmod 755 ${b}/nagios4-core/usr/lib/nagios4/p1.pl mkdir -p ${b}/nagios4-dbg/usr/bin/ #mv contrib/mini_epn ${b}/nagios4-dbg/usr/bin/mini_epn_nagios4 dh_strip -a --dbg-package=nagios4-dbg dh_compress -a -X.php dh_fixperms -a -X/var/cache/nagios4 dh_makeshlibs -a -V dh_installdeb -a dh_perl -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary-indep: install-stamp dh_link -i dh_compress -i dh_fixperms -i -Xnagios4/resource.cfg dh_installdebconf -i dh_perl -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i .PHONY: binary-indep binary-arch build configure binary install