e38c047a9118d368f8bfe738acdd7dba0bc8245d
[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 CoDemux-RPMBUILD := sudo bash ./rpmbuild.sh
213 ALL += CoDemux
214
215 #
216 # MySQL
217 #
218
219 mysql-MODULE := mysql
220 mysql-SPEC := mysql.spec
221 #ALL += mysql
222
223 #
224 # ulogd
225 #
226
227 ulogd-MODULE := ulogd
228 ulogd-SPEC := ulogd.spec
229 ALL += ulogd
230
231 ulogd: kernel proper #mysql
232
233 #
234 # netflow
235 #
236
237 PlanetFlow-MODULE := PlanetFlow
238 PlanetFlow-SPEC := netflow.spec
239 ALL += PlanetFlow
240
241 PlanetFlow: #mysql
242
243 #
244 # PlanetLab Mom: Cleans up your mess
245 #
246
247 Mom-MODULE := Mom
248 Mom-SPEC := pl_mom.spec
249 ALL += Mom
250
251 #
252 # iptables
253 #
254
255 iptables-MODULE := iptables
256 iptables-SPEC := iptables.spec
257 ALL += iptables
258
259 iptables: kernel
260
261 #
262 # iproute
263 #
264
265 iproute-MODULE := iproute2
266 iproute-SPEC := iproute.spec
267 ALL += iproute
268
269 #
270 # kexec-tools:  DEPRECATE
271 #
272 # [marc]    use FC6+ release
273 #
274
275 #kexec-tools-MODULE := kexec-tools
276 #kexec-tools-SPEC := kexec-tools/kexec-tools.spec
277 #ALL += kexec-tools
278
279 #
280 # util-python
281 #
282 # [marc]    deprecate server.py
283 #
284 # I dont know what the above means...  Daniel says we need to seperate util-vserver from
285 # pl specific utilities (vuseradd, etc) which may or may not include vserver.py.  Until then,
286 # I'm keeping this in the build.  -F
287 #
288
289 util-python-MODULE := util-python
290 util-python-SPEC := util-python.spec
291 ALL += util-python
292
293 # proper and util-vserver both use scripts in util-python for building
294 # [dhozac]  Not anymore.  util-vserver uses automake and no longer needs util-python
295 proper: util-python
296
297 #util-vserver: util-python
298 #PlanetLabAuth: util-python
299
300
301 # vsys does not compile when ocaml rpm is installed.  Need to fix include path
302 # so that it compiles.  Sapan will need to fix this.
303 #
304 # vsys
305 #
306 vsys-MODULE := vsys
307 vsys-SPEC := vsys.spec
308 # ALL += vsys
309
310 #
311 # PLCAPI
312 #
313
314 PLCAPI-MODULE := PLCAPI
315 PLCAPI-SPEC := PLCAPI.spec
316 ALL += PLCAPI
317
318 #
319 # PLCWWW
320 #
321
322 PLCWWW-MODULE := WWW
323 PLCWWW-SPEC := PLCWWW.spec
324 ALL += PLCWWW
325
326 #
327 # vserver-reference
328 #
329
330 VserverReference-MODULE := VserverReference build
331 VserverReference-SPEC := vserver-reference.spec
332 # Package must be built as root
333 VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
334 ALL += VserverReference
335
336 # vserver-reference may require current packages
337 vserver-reference: $(filter-out vserver-reference,$(ALL))
338
339 #
340 # BootManager
341 #
342
343 BootManager-MODULE := BootManager build
344 BootManager-SPEC := bootmanager.spec
345 BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
346 ALL += BootManager
347
348 # BootManager requires current packages
349 BootManager: $(filter-out BootManager,$(ALL))
350
351 # ...and the yum manifest
352 BootManager: RPMS/yumgroups.xml
353
354 #
355 # BootCD
356 #
357
358 BootCD-MODULE := BootCD build BootManager
359 BootCD-SPEC := bootcd.spec
360 BootCD-RPMBUILD := sudo bash ./rpmbuild.sh
361 ALL += BootCD
362
363 # BootCD requires current packages
364 # BootCD: $(filter-out BootCD,$(ALL))
365
366 #
367 # MyPLC
368 #
369
370 MyPLC-MODULE := MyPLC build WWW
371 MyPLC-SPEC := myplc.spec
372 # Package must be built as root
373 MyPLC-RPMBUILD := sudo bash ./rpmbuild.sh
374 ALL += MyPLC
375
376 # MyPLC may require current packages
377 MyPLC: $(filter-out MyPLC,$(ALL))
378
379 # ...and the yum manifest
380 MyPLC: RPMS/yumgroups.xml
381
382
383 #
384 # MyPLC native
385 #
386
387 MyPLC-native-MODULE := MyPLC build WWW
388 MyPLC-native-SPEC := myplc-native.spec
389 # Package must be built as root
390 MyPLC-native-RPMBUILD := sudo bash ./rpmbuild.sh
391 ALL += MyPLC-native
392
393 # MyPLC may require current packages
394 MyPLC-native: $(filter-out MyPLC,$(ALL))
395
396 # ...and the yum manifest
397 MyPLC-native: RPMS/yumgroups.xml
398
399 #
400 # MyPLC development environment
401 #
402
403 myplc-devel-MODULE := MyPLC build 
404 myplc-devel-SPEC := myplc-devel.spec
405 # Package must be built as root
406 myplc-devel-RPMBUILD := sudo bash ./rpmbuild.sh
407 #ALL += myplc-devel
408
409 #
410 # MyPLC native development environment
411 #
412
413 myplc-devel-native-MODULE := MyPLC
414 myplc-devel-native-SPEC := myplc-devel-native.spec
415 ALL += myplc-devel-native
416
417 #
418 # libnl
419 #
420 # [daniel]    wait for latest Fedora release 
421 # (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
422 # (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
423 #
424
425 libnl-MODULE := libnl
426 libnl-SPEC := libnl.spec
427 ALL += libnl
428
429 util-vserver: libnl
430
431 #
432 # Installation rules
433
434
435 # Upload packages to boot server
436 SERVERA := build@boot1.planet-lab.org
437 SERVERB := build@boot2.planet-lab.org
438 ARCHIVE := /plc/data/var/www/html/install-rpms/archive
439
440 # Put nightly alpha builds in a subdirectory
441 ifeq ($(TAG),HEAD)
442 ARCHIVE := $(ARCHIVE)/planetlab-alpha
443 REPOS := /plc/data/var/www/html/install-rpms/planetlab-alpha
444 endif
445
446 RPMS/yumgroups.xml:
447         install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
448
449 install:
450 ifeq ($(BASE),)
451         @echo make install is only meant to be called from ./build.sh
452 else
453 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
454         # Sign all RPMS. setsid detaches rpm from the terminal,
455         # allowing the (hopefully blank) GPG password to be entered
456         # from stdin instead of /dev/tty. Obviously, the build server
457         # should be secure.
458         echo | setsid rpm \
459         --define "_signature gpg" \
460         --define "_gpg_path /etc/planetlab" \
461         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
462         --resign RPMS/*/*.rpm
463 endif
464 ifneq ($(BUILDS),)
465         # Remove old runs
466         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
467         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
468 endif
469         # Create package manifest
470         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
471         # Update yum metadata
472         yum-arch RPMS >/dev/null
473         createrepo -g yumgroups.xml RPMS >/dev/null
474         # Populate repository
475         rsync \
476         --exclude '*-debuginfo-*' \
477         --recursive --links --perms --times --group --compress --rsh=ssh \
478         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
479         rsync \
480         --exclude '*-debuginfo-*' \
481         --recursive --links --perms --times --group --compress --rsh=ssh \
482         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
483 ifeq ($(TAG),HEAD)
484         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
485         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
486             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
487         fi
488         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
489         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
490             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
491         fi
492
493 endif
494 endif
495
496 .PHONY: install