check_logfiles: 3.7.5.1
[omd.git] / packages / nagios / Makefile
blob8c144e7ce22584dd405fc653a70d8692158f86ed
1 include ../../Makefile.omd
3 NAME = nagios
4 VERSION = 3.5.0
5 DIR = $(NAME)-$(VERSION)
7 # Configure options for Nagios. Since we want to compile
8 # as non-root, we use our own user and group for compiling.
9 # All files will be packaged as user 'root' later anyway.
10 CONFIGUREOPTS = \
11 --sbindir=$(OMD_ROOT)/lib/nagios/cgi-bin \
12 --bindir=$(OMD_ROOT)/bin \
13 --datadir=$(OMD_ROOT)/share/nagios/htdocs \
14 --with-nagios-user=$$(id -un) \
15 --with-nagios-group=$$(id -gn) \
16 --with-perlcache \
17 --enable-embedded-perl \
19 build:
20 $(MAKE) prep
21 $(MAKE) compile
23 prep:
24 $(MAKE) unpack
25 $(MAKE) patch
27 compile:
28 cd $(DIR) ; ./configure $(CONFIGUREOPTS)
29 $(MAKE) -C $(DIR) all
31 unpack:
32 rm -rf $(DIR)
33 tar xzf $(DIR).tar.gz
34 mv nagios $(DIR)
36 patch:
37 set -e ; for p in patches/*.dif ; do \
38 echo "applying $$p..." ; \
39 ( cd $(DIR) ; patch -p1 -b ) < $$p ; \
40 done
41 find $(DIR)/ -name \*.orig -exec rm {} \;
45 install:
46 $(MAKE) DESTDIR=$(DESTDIR) -C $(DIR) install-base install-cgis install-html install-classicui
47 rm -f $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/config.php.inc
49 # Install Themes
50 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui
51 cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui/
52 cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui/
53 $(MAKE) DESTDIR=$(DESTDIR) -C $(DIR) install-exfoliation
54 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation
55 cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation/
56 cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation/
57 # remove original files
58 rm -rf $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets
59 rm -rf $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images
60 # Link ClassicUI
61 cd $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs; rm -rf styleshets; ln -sfn themes/classicui/stylesheets
62 cd $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs; rm -rf images; ln -sfn themes/classicui/images
64 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/nagios
65 install -m 664 $(DIR)/p1.pl $(DESTDIR)$(OMD_ROOT)/lib/nagios
67 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi
68 install -m 755 ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi
70 for f in common avail cmd config extinfo histogram history notifications outages showlog status statusmap statuswml statuswrl summary tac trends ; do \
71 ln -sfn ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi/$$f-header.ssi ; \
72 ln -sfn ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi/$$f-footer.ssi ; \
73 done
75 # Copy package documentations to have these information in the binary packages
76 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/doc/$(NAME)
77 for file in README THANKS LEGAL LICENSE ; do \
78 install -m 644 $(DIR)/$$file $(DESTDIR)$(OMD_ROOT)/share/doc/$(NAME); \
79 done
81 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
82 install -m 755 merge-nagios-config $(DESTDIR)$(OMD_ROOT)/bin
84 # Install the diskspace cleanup plugin
85 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/diskspace
86 install -m 644 diskspace $(DESTDIR)$(OMD_ROOT)/share/diskspace/nagios
88 clean:
89 rm -rf $(DIR)
91 testpatches:
92 @rm -rf $(DIR)
93 @tar xzf $(DIR).tar.gz
94 @set -e ; for p in patches/*.dif ; do \
95 rm -rf $(DIR).orig; \
96 cp -rp $(DIR) $(DIR).orig; \
97 ( cd $(DIR) ; patch -sNt -p1 -r - ) < $$p > /dev/null; \
98 find $(DIR) -name \*.orig -exec rm {} \;; \
99 [ $$(diff -wr $(DIR).orig/. $(DIR)/. | wc -l) = 0 ] && echo "-> patch $$p did not change anything (already applied or broken)" || echo -n ""; \
100 done
101 @rm -rf $(DIR).orig
102 @echo "all patches tested"