check_logfiles: 3.7.5.1
[omd.git] / packages / shinken / Makefile
blob1c4aa1c2910d7d5a5d29084f09630e2a5becbfb5
1 include ../../Makefile.omd
3 PYTHON = LD_LIBRARY_PATH=$(shell pwd)/../python/tmp.python27/lib \
4 $(shell pwd)/../python/tmp.python27/bin/python
6 SHINKEN=shinken-1.4.1
7 SHINKEN_FILE=$(SHINKEN).tar.gz
8 SHINKEN_URL=http://shinken-monitoring.org/pub/$(SHINKEN).tar.gz
10 # Python Remote Objects
11 PYRO=Pyro4-4.18
12 PYRO_FILE=$(PYRO).tar.gz
13 PYRO_URL=https://pypi.python.org/packages/source/P/Pyro4/$(PYRO_FILE)
15 # Simple JSON (not included in CentOS' python2.4)
16 SJSON=simplejson-3.3.0
17 SJSON_FILE=$(SJSON).tar.gz
18 SJSON_URL=http://pypi.python.org/packages/source/s/simplejson/$(SJSON_FILE)
20 # MongoDB
21 ifeq ($(shell uname -m),x86_64)
22 MONGODB=mongodb-linux-x86_64-2.4.1
23 else ifeq ($(shell uname -m),$(filter $(shell uname -m),i386 i486 i586 i686))
24 MONGODB=mongodb-linux-i686-2.4.1
25 else ifeq ($(shell uname -m),armv7l)
26 # http://andyfelong.com/2015/02/mongodb-on-the-raspberry-pi-2/
27 MONGODB=mongodb-linux-armv7l-2.6.3
28 else ifeq ($(shell uname -m),armv6l)
29 MONGODB=mongodb-linux-armv6l-2012-09-16
30 endif
31 MONGODB_FILE=$(MONGODB).tgz
32 MONGODB_URL=http://fastdl.mongodb.org/linux/$(MONGODB_FILE)
34 # Python bindings for MongoDB
35 PYMONGO=pymongo-2.5.2
36 PYMONGO_FILE=$(PYMONGO).tar.gz
37 PYMONGO_URL=http://pypi.python.org/packages/source/p/pymongo/$(PYMONGO_FILE)
39 # This is where the python modules are going to be installed to
40 LOCALPYTHONDIR=$(DESTDIR)$(OMD_ROOT)/lib/python
42 # Find the directory where python distutils are located
43 PYTHONPATH=
44 export PYTHONPATH
45 DISTUTILS=$(shell $(PYTHON) -c "import sys; import os; print [os.path.join(p, 'distutils') for p in sys.path if os.path.exists(os.path.join(p, 'distutils'))][0]")
46 # This is where the distutils module is temporary copied to
47 TMP_DISTU=$(shell pwd)/temp_distutils
48 PYTHONPATH=$(TMP_DISTU):$(LOCALPYTHONDIR)
49 export PYTHONPATH
51 build: check-python
52 test -f ${SHINKEN_FILE} || wget $(SHINKEN_URL)
53 tar xzf $(SHINKEN_FILE)
54 #set -e ; for p in patches/*.patch ; do \
55 # echo "applying $$p..." ; \
56 # ( cd $(SHINKEN) ; patch -p1 -b ) < $$p ; \
57 #done
58 test -f $(PYRO_FILE) || wget $(PYRO_URL)
59 tar xzf $(PYRO_FILE)
60 test -f $(SJSON_FILE) || wget $(SJSON_URL)
61 tar xzf $(SJSON_FILE)
62 test -f $(PYMONGO_FILE) || wget $(PYMONGO_URL)
63 tar xzf $(PYMONGO_FILE)
64 test -f $(MONGODB_FILE) || wget $(MONGODB_URL)
65 tar xzf $(MONGODB_FILE)
67 check-python:
68 @if [ ! -d ../python/tmp.python27 ]; then \
69 echo "ERROR: You need to build the \"python\" package first" ; \
70 exit 1 ; \
73 install:
74 rm -rf $(TMP_DISTU)
75 mkdir -p $(LOCALPYTHONDIR)
76 $(MAKE) installshinken
77 $(MAKE) repairdistutils
78 $(MAKE) PKG=$(PYRO) installmodule
79 $(MAKE) PKG=$(SJSON) installmodule
80 $(MAKE) PKG=$(PYMONGO) installmodule
81 $(MAKE) installmongodb
82 rm -rf $(TMP_DISTU)
83 # cleanup the tmp directory
84 for tmpfile in $(DESTDIR)$(OMD_ROOT)/tmp/easy_install* ; do \
85 rm -f $$tmpfile ; \
86 done
87 for tmpfile in $(DESTDIR)$(OMD_ROOT)/tmp/pyro-* ; do \
88 rm -f $$tmpfile ; \
89 done
92 installshinken:
93 # bin/shinken-* startfiles
94 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
95 install -m 755 $(SHINKEN)/bin/shinken-arbiter $(DESTDIR)$(OMD_ROOT)/bin
96 install -m 755 $(SHINKEN)/bin/shinken-broker $(DESTDIR)$(OMD_ROOT)/bin
97 install -m 755 $(SHINKEN)/bin/shinken-scheduler $(DESTDIR)$(OMD_ROOT)/bin
98 install -m 755 $(SHINKEN)/bin/shinken-poller $(DESTDIR)$(OMD_ROOT)/bin
99 install -m 755 $(SHINKEN)/bin/shinken-reactionner $(DESTDIR)$(OMD_ROOT)/bin
100 install -m 755 $(SHINKEN)/bin/shinken-admin $(DESTDIR)$(OMD_ROOT)/bin
101 install -m 755 $(SHINKEN)/bin/shinken-receiver $(DESTDIR)$(OMD_ROOT)/bin
103 # shinken py-files
104 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/shinken
105 cp -r $(SHINKEN)/shinken $(DESTDIR)$(OMD_ROOT)/lib/shinken
107 install -m 755 $(SHINKEN)/bin/shinken-discovery $(DESTDIR)$(OMD_ROOT)/bin
108 cp -r $(SHINKEN)/libexec $(DESTDIR)$(OMD_ROOT)/lib/shinken
110 install -m 755 merge-shinken-config $(DESTDIR)$(OMD_ROOT)/bin
111 install -m 755 merge-shinken-specific-config $(DESTDIR)$(OMD_ROOT)/bin
114 repairdistutils:
115 mkdir -p $(TMP_DISTU)
116 cp -r $(DISTUTILS) $(TMP_DISTU)
117 # SuSE prevents installation of modules to private locations
118 rm -f /tmp/temp_distutils/distutils/distutils.cfg
119 # No longer...
122 installmodule:
123 ( cd $(PKG) ; \
124 export PYTHONPATH=$$PYTHONPATH:$(DESTDIR)$(OMD_ROOT)/lib/python ; \
125 export PYTHONPATH=$$PYTHONPATH:$(shell pwd)/../python/tmp.python27/lib/python2.7 ; \
126 export PYTHONPATH=$$PYTHONPATH:$(shell pwd)/../python-modules/tmp.python/lib/python2.7 ; \
127 export LDFLAGS="-L$(shell pwd)/../python/tmp.python27/lib -L$(shell pwd)/../python/tmp.python27/lib/python2.7/config" ; \
128 $(PYTHON) setup.py install \
129 --prefix="" \
130 --home=$(DESTDIR)$(OMD_ROOT) \
131 --install-platlib=$(LOCALPYTHONDIR) \
132 --install-purelib=$(LOCALPYTHONDIR) \
133 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
134 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
137 installmongodb:
138 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
139 install -m 755 $(MONGODB)/bin/mongod $(DESTDIR)$(OMD_ROOT)/bin
140 install -m 755 $(MONGODB)/bin/mongo $(DESTDIR)$(OMD_ROOT)/bin
143 clean:
144 rm -rf $(SHINKEN)
145 rm -rf $(PYRO)
146 rm -rf $(SJSON)
147 rm -rf $(PYMONGO)
148 rm -rf $(MONGODB)