Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / shinken / Makefile
blobd8a97f87ee83f3f93fc395c07b62a888fba2ee4e
1 include ../../Makefile.omd
4 SHINKEN=shinken-1.4.1
5 SHINKEN_FILE=$(SHINKEN).tar.gz
6 SHINKEN_URL=http://shinken-monitoring.org/pub/$(SHINKEN).tar.gz
8 # Python Remote Objects
9 ifeq ($(DISTRO_NAME),CENTOS)
10 ifeq ($(DISTRO_VERSION),$(filter $(DISTRO_VERSION),5.4 5.5 5.6 5.7 5.8 5.9 5.10))
11 PYRO=Pyro-3.12
12 PYRO_FILE=$(PYRO).tar.gz
13 PYRO_URL=https://pypi.python.org/packages/source/P/Pyro/$(PYRO_FILE)
14 else
15 PYRO=Pyro4-4.18
16 PYRO_FILE=$(PYRO).tar.gz
17 PYRO_URL=https://pypi.python.org/packages/source/P/Pyro4/$(PYRO_FILE)
18 endif
19 else
20 PYRO=Pyro4-4.18
21 PYRO_FILE=$(PYRO).tar.gz
22 PYRO_URL=https://pypi.python.org/packages/source/P/Pyro4/$(PYRO_FILE)
23 endif
25 # Python Multiprocessing
26 MP=multiprocessing-2.6.2.1
27 MP_FILE=$(MP).tar.gz
28 MP_URL=http://pypi.python.org/packages/source/m/multiprocessing/$(MP_FILE)
30 # Simple JSON (not included in CentOS' python2.4)
31 ifeq ($(DISTRO_NAME),CENTOS)
32 ifeq ($(DISTRO_VERSION),$(filter $(DISTRO_VERSION),5.4 5.5 5.6 5.7 5.8 5.9 5.10))
33 SJSON=simplejson-2.1.2
34 else
35 SJSON=simplejson-3.3.0
36 endif
37 else
38 SJSON=simplejson-3.3.0
39 endif
40 SJSON_FILE=$(SJSON).tar.gz
41 SJSON_URL=http://pypi.python.org/packages/source/s/simplejson/$(SJSON_FILE)
43 # Setup-Tools (needed to install Pyro on CentOS)
44 STOOLS=setuptools-0.6c11
45 STOOLS_FILE=$(STOOLS).tar.gz
46 STOOLS_URL=http://pypi.python.org/packages/source/s/setuptools/$(STOOLS_FILE)
48 # ctypes is only needed for CentOS and it's Python 2.4
49 CTYPES=ctypes-1.0.2
50 CTYPES_FILE=$(CTYPES).tar.gz
51 CTYPES_URL=http://downloads.sourceforge.net/project/ctypes/ctypes/1.0.2/$(CTYPES_FILE)
53 # Hopefully this is never needed
54 SQLITE=pysqlite-2.6.0
55 SQLITE_FILE=$(SQLITE).tar.gz
56 SQLITE_URL=http://pysqlite.googlecode.com/files/$(SQLITE_FILE)
58 # MongoDB
59 MONGODB=mongodb-linux-i686-2.4.1
60 ifeq ($(shell uname -m),x86_64)
61 MONGODB=mongodb-linux-x86_64-2.4.1
62 endif
63 MONGODB_FILE=$(MONGODB).tgz
64 MONGODB_URL=http://fastdl.mongodb.org/linux/$(MONGODB_FILE)
66 # Python bindings for MongoDB
67 ifeq ($(DISTRO_NAME),CENTOS)
68 ifeq ($(DISTRO_VERSION),$(filter $(DISTRO_VERSION),5.4 5.5 5.6 5.7 5.8 5.9 5.10))
69 PYMONGO=pymongo-2.1.1
70 else
71 PYMONGO=pymongo-2.5.2
72 endif
73 else
74 PYMONGO=pymongo-2.5.2
75 endif
76 PYMONGO_FILE=$(PYMONGO).tar.gz
77 PYMONGO_URL=http://pypi.python.org/packages/source/p/pymongo/$(PYMONGO_FILE)
79 # Hashlib (for Python 2.4)
80 HASHLIB=hashlib-20081119
81 HASHLIB_FILE=$(HASHLIB).tar.gz
82 HASHLIB_URL=http://code.krypto.org/python/hashlib/$(HASHLIB_FILE)
84 # This is where the python modules are going to be installed to
85 LOCALPYTHONDIR=$(DESTDIR)$(OMD_ROOT)/lib/python
87 # Find the directory where python distutils are located
88 PYTHONPATH=
89 export PYTHONPATH
90 RM_DISTU=$(shell rm -rf /tmp/temp_distutils)
91 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]")
92 # This is where the distutils module is temporary copied to
93 TMP_DISTU=/tmp/temp_distutils
94 PYTHONPATH=$(TMP_DISTU):$(LOCALPYTHONDIR)
95 export PYTHONPATH
97 build:
98 test -f ${SHINKEN_FILE} || wget $(SHINKEN_URL)
99 tar xzf $(SHINKEN_FILE)
100 #set -e ; for p in patches/*.patch ; do \
101 # echo "applying $$p..." ; \
102 # ( cd $(SHINKEN) ; patch -p1 -b ) < $$p ; \
103 #done
104 test -f $(PYRO_FILE) || wget $(PYRO_URL)
105 tar xzf $(PYRO_FILE)
106 test -f $(MP_FILE) || wget $(MP_URL)
107 tar xzf $(MP_FILE)
108 test -f $(SJSON_FILE) || wget $(SJSON_URL)
109 tar xzf $(SJSON_FILE)
110 test -f $(STOOLS_FILE) || wget $(STOOLS_URL)
111 tar xzf $(STOOLS_FILE)
112 test -f $(CTYPES_FILE) || wget $(CTYPES_URL)
113 tar xzf $(CTYPES_FILE)
114 test -f $(PYMONGO_FILE) || wget $(PYMONGO_URL)
115 tar xzf $(PYMONGO_FILE)
116 test -f $(MONGODB_FILE) || wget $(MONGODB_URL)
117 tar xzf $(MONGODB_FILE)
118 test -f $(HASHLIB_FILE) || wget $(HASHLIB_URL)
119 tar xzf $(HASHLIB_FILE)
120 #test -f $(SQLITE_FILE) || wget $(SQLITE_URL)
121 #tar xzf $(SQLITE_FILE)
122 if [ $(DISTRO_NAME) = "CENTOS" ] && [ \
123 $(DISTRO_VERSION) = "5.4" -o \
124 $(DISTRO_VERSION) = "5.5" -o \
125 $(DISTRO_VERSION) = "5.6" -o\
126 $(DISTRO_VERSION) = "5.7" -o \
127 $(DISTRO_VERSION) = "5.8" -o \
128 $(DISTRO_VERSION) = "5.9" -o \
129 $(DISTRO_VERSION) = "5.10" ]; then \
130 echo it is a centos 5; \
131 echo which has python 2.4; \
132 echo we need to remove the shinken webui; \
133 rm -f $(SHINKEN)/shinken/modules/active_directory_ui.py; \
137 install:
138 rm -rf $(TMP_DISTU)
139 mkdir -p $(LOCALPYTHONDIR)
140 $(MAKE) installshinken
141 $(MAKE) repairdistutils
142 $(MAKE) installstools
143 $(MAKE) installpyro
144 $(MAKE) installmp
145 $(MAKE) installjson
146 $(MAKE) installpymongo
147 $(MAKE) installmongodb
148 echo "distro is " $(DISTRO_NAME)
149 if [ $(DISTRO_NAME) = "CENTOS" ]; then \
150 $(MAKE) installctypes; \
151 $(MAKE) installhashlib; \
153 #$(MAKE) installsqlite
154 rm -rf $(TMP_DISTU)
155 # cleanup the tmp directory
156 for tmpfile in $(DESTDIR)$(OMD_ROOT)/tmp/easy_install* ; do \
157 rm -f $$tmpfile ; \
158 done
159 for tmpfile in $(DESTDIR)$(OMD_ROOT)/tmp/pyro-* ; do \
160 rm -f $$tmpfile ; \
161 done
164 installshinken:
165 # bin/shinken-* startfiles
166 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
167 install -m 755 $(SHINKEN)/bin/shinken-arbiter $(DESTDIR)$(OMD_ROOT)/bin
168 install -m 755 $(SHINKEN)/bin/shinken-broker $(DESTDIR)$(OMD_ROOT)/bin
169 install -m 755 $(SHINKEN)/bin/shinken-scheduler $(DESTDIR)$(OMD_ROOT)/bin
170 install -m 755 $(SHINKEN)/bin/shinken-poller $(DESTDIR)$(OMD_ROOT)/bin
171 install -m 755 $(SHINKEN)/bin/shinken-reactionner $(DESTDIR)$(OMD_ROOT)/bin
172 install -m 755 $(SHINKEN)/bin/shinken-admin $(DESTDIR)$(OMD_ROOT)/bin
173 install -m 755 $(SHINKEN)/bin/shinken-receiver $(DESTDIR)$(OMD_ROOT)/bin
175 # shinken py-files
176 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/shinken
177 cp -r $(SHINKEN)/shinken $(DESTDIR)$(OMD_ROOT)/lib/shinken
179 install -m 755 $(SHINKEN)/bin/shinken-discovery $(DESTDIR)$(OMD_ROOT)/bin
180 cp -r $(SHINKEN)/libexec $(DESTDIR)$(OMD_ROOT)/lib/shinken
182 install -m 755 merge-shinken-config $(DESTDIR)$(OMD_ROOT)/bin
183 install -m 755 merge-shinken-specific-config $(DESTDIR)$(OMD_ROOT)/bin
186 repairdistutils:
187 mkdir $(TMP_DISTU)
188 cp -r $(DISTUTILS) $(TMP_DISTU)
189 # SuSE prevents installation of modules to private locations
190 rm -f /tmp/temp_distutils/distutils/distutils.cfg
191 # No longer...
194 installstools:
195 ( cd $(STOOLS) ; python setup.py install \
196 --home=$(DESTDIR)$(OMD_ROOT) \
197 --install-platlib=$(LOCALPYTHONDIR) \
198 --install-purelib=$(LOCALPYTHONDIR) \
199 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
200 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
203 installpyro:
204 ( cd $(PYRO) ; python setup.py install \
205 --home=$(DESTDIR)$(OMD_ROOT) \
206 --install-platlib=$(LOCALPYTHONDIR) \
207 --install-purelib=$(LOCALPYTHONDIR) \
208 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
209 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
212 installmp:
213 ( cd $(MP) ; python setup.py install \
214 --home=$(DESTDIR)$(OMD_ROOT) \
215 --install-platlib=$(LOCALPYTHONDIR) \
216 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
217 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
220 installsqlite:
221 ( cd $(SQLITE) ; python setup.py install \
222 --home=$(DESTDIR)$(OMD_ROOT) \
223 --install-platlib=$(LOCALPYTHONDIR) \
224 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
225 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
228 installjson:
229 ( cd $(SJSON) ; python setup.py install \
230 --home=$(DESTDIR)$(OMD_ROOT) \
231 --install-platlib=$(LOCALPYTHONDIR) \
232 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
233 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
236 installctypes:
237 ( cd $(CTYPES) ; python setup.py install \
238 --home=$(DESTDIR)$(OMD_ROOT) \
239 --install-platlib=$(LOCALPYTHONDIR) \
240 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
241 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
243 installpymongo:
244 ( cd $(PYMONGO) ; python setup.py install \
245 --home=$(DESTDIR)$(OMD_ROOT) \
246 --install-platlib=$(LOCALPYTHONDIR) \
247 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
248 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
250 installhashlib:
251 ( cd $(HASHLIB) ; python setup.py install \
252 --home=$(DESTDIR)$(OMD_ROOT) \
253 --install-platlib=$(LOCALPYTHONDIR) \
254 --install-scripts=$(DESTDIR)$(OMD_ROOT)/tmp \
255 --install-data=$(DESTDIR)$(OMD_ROOT)/tmp )
257 installmongodb:
258 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
259 install -m 755 $(MONGODB)/bin/mongod $(DESTDIR)$(OMD_ROOT)/bin
260 install -m 755 $(MONGODB)/bin/mongo $(DESTDIR)$(OMD_ROOT)/bin
263 clean:
264 rm -rf $(SHINKEN)
265 rm -rf $(PYRO)
266 rm -rf $(MP)
267 rm -rf $(SJSON)
268 rm -rf $(STOOLS)
269 rm -rf $(CTYPES)
270 rm -rf $(SQLITE)
271 rm -rf $(PYMONGO)
272 rm -rf $(MONGODB)
273 rm -rf $(HASHLIB)