Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / mod_python / Makefile
blobc87e7b5090f8693c4c808d838b9022f3bac460e2
1 include ../../Makefile.omd
3 NAME = mod_python
4 VERSION = 3.3.1
5 DIR = $(NAME)-$(VERSION)
6 PYTHON = $(shell pwd)/../python/tmp.python27/bin/python
8 CONFIGUREOPTS = \
9 --prefix=$(OMD_ROOT) \
10 --with-python=$(PYTHON)
12 APACHE_VERSION = $(shell $(APACHE_BIN) -v | awk '/version/ {print $$3}' | awk -F/ '{print $$2}')
13 APACHE_VERSION_MAIN = $(word 1, $(subst ., ,$(APACHE_VERSION)))
14 APACHE_VERSION_SUB = $(word 2, $(subst ., ,$(APACHE_VERSION)))
16 build: check-python
17 tar xzf $(DIR).tar.gz
18 set -e ; for p in patches/*.dif ; do \
19 echo "applying $$p..." ; \
20 ( cd $(DIR) ; patch -p1 -b ) < $$p ; \
21 done
23 # Apply special patch for apache >= 2.4
24 if [ $(APACHE_VERSION_MAIN) -ge 2 -a $(APACHE_VERSION_SUB) -ge 4 ]; then \
25 echo "applying patches/0008-apache24.patch..." ; \
26 ( cd $(DIR) ; patch -p1 -b ) < patches/0008-apache24.patch ; \
29 export LD_LIBRARY_PATH=$(shell pwd)/../python/tmp.python27/lib ; \
30 export LDFLAGS="-L$(shell pwd)/../python/tmp.python27/lib -L$(shell pwd)/../python/tmp.python27/lib/python2.7/config" ; \
31 cd $(DIR) ; \
32 ./configure $(CONFIGUREOPTS) ; \
33 echo '#define OMD_VERSION "$(OMD_VERSION)"' > src/omd_version.h ; \
34 $(MAKE) all
36 check-python:
37 @if [ ! -d ../python/tmp.python27 ]; then \
38 echo "ERROR: You need to build the \"python\" package first" ; \
39 exit 1 ; \
42 install:
43 # Use 'make install' of mod_python into a temporary file.
44 # mod_python does not honor --prefix, so we move the stuff over...
45 export LD_LIBRARY_PATH=$(shell pwd)/../python/tmp.python27/lib ; \
46 make DESTDIR=$$(pwd)/tmp.root -C $(DIR) install
48 # Installation directories vary much
49 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/apache/modules
50 MP=$$(find tmp.root -name mod_python.so) ; \
51 install -m 644 $$MP $(DESTDIR)$(OMD_ROOT)/lib/apache/modules
53 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/python/mod_python
54 PYDIR=$$(find tmp.root -name "*egg*" | sed 's@/mod_python.*@@') ; \
55 if [ -z "$$PYDIR" ] ; then PYDIR=$$(find tmp.root/ -name __init__.py | sed 's@/mod_python/__init__.*@@') ; fi ; \
56 install $$PYDIR/mod_python/* $(DESTDIR)$(OMD_ROOT)/lib/python/mod_python ; \
57 if [ -e $$PYDIR/*egg* ] ; then install -m 644 $$PYDIR/*egg* $(DESTDIR)$(OMD_ROOT)/lib/python ; fi
58 rm -rf tmp.root
60 skel:
62 clean:
63 rm -rf $(NAME)-*.*.[0-9] tmp.root