fad48d5cb4ce44fbb0c374b2728e15f2d2bf9ae4
[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
33 #
34
35 #CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
36 #TAG := HEAD
37
38 SVNPATH := https://svn.planet-lab.org/svn
39 TAG := trunk
40
41 # Check if a tag has been checked out
42 ifneq ($(wildcard CVS/Root),)
43 # Check if we are able to access CVS
44 CVSTAG := $(shell cvs status planetlab.mk 2>/dev/null | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
45 ifneq ($(CVSTAG),)
46 CVSROOT := $(shell cat CVS/Root)
47 ifeq ($(CVSTAG),(none))
48 TAG := HEAD
49 else
50 TAG := $(CVSTAG)
51 endif
52 endif
53 endif
54
55 #
56 # kernel
57 #
58
59 # Figure out whether we are building on i386 or x86_64 host
60 HOSTARCH := $(shell uname -i)
61
62 kernel-$(HOSTARCH)-MODULE := linux-2.6
63 kernel-$(HOSTARCH)-SPEC := scripts/kernel-2.6-planetlab.spec
64 ifeq ($(HOSTARCH),i386)
65 kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
66 else
67 kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
68 endif
69
70 ALL += kernel-$(HOSTARCH)
71
72 kernel-clean: kernel-$(HOSTARCH)-clean
73 kernel: kernel-$(HOSTARCH)
74
75
76 ###  Why are we building these??  -F
77 ### madwifi
78 ###
79 ##
80 ###madwifi-ng-MODULE := madwifi-ng
81 ###madwifi-ng-SPEC := madwifi-ng/madwifi.spec
82 ###ALL += madwifi-ng
83 ##
84 ### Build kernel first so we can bootstrap off of its build
85 ###madwifi-ng: kernel
86 ##
87 ###
88 ### ivtv 
89 ###
90 ##
91 ###ivtv-MODULE := ivtv
92 ###ivtv-SPEC := ivtv/ivtv.spec
93 ###ALL += ivtv
94
95 #
96 # util-vserver
97 #
98
99 util-vserver-MODULE := util-vserver
100 util-vserver-SPEC := util-vserver.spec
101 util-vserver-RPMFLAGS:= --without dietlibc
102 ALL += util-vserver
103
104 #
105 # NodeUpdate
106 #
107
108 NodeUpdate-MODULE := NodeUpdate
109 NodeUpdate-SPEC := NodeUpdate.spec
110 ALL += NodeUpdate
111
112 #
113 # PlanetLabConf:  DEPRECATED.  
114 #
115 # conf_files does the same thing in NM
116 #
117
118 #PlanetLabConf-MODULE := PlanetLabConf
119 #PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
120 #ALL += PlanetLabConf
121
122 #
123 # ipod
124 #
125
126 PingOfDeath-MODULE := PingOfDeath
127 PingOfDeath-SPEC := ipod.spec
128 ALL += PingOfDeath
129
130 #
131 # sudo:  DEPRECATED
132 #
133 # Added functionality provided by this package to www/PlanetLabConf/sudoers.
134 #
135
136 #sudo-MODULE := sudo
137 #sudo-SPEC := sudo/planetlab_sudo.spec
138 #ALL += sudo
139
140 #
141 # pycurl:  DEPRECATE
142 #
143 # [tony] use FC6+ release
144 #
145
146 #curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
147 #pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
148 #pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
149 #ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
150 #ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
151 #pycurl-MODULE := pycurl
152 #pycurl-SPEC := pycurl/pycurl.spec
153 #ALL += pycurl
154 #endif
155 #endif
156
157 #
158 # BootServerRequest:  DEPRECATE
159 #
160 # Not used by anything.
161 #
162
163 #BootServerRequest-MODULE := BootServerRequest
164 #BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
165 #ALL += BootServerRequest
166 #
167 #
168 #
169 # Node Manager
170 #
171
172 NodeManager-MODULE := NodeManager
173 NodeManager-SPEC := NodeManager.spec
174 ALL += NodeManager
175
176 #
177 # pl_sshd
178 #
179
180 pl_sshd-MODULE := pl_sshd
181 pl_sshd-SPEC := pl_sshd.spec
182 ALL += pl_sshd
183
184 #
185 # libhttpd++: 
186 #
187 # Deprecate when vsys takes over [sapan].
188 # keep in build for proper.
189 #
190
191 libhttpd++-MODULE := libhttpd++
192 libhttpd++-SPEC := libhttpd++.spec
193 ALL += libhttpd++
194
195 #
196 # Proper: Privileged Operations Service
197 #
198
199 proper-MODULE := proper
200 proper-SPEC := proper.spec
201 proper-RPMBUILD := sudo bash ./rpmbuild.sh
202 ALL += proper
203
204 proper: libhttpd++
205
206 #
207 # CoDemux: Port 80 demux
208 #
209
210 codemux-MODULE := codemux
211 codemux-SPEC   := codemux.spec
212 #ALL += codemux
213
214 #
215 # MySQL
216 #
217
218 mysql-MODULE := mysql
219 mysql-SPEC := mysql.spec
220 #ALL += mysql
221
222 #
223 # ulogd
224 #
225
226 ulogd-MODULE := ulogd
227 ulogd-SPEC := ulogd.spec
228 ALL += ulogd
229
230 ulogd: kernel proper #mysql
231
232 #
233 # netflow
234 #
235
236 NetFlow-MODULE := NetFlow
237 NetFlow-SPEC := netflow.spec
238 ALL += NetFlow
239
240 netflow: #mysql
241
242 #
243 # PlanetLab Mom: Cleans up your mess
244 #
245
246 MoM-MODULE := MoM
247 MoM-SPEC := pl_mom.spec
248 ALL += MoM
249
250 #
251 # iptables
252 #
253
254 iptables-MODULE := iptables
255 iptables-SPEC := iptables.spec
256 ALL += iptables
257
258 iptables: kernel
259
260 #
261 # iproute
262 #
263
264 iproute-MODULE := iproute2
265 iproute-SPEC := iproute.spec
266 ALL += iproute
267
268 #
269 # kexec-tools:  DEPRECATE
270 #
271 # [marc]    use FC6+ release
272 #
273
274 #kexec-tools-MODULE := kexec-tools
275 #kexec-tools-SPEC := kexec-tools/kexec-tools.spec
276 #ALL += kexec-tools
277
278 #
279 # util-python
280 #
281 # [marc]    deprecate server.py
282 #
283 # I dont know what the above means...  Daniel says we need to seperate util-vserver from
284 # pl specific utilities (vuseradd, etc) which may or may not include vserver.py.  Until then,
285 # I'm keeping this in the build.  -F
286 #
287
288 util-python-MODULE := util-python
289 util-python-SPEC := util-python.spec
290 ALL += util-python
291
292 # proper and util-vserver both use scripts in util-python for building
293 # [dhozac]  Not anymore.  util-vserver uses automake and no longer needs util-python
294 proper: util-python
295 #util-vserver: util-python
296 #PlanetLabAuth: util-python
297
298 #
299 # vsys
300 #
301 vsys-MODULE := vsys
302 vsys-SPEC := vsys.spec
303 ALL += vsys
304
305 #
306 # PLCAPI
307 #
308
309 PLCAPI-MODULE := PLCAPI
310 PLCAPI-SPEC := PLCAPI.spec
311 ALL += PLCAPI
312
313 #
314 # PLCWWW
315 #
316
317 PLCWWW-MODULE := WWW
318 PLCWWW-SPEC := PLCWWW.spec
319 ALL += PLCWWW
320
321 #
322 # vserver-reference
323 #
324
325 VserverReference-MODULE := VserverReference build
326 VserverReference-SPEC := vserver-reference.spec
327 # Package must be built as root
328 VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
329 ALL += VserverReference
330
331 # vserver-reference may require current packages
332 vserver-reference: $(filter-out vserver-reference,$(ALL))
333
334 #
335 # BootManager
336 #
337
338 BootManager-MODULE := BootManager build
339 BootManager-SPEC := BootManager.spec
340 BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
341 ALL += BootManager
342
343 # BootManager requires current packages
344 BootManager: $(filter-out BootManager,$(ALL))
345
346 # ...and the yum manifest
347 BootManager: RPMS/yumgroups.xml
348
349 #
350 # BootCD
351 #
352
353 BootCD-MODULE := BootCD build bootmanager
354 BootCD-SPEC := BootCD.spec
355 BootCD-RPMBUILD := sudo bash ./rpmbuild.sh
356 ALL += BootCD
357
358 # BootCD requires current packages
359 BootCD: $(filter-out BootCD,$(ALL))
360
361 #
362 # MyPLC
363 #
364
365 MyPLC-MODULE := MyPLC build new_plc_www plc/scripts
366 MyPLC-SPEC := myplc.spec
367 # Package must be built as root
368 MyPLC-RPMBUILD := sudo bash ./rpmbuild.sh
369 ALL += MyPLC
370
371 # MyPLC may require current packages
372 MyPLC: $(filter-out MyPLC,$(ALL))
373
374 # ...and the yum manifest
375 MyPLC: RPMS/yumgroups.xml
376
377 #
378 # MyPLC development environment
379 #
380
381 myplc-devel-MODULE := MyPLC build 
382 myplc-devel-SPEC := myplc-devel.spec
383 # Package must be built as root
384 myplc-devel-RPMBUILD := sudo bash ./rpmbuild.sh
385 ALL += myplc-devel
386
387 #
388 # MyPLC native
389 #
390
391 myplc-native-MODULE := MyPLC build plc/scripts
392 myplc-native-SPEC := myplc-native.spec
393 # Package must be built as root
394 myplc-native-RPMBUILD := sudo bash ./rpmbuild.sh
395 ALL += myplc-native
396
397 # MyPLC may require current packages
398 myplc-native: $(filter-out MyPLC,$(ALL))
399
400 # ...and the yum manifest
401 myplc-native: RPMS/yumgroups.xml
402
403
404 #
405 # MyPLC native
406 #
407
408 myplc-devel-native-SVNPATH := https://svn.planet-lab.org/svn/MyPLC/trunk
409 myplc-devel-native-MODULE := MyPLC
410 myplc-devel-native-SPEC := myplc-devel-native.spec
411 ALL += myplc-devel-native
412
413 #
414 # libnl
415 #
416 # [daniel]    wait for latest Fedora release 
417 # (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
418 # (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
419 #
420
421 libnl-MODULE := libnl
422 libnl-SPEC := libnl.spec
423 ALL += libnl
424
425 util-vserver: libnl
426
427 #
428 # Installation rules
429
430
431 # Upload packages to boot server
432 SERVERA := build@boot1.planet-lab.org
433 SERVERB := build@boot2.planet-lab.org
434 ARCHIVE := /plc/data/var/www/html/install-rpms/archive
435
436 # Put nightly alpha builds in a subdirectory
437 ifeq ($(TAG),HEAD)
438 ARCHIVE := $(ARCHIVE)/planetlab-alpha
439 REPOS := /plc/data/var/www/html/install-rpms/planetlab-alpha
440 endif
441
442 RPMS/yumgroups.xml:
443         install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
444
445 install:
446 ifeq ($(BASE),)
447         @echo make install is only meant to be called from ./build.sh
448 else
449 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
450         # Sign all RPMS. setsid detaches rpm from the terminal,
451         # allowing the (hopefully blank) GPG password to be entered
452         # from stdin instead of /dev/tty. Obviously, the build server
453         # should be secure.
454         echo | setsid rpm \
455         --define "_signature gpg" \
456         --define "_gpg_path /etc/planetlab" \
457         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
458         --resign RPMS/*/*.rpm
459 endif
460 ifneq ($(BUILDS),)
461         # Remove old runs
462         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
463         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
464 endif
465         # Create package manifest
466         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
467         # Update yum metadata
468         yum-arch RPMS >/dev/null
469         createrepo -g yumgroups.xml RPMS >/dev/null
470         # Populate repository
471         rsync \
472         --exclude '*-debuginfo-*' \
473         --recursive --links --perms --times --group --compress --rsh=ssh \
474         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
475         rsync \
476         --exclude '*-debuginfo-*' \
477         --recursive --links --perms --times --group --compress --rsh=ssh \
478         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
479 ifeq ($(TAG),HEAD)
480         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
481         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
482             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
483         fi
484         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
485         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
486             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
487         fi
488
489 endif
490 endif
491
492 .PHONY: install