670be1cce4d97f408c0581e6f30007bcbc022d83
[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 VserverReference: $(filter-out vserver-reference,$(ALL))
302
303 # ... and the groups manifest
304 VserverReference: RPMS/yumgroups.xml
305
306
307 #
308 # BootManager
309 #
310
311 BootManager-MODULE := BootManager build
312 BootManager-SPEC := bootmanager.spec
313 # Package must be built as root
314 BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
315 ALL += BootManager
316
317 #
318 # BootCD
319 #
320
321 BootCD-MODULE := BootCD BootManager build
322 BootCD-SPEC := bootcd.spec
323 BootCD-RPMBUILD := sudo bash ./rpmbuild.sh
324 ALL += BootCD
325
326 #
327 # BootstrapFS
328 #
329
330 BootstrapFS-MODULE := BootstrapFS build
331 BootstrapFS-SPEC := bootstrapfs.spec
332 # Package must be built as root
333 BootstrapFS-RPMBUILD := sudo bash ./rpmbuild.sh
334 ALL += BootstrapFS
335
336 # BootstrapFS requires current packages
337 BootstrapFS: $(filter-out BootstrapFS,$(ALL))
338
339 # ... and the groups manifest
340 BootstrapFS: RPMS/yumgroups.xml
341
342 #
343 # MyPLC
344 #
345
346 MyPLC-MODULE := MyPLC build WWW
347 MyPLC-SPEC := myplc.spec
348 # Package must be built as root
349 MyPLC-RPMBUILD := sudo bash ./rpmbuild.sh
350 ALL += MyPLC
351
352 # MyPLC may require current packages
353 MyPLC: $(filter-out MyPLC,$(ALL))
354
355 # ...and the yum manifest
356 MyPLC: RPMS/yumgroups.xml
357
358
359 #
360 # MyPLC native
361 #
362
363 MyPLC-native-MODULE := MyPLC build WWW
364 MyPLC-native-SPEC := myplc-native.spec
365 # Package must be built as root
366 MyPLC-native-RPMBUILD := sudo bash ./rpmbuild.sh
367 ALL += MyPLC-native
368
369 # MyPLC may require current packages
370 MyPLC-native: $(filter-out MyPLC,$(ALL))
371
372 # ...and the yum manifest
373 MyPLC-native: RPMS/yumgroups.xml
374
375 #
376 # MyPLC development environment
377 #
378
379 MyPLC-devel-MODULE := MyPLC build 
380 MyPLC-devel-SPEC := myplc-devel.spec
381 # Package must be built as root
382 MyPLC-devel-RPMBUILD := sudo bash ./rpmbuild.sh
383 #ALL += MyPLC-devel
384
385 #
386 # MyPLC native development environment
387 #
388
389 MyPLC-devel-native-MODULE := MyPLC
390 MyPLC-devel-native-RPMFLAGS := --define "distroname '$(DISTRO)'" --define "distrorelease $(RELEASE)"
391 MyPLC-devel-native-SPEC := myplc-devel-native.spec
392 ALL += MyPLC-devel-native
393
394 #
395 # libnl
396 #
397 # [daniel]    wait for latest Fedora release 
398 # (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
399 # (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
400 #
401
402 libnl-MODULE := libnl
403 libnl-SPEC := libnl.spec
404 ALL += libnl
405
406 util-vserver: libnl
407
408 RPMS/yumgroups.xml:
409         install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
410
411 #XXX We need to rethink this installation support for several reasons:
412 # 1) it is pldistro specific
413 # 2) may involve installing files for different node groups (e.g., alpha, beta, etc.)
414 # 3) may involve N rpm repositories to where it should be uploaded
415 #
416 # Not clear to me at all that this should be incorporated into a
417 # Makefile at all.  Instead it should be something that gets wrapped
418 # into a myplc (sub) rpm package and then is installed by that way.
419
420 #
421 # Installation rules
422
423
424 # Upload packages to boot server
425 SERVERA := build@boot1.planet-lab.org
426 SERVERB := build@boot2.planet-lab.org
427 ARCHIVE := /plc/data/var/www/html/install-rpms/archive
428
429 # Put nightly alpha builds in a subdirectory
430 ifeq ($(TAG),HEAD)
431 ARCHIVE := $(ARCHIVE)/planetlab-alpha
432 REPOS := /plc/data/var/www/html/install-rpms/planetlab-alpha
433 endif
434
435 install:
436 ifeq ($(BASE),)
437         @echo make install is only meant to be called from ./build.sh
438 else
439 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
440         # Sign all RPMS. setsid detaches rpm from the terminal,
441         # allowing the (hopefully blank) GPG password to be entered
442         # from stdin instead of /dev/tty. Obviously, the build server
443         # should be secure.
444         echo | setsid rpm \
445         --define "_signature gpg" \
446         --define "_gpg_path /etc/planetlab" \
447         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
448         --resign RPMS/*/*.rpm
449 endif
450 ifneq ($(BUILDS),)
451         # Remove old runs
452         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
453         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
454 endif
455         # Create package manifest
456         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
457         # Update yum metadata
458         yum-arch RPMS >/dev/null
459         createrepo -g yumgroups.xml RPMS >/dev/null
460         # Populate repository
461         rsync \
462         --exclude '*-debuginfo-*' \
463         --recursive --links --perms --times --group --compress --rsh=ssh \
464         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
465         rsync \
466         --exclude '*-debuginfo-*' \
467         --recursive --links --perms --times --group --compress --rsh=ssh \
468         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
469 ifeq ($(TAG),HEAD)
470         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
471         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
472             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
473         fi
474         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
475         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
476             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
477         fi
478
479 endif
480 endif
481
482 .PHONY: install