902bfe8e8795ffa302e2e56ea04d9efb7bd4bf2c
[build.git] / planetlab.mk
1 #
2 # PlanetLab standard components list
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2003-2006 The Trustees of Princeton University
6 #
7 # $Id: planetlab.mk,v 1.71 2007/09/25 18:38:47 faiyaza Exp $
8 #
9
10 #
11 # Required:
12 #
13 # CVSROOT or package-CVSROOT: CVSROOT to use
14 # or
15 # SVNPATH or package-SVNPATH: SVNPATH to use
16 # Note: do not define both CVSROOT and SVNPATH
17 #
18 # TAG or package-TAG: CVS/SVN tag to use
19 # package-MODULE: CVS/SVN module name to use
20 # package-SPEC: RPM spec file template
21 #
22 # Optional:
23 #
24 # package-RPMFLAGS: Miscellaneous RPM flags
25 # package-RPMBUILD: If not rpmbuild
26 # package-CVS_RSH: If not ssh for cvs
27 #
28 # Add to ALL if you want the package built as part of the default set.
29 #
30
31 #
32 # Default values -- should be able to override these from command line
33 #
34
35 HOSTARCH := $(shell uname -i)
36 DISTRO := $(shell ./getdistro.sh)
37 RELEASE := $(shell ./getrelease.sh)
38
39 #
40 # load in a release specific tags file
41 # Override TAGSFILE from command line to select something else
42 #
43 TAGSFILE = default-tags.mk
44 include $(TAGSFILE)
45
46
47 #
48 # kernel
49 #
50
51 kernel-$(HOSTARCH)-MODULE := Linux-2.6
52 kernel-$(HOSTARCH)-SPEC := scripts/kernel-2.6-planetlab.spec
53 ifeq ($(HOSTARCH),i386)
54 kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
55 else
56 kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
57 endif
58
59 ALL += kernel-$(HOSTARCH)
60
61 kernel-clean: kernel-$(HOSTARCH)-clean
62 kernel: kernel-$(HOSTARCH)
63
64 #
65 # util-vserver
66 #
67
68 util-vserver-MODULE := util-vserver
69 util-vserver-SPEC := util-vserver.spec
70 util-vserver-RPMFLAGS:= --without dietlibc
71 ALL += util-vserver
72
73 #
74 # NodeUpdate
75 #
76
77 NodeUpdate-MODULE := NodeUpdate
78 NodeUpdate-SPEC := NodeUpdate.spec
79 ALL += NodeUpdate
80
81 #
82 # PlanetLabConf:  DEPRECATED.  
83 #
84 # conf_files does the same thing in NM
85 #
86
87 #PlanetLabConf-MODULE := PlanetLabConf
88 #PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
89 #ALL += PlanetLabConf
90
91 #
92 # ipod
93 #
94
95 PingOfDeath-MODULE := PingOfDeath
96 PingOfDeath-SPEC := ipod.spec
97 ALL += PingOfDeath
98
99 #
100 # sudo:  DEPRECATED
101 #
102 # Added functionality provided by this package to www/PlanetLabConf/sudoers.
103 #
104
105 #sudo-MODULE := sudo
106 #sudo-SPEC := sudo/planetlab_sudo.spec
107 #ALL += sudo
108
109 #
110 # pycurl:  DEPRECATE
111 #
112 # [tony] use FC6+ release
113 #
114
115 #curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
116 #pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
117 #pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
118 #ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
119 #ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
120 #pycurl-MODULE := pycurl
121 #pycurl-SPEC := pycurl/pycurl.spec
122 #ALL += pycurl
123 #endif
124 #endif
125
126 #
127 # BootServerRequest:  DEPRECATE
128 #
129 # Not used by anything.
130 #
131
132 #BootServerRequest-MODULE := BootServerRequest
133 #BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
134 #ALL += BootServerRequest
135 #
136 #
137 #
138 # Node Manager
139 #
140
141 NodeManager-MODULE := NodeManager
142 NodeManager-SPEC := NodeManager.spec
143 ALL += NodeManager
144
145 #
146 # pl_sshd
147 #
148
149 pl_sshd-MODULE := pl_sshd
150 pl_sshd-SPEC := pl_sshd.spec
151 ALL += pl_sshd
152
153 #
154 # libhttpd++: 
155 #
156 # Deprecate when vsys takes over [sapan].
157 # keep in build for proper.
158 #
159
160 libhttpd++-MODULE := libhttpd++
161 libhttpd++-SPEC := libhttpd++.spec
162 ALL += libhttpd++
163
164 #
165 # Proper: Privileged Operations Service
166 #
167
168 proper-MODULE := proper
169 proper-SPEC := proper.spec
170 proper-RPMBUILD := sudo bash ./rpmbuild.sh
171 ALL += proper
172
173 proper: libhttpd++
174
175 #
176 # CoDemux: Port 80 demux
177 #
178
179 CoDemux-MODULE := CoDemux
180 CoDemux-SPEC   := codemux.spec
181 CoDemux-RPMBUILD := sudo bash ./rpmbuild.sh
182 ALL += CoDemux
183
184 #
185 # MySQL
186 #
187
188 mysql-MODULE := mysql
189 mysql-SPEC := mysql.spec
190 #ALL += mysql
191
192 #
193 # ulogd
194 #
195
196 ulogd-MODULE := ulogd
197 ulogd-SPEC := ulogd.spec
198 ALL += ulogd
199
200 ulogd: kernel proper #mysql
201
202 #
203 # netflow
204 #
205
206 PlanetFlow-MODULE := PlanetFlow
207 PlanetFlow-RPMFLAGS := --define "distroname '$(DISTRO)'" --define "distrorelease $(RELEASE)"
208 PlanetFlow-SPEC := netflow.spec
209 ALL += PlanetFlow
210
211 PlanetFlow: #mysql
212
213 #
214 # PlanetLab Mom: Cleans up your mess
215 #
216
217 Mom-MODULE := Mom
218 Mom-SPEC := pl_mom.spec
219 ALL += Mom
220
221 #
222 # iptables
223 #
224
225 iptables-MODULE := iptables
226 iptables-SPEC := iptables.spec
227 ALL += iptables
228
229 iptables: kernel
230
231 #
232 # iproute
233 #
234
235 iproute-MODULE := iproute2
236 iproute-SPEC := iproute.spec
237 ALL += iproute
238
239 #
240 # kexec-tools:  DEPRECATE
241 #
242 # [marc]    use FC6+ release
243 #
244
245 #kexec-tools-MODULE := kexec-tools
246 #kexec-tools-SPEC := kexec-tools/kexec-tools.spec
247 #ALL += kexec-tools
248
249 #
250 # util-python
251 #
252 # [marc]    deprecate with proper
253 #
254
255 util-python-MODULE := util-python
256 util-python-SPEC := util-python.spec
257 ALL += util-python
258
259 # proper uses scripts in util-python for building
260 proper: util-python
261
262 #
263 # vsys
264 #
265 vsys-MODULE := vsys
266 vsys-SPEC := vsys.spec
267 ifeq ($(DISTRO),"Fedora")
268 ifeq ($(RELEASE),7)
269 ALL += vsys
270 endif
271 endif
272
273
274 #
275 # PLCAPI
276 #
277
278 PLCAPI-MODULE := PLCAPI
279 PLCAPI-SPEC := PLCAPI.spec
280 ALL += PLCAPI
281
282 #
283 # PLCWWW
284 #
285
286 PLCWWW-MODULE := WWW
287 PLCWWW-SPEC := PLCWWW.spec
288 ALL += PLCWWW
289
290 #
291 # vserver-reference
292 #
293
294 VserverReference-MODULE := VserverReference build
295 VserverReference-SPEC := vserver-reference.spec
296 # Package must be built as root
297 VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
298 ALL += VserverReference
299
300 # vserver-reference may require current packages
301 vserver-reference: $(filter-out vserver-reference,$(ALL))
302
303 #
304 # BootManager
305 #
306
307 BootManager-MODULE := BootManager build
308 BootManager-SPEC := bootmanager.spec
309 # Package must be built as root
310 BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
311 ALL += BootManager
312
313 # BootManager requires current packages
314 BootManager: $(filter-out BootManager,$(ALL))
315
316 # ...and the yum manifest
317 BootManager: RPMS/yumgroups.xml
318
319 #
320 # BootCD
321 #
322
323 BootCD-MODULE := BootCD BootManager build
324 BootCD-SPEC := bootcd.spec
325 BootCD-RPMBUILD := sudo bash ./rpmbuild.sh
326 ALL += BootCD
327
328 # BootCD requires current packages
329 # BootCD: $(filter-out BootCD,$(ALL))
330
331 #
332 # MyPLC
333 #
334
335 MyPLC-MODULE := MyPLC build WWW
336 MyPLC-SPEC := myplc.spec
337 # Package must be built as root
338 MyPLC-RPMBUILD := sudo bash ./rpmbuild.sh
339 ALL += MyPLC
340
341 # MyPLC may require current packages
342 MyPLC: $(filter-out MyPLC,$(ALL))
343
344 # ...and the yum manifest
345 MyPLC: RPMS/yumgroups.xml
346
347
348 #
349 # MyPLC native
350 #
351
352 MyPLC-native-MODULE := MyPLC build WWW
353 MyPLC-native-SPEC := myplc-native.spec
354 # Package must be built as root
355 MyPLC-native-RPMBUILD := sudo bash ./rpmbuild.sh
356 ALL += MyPLC-native
357
358 # MyPLC may require current packages
359 MyPLC-native: $(filter-out MyPLC,$(ALL))
360
361 # ...and the yum manifest
362 MyPLC-native: RPMS/yumgroups.xml
363
364 #
365 # MyPLC development environment
366 #
367
368 MyPLC-devel-MODULE := MyPLC build 
369 MyPLC-devel-SPEC := myplc-devel.spec
370 # Package must be built as root
371 MyPLC-devel-RPMBUILD := sudo bash ./rpmbuild.sh
372 #ALL += MyPLC-devel
373
374 #
375 # MyPLC native development environment
376 #
377
378 MyPLC-devel-native-MODULE := MyPLC
379 MyPLC-devel-native-RPMFLAGS := --define "distroname '$(DISTRO)'" --define "distrorelease $(RELEASE)"
380 MyPLC-devel-native-SPEC := myplc-devel-native.spec
381 ALL += MyPLC-devel-native
382
383 #
384 # libnl
385 #
386 # [daniel]    wait for latest Fedora release 
387 # (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
388 # (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
389 #
390
391 libnl-MODULE := libnl
392 libnl-SPEC := libnl.spec
393 ALL += libnl
394
395 util-vserver: libnl
396
397 RPMS/yumgroups.xml:
398         install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
399
400 #XXX We need to rethink this installation support for several reasons:
401 # 1) it is pldistro specific
402 # 2) may involve installing files for different node groups (e.g., alpha, beta, etc.)
403 # 3) may involve N rpm repositories to where it should be uploaded
404 #
405 # Not clear to me at all that this should be incorporated into a
406 # Makefile at all.  Instead it should be something that gets wrapped
407 # into a myplc (sub) rpm package and then is installed by that way.
408
409 #
410 # Installation rules
411
412
413 # Upload packages to boot server
414 SERVERA := build@boot1.planet-lab.org
415 SERVERB := build@boot2.planet-lab.org
416 ARCHIVE := /plc/data/var/www/html/install-rpms/archive
417
418 # Put nightly alpha builds in a subdirectory
419 ifeq ($(TAG),HEAD)
420 ARCHIVE := $(ARCHIVE)/planetlab-alpha
421 REPOS := /plc/data/var/www/html/install-rpms/planetlab-alpha
422 endif
423
424 install:
425 ifeq ($(BASE),)
426         @echo make install is only meant to be called from ./build.sh
427 else
428 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
429         # Sign all RPMS. setsid detaches rpm from the terminal,
430         # allowing the (hopefully blank) GPG password to be entered
431         # from stdin instead of /dev/tty. Obviously, the build server
432         # should be secure.
433         echo | setsid rpm \
434         --define "_signature gpg" \
435         --define "_gpg_path /etc/planetlab" \
436         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
437         --resign RPMS/*/*.rpm
438 endif
439 ifneq ($(BUILDS),)
440         # Remove old runs
441         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
442         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
443 endif
444         # Create package manifest
445         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
446         # Update yum metadata
447         yum-arch RPMS >/dev/null
448         createrepo -g yumgroups.xml RPMS >/dev/null
449         # Populate repository
450         rsync \
451         --exclude '*-debuginfo-*' \
452         --recursive --links --perms --times --group --compress --rsh=ssh \
453         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
454         rsync \
455         --exclude '*-debuginfo-*' \
456         --recursive --links --perms --times --group --compress --rsh=ssh \
457         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
458 ifeq ($(TAG),HEAD)
459         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
460         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
461             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
462         fi
463         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
464         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
465             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
466         fi
467
468 endif
469 endif
470
471 .PHONY: install