check_logfiles: 3.7.5.1
[omd.git] / packages / apache-omd / Makefile
blob0e387ec829a55554755400bf009dad995628370e
1 include ../../Makefile.omd
3 NAME = apache-omd
4 VERSION = 1.0
5 DIR = $(NAME)-$(VERSION)
6 FCGI_FILE="mod_fcgid-2.3.9"
8 MODULE_DIR=$(APACHE_MODULE_DIR)
9 ifeq ($(shell uname -m),x86_64)
10 MODULE_DIR=$(APACHE_MODULE_DIR_64)
11 endif
13 APACHE_VERSION = $(shell $(APACHE_BIN) -v | awk '/version/ {print $$3}' | awk -F/ '{print $$2}')
14 APACHE_VERSION_MAIN = $(word 1, $(subst ., ,$(APACHE_VERSION)))
15 APACHE_VERSION_SUB = $(word 2, $(subst ., ,$(APACHE_VERSION)))
16 APACHE_24_OR_NEWER = $(shell [ $(APACHE_VERSION_MAIN) -ge 2 -a $(APACHE_VERSION_SUB) -ge 4 ] && echo 1 || echo 0)
18 APACHE_MODULES=
19 APACHE_MODULES_INSTALL=
20 APACHE_FCGID_PATH=$(MODULE_DIR)/$(APACHE_FCGID_MODULE)
21 CENTOS_WORKAROUND=0
22 INSTALL_FCGID=0
23 REPLACE_PHP_FCGI_BIN=$(PHP_FCGI_BIN)
25 # Try to find the apxs binary
26 APXS=/usr/sbin/apxs
27 ifeq ("$(wildcard $(APXS))","")
28 APXS=apxs
29 endif
30 ifneq ("$(wildcard /usr/sbin/apxs2)","")
31 APXS=/usr/sbin/apxs2
32 endif
34 VERSIONLT7 := $(shell expr $(DISTRO_VERSION) \<= 7)
35 ifeq ($(DISTRO_NAME),CENTOS)
36 ifeq ($(VERSIONLT7), 1)
37 CENTOS_WORKAROUND=1
38 endif
39 endif
40 ifeq ($(DISTRO_NAME),REDHAT)
41 ifeq ($(VERSIONLT7), 1)
42 CENTOS_WORKAROUND=1
43 endif
44 endif
45 ifneq (,$(findstring 11SP,$(DISTRO_VERSION)))
46 INSTALL_FCGID=1
47 endif
49 ifeq ($(CENTOS_WORKAROUND), 1)
50 # workaround for centos/rh which ignores "php-cgi -d settings"
51 REPLACE_PHP_FCGI_BIN=$(PHP_FCGI_BIN) -c $(OMD_ROOT)/etc/apache/php.ini
52 INSTALL_FCGID=1
53 endif
55 ifeq ($(INSTALL_FCGID), 1)
56 APACHE_MODULES=modfcgid
57 APACHE_MODULES_INSTALL=modfcgid_install
58 APACHE_FCGID_PATH=$(OMD_ROOT)/lib/apache/mod_fcgid.so
59 endif
61 .PHONY: skel
63 build: $(APACHE_MODULES)
64 # Unpack source code, apply patches, call configure, call make
66 install: $(APACHE_MODULES_INSTALL)
67 # Install software below $(DESTDIR)$(OMD_ROOT)/{bin,lib,share}
68 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/omd
69 if [ $(APACHE_24_OR_NEWER) -eq 1 ]; then \
70 install -m 644 apache24.conf $(DESTDIR)$(OMD_ROOT)/share/omd/apache.conf; \
71 else \
72 install -m 644 apache.conf $(DESTDIR)$(OMD_ROOT)/share/omd/apache.conf; \
75 skel:
76 if [ $(CENTOS_WORKAROUND) -eq 1 ]; then \
77 cp /etc/php.ini $(SKEL)/etc/apache/php.ini || exit 1; \
78 echo -e "\n\n; OMD OMD OMD OMD OMD OMD\n\nmemory_limit=64M\n\n[Session]\nsession.save_path=###ROOT###/tmp/php/session\nupload_tmp_dir=###ROOT###/tmp/php/upload\nsoap.wsdl_cache_dir=###ROOT###/tmp/php/wsdl-cache\n" >> $(SKEL)/etc/apache/php.ini; \
81 # install a custom apache configuration for apache 2.4 or later
82 if [ $(APACHE_24_OR_NEWER) -eq 1 ]; then \
83 mv $(SKEL)/etc/apache/apache24.conf $(SKEL)/etc/apache/apache.conf ; \
84 else \
85 rm $(SKEL)/etc/apache/apache24.conf ; \
88 # Replace macros
89 sed -i -e 's|###APACHE_MODULE_DIR###|$(MODULE_DIR)|g' \
90 $(SKEL)/etc/apache/apache.conf
92 # SLES12 has apache 2.4 but does not have the prefork module to be loaded,
93 # so remove this load line for this distro from the apache config
94 if [ ! -e $(MODULE_DIR)/mod_mpm_prefork.so ]; then \
95 sed -i '/^LoadModule mpm_prefork_module/d' $(SKEL)/etc/apache/apache.conf ; \
98 sed -i -e 's|###APACHE_FCGID_MODULE###|$(APACHE_FCGID_PATH)|g' \
99 $(SKEL)/etc/apache/conf.d/02_fcgid.conf
101 sed -i 's|###APACHE_BIN###|$(APACHE_BIN)|g' $(SKEL)/etc/init.d/apache
102 sed -i 's|###PHP_FCGI_BIN###|$(PHP_FCGI_BIN)|g' $(SKEL)/etc/init.d/apache
103 sed -i 's|###PHP_FCGI_BIN###|$(REPLACE_PHP_FCGI_BIN)|g' $(SKEL)/etc/apache/php-wrapper
104 # Create working directories
105 mkdir -p $(SKEL)/var/log/apache
106 mkdir -p $(SKEL)/var/www
107 mkdir -p $(SKEL)/tmp/apache/run
108 mkdir -p $(SKEL)/tmp/apache/fcgid_sock
109 mkdir -p $(SKEL)/tmp/php/session
110 mkdir -p $(SKEL)/tmp/php/upload
111 mkdir -p $(SKEL)/tmp/php/wsdl-cache
113 clean:
114 # Remove files created by build/install
115 rm -rf $(FCGI_FILE)
117 modfcgid:
118 tar zxf $(FCGI_FILE).tar.gz
119 cd $(FCGI_FILE) && patch -p1 < ../patches/0001-fcgid_proc_unix.c.patch
120 cd $(FCGI_FILE) && patch -p1 < ../patches/0002-fcgid_pm_unix.c.patch
121 cd $(FCGI_FILE) && APXS=$(APXS) ./configure.apxs
122 CPATH="/usr/include/apache2-worker" $(MAKE) -C $(FCGI_FILE)
124 modfcgid_install:
125 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/apache
126 cp $(FCGI_FILE)/modules/fcgid/.libs/mod_fcgid.so $(DESTDIR)$(OMD_ROOT)/lib/apache/