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