build new PLCWWW and myplc-native modules
[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.67.2.5 2007/09/06 21:01:20 mef Exp $
8 #
9
10 #
11 # Required:
12 #
13 # CVSROOT or package-CVSROOT: CVSROOT to use
14 # TAG or package-TAG: CVS tag to use
15 # package-MODULE: CVS module name to use
16 # package-SPEC: RPM spec file template
17 #
18 # Optional:
19 #
20 # package-RPMFLAGS: Miscellaneous RPM flags
21 # package-RPMBUILD: If not rpmbuild
22 # package-CVS_RSH: If not ssh
23 #
24 # Add to ALL if you want the package built as part of the default set.
25 #
26
27 #
28 # Default values
29 #
30
31 CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
32 TAG := HEAD
33
34 # Check if a tag has been checked out
35 ifneq ($(wildcard CVS/Root),)
36 # Check if we are able to access CVS
37 CVSTAG := $(shell cvs status planetlab.mk 2>/dev/null | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
38 ifneq ($(CVSTAG),)
39 CVSROOT := $(shell cat CVS/Root)
40 ifeq ($(CVSTAG),(none))
41 TAG := HEAD
42 else
43 TAG := $(CVSTAG)
44 endif
45 endif
46 endif
47
48 #
49 # kernel
50 #
51
52 # Figure out whether we are building on i386 or x86_64 host
53 HOSTARCH := $(shell uname -i)
54
55 kernel-$(HOSTARCH)-MODULE := linux-2.6
56 kernel-$(HOSTARCH)-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
57 ifeq ($(HOSTARCH),i386)
58 kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
59 else
60 kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
61 endif
62
63 ALL += kernel-$(HOSTARCH)
64
65 kernel-clean: kernel-$(HOSTARCH)-clean
66 kernel: kernel-$(HOSTARCH)
67
68 #
69 # madwifi
70 #
71
72 madwifi-ng-MODULE := madwifi-ng
73 madwifi-ng-SPEC := madwifi-ng/madwifi.spec
74 #ALL += madwifi-ng
75
76 # Build kernel first so we can bootstrap off of its build
77 madwifi-ng: kernel
78
79 #
80 # ivtv 
81 #
82
83 ivtv-MODULE := ivtv
84 ivtv-SPEC := ivtv/ivtv.spec
85 #ALL += ivtv
86
87 #
88 # util-vserver
89 #
90
91 util-vserver-MODULE := util-vserver
92 util-vserver-SPEC := util-vserver/util-vserver.spec
93 util-vserver-RPMFLAGS:= --without dietlibc
94 ALL += util-vserver
95
96 #
97 # PlanetLabAccounts
98 #
99
100 PlanetLabAccounts-MODULE := PlanetLabAccounts
101 PlanetLabAccounts-SPEC := PlanetLabAccounts/PlanetLabAccounts.spec
102 ALL += PlanetLabAccounts
103
104 #
105 # NodeUpdate
106 #
107
108 NodeUpdate-MODULE := NodeUpdate
109 NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
110 ALL += NodeUpdate
111
112 #
113 # PlanetLabConf
114 #
115
116 PlanetLabConf-MODULE := PlanetLabConf
117 PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
118 ALL += PlanetLabConf
119
120 #
121 # ipod
122 #
123
124 ipod-MODULE := ipod
125 ipod-SPEC := ipod/ipod.spec
126 ALL += ipod
127
128 #
129 # sudo
130 #
131
132 sudo-MODULE := sudo
133 sudo-SPEC := sudo/planetlab_sudo.spec
134 ALL += sudo
135
136 #
137 # pycurl
138 #
139
140 curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
141 pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
142 pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
143 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
144 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
145 pycurl-MODULE := pycurl
146 pycurl-SPEC := pycurl/pycurl.spec
147 ALL += pycurl
148 endif
149 endif
150
151 #
152 # BootServerRequest
153 #
154
155 BootServerRequest-MODULE := BootServerRequest
156 BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
157 ALL += BootServerRequest
158
159 #
160 # Node Manager
161 #
162
163 NodeManager-MODULE := NodeManager
164 NodeManager-SPEC := NodeManager/NodeManager.spec
165 ALL += NodeManager
166
167 #
168 # pl_sshd
169 #
170
171 pl_sshd-MODULE := pl_sshd
172 pl_sshd-SPEC := pl_sshd/pl_sshd.spec
173 ALL += pl_sshd
174
175 #
176 # libhttpd++: 
177 #
178
179 libhttpd++-MODULE := libhttpd++
180 libhttpd++-SPEC := libhttpd++/libhttpd++.spec
181 ALL += libhttpd++
182
183 #
184 # Proper: Privileged Operations Service
185 #
186
187 proper-MODULE := proper
188 proper-SPEC := proper/proper.spec
189 proper-RPMBUILD := sudo sh .rpmbuild.sh
190 ALL += proper
191
192 proper: libhttpd++
193
194 #
195 # CoDemux: Port 80 demux
196 #
197
198 codemux-MODULE := codemux
199 codemux-SPEC   := codemux/codemux.spec
200 #ALL += codemux
201
202 #
203 # MySQL
204 #
205
206 mysql-MODULE := mysql
207 mysql-SPEC := mysql/mysql.spec
208 #ALL += mysql
209
210 #
211 # ulogd
212 #
213
214 ulogd-MODULE := ulogd
215 ulogd-SPEC := ulogd/ulogd.spec
216 ALL += ulogd
217
218 ulogd: kernel proper #mysql
219
220 #
221 # netflow
222 #
223
224 netflow-MODULE := netflow
225 netflow-SPEC := netflow/netflow.spec
226 ALL += netflow
227
228 netflow: #mysql
229
230 #
231 # PlanetLab Mom: Cleans up your mess
232 #
233
234 pl_mom-MODULE := pl_mom
235 pl_mom-SPEC := pl_mom/pl_mom.spec
236 ALL += pl_mom
237
238 #
239 # iptables
240 #
241
242 iptables-MODULE := iptables
243 iptables-SPEC := iptables/iptables.spec
244 ALL += iptables
245
246 iptables: kernel
247
248 #
249 # iproute
250 #
251
252 iproute-MODULE := iproute2
253 iproute-SPEC := iproute2/iproute.spec
254 ALL += iproute
255
256 #
257 # kexec-tools
258 #
259
260 kexec-tools-MODULE := kexec-tools
261 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
262 ALL += kexec-tools
263
264 #
265 # util-python
266 #
267
268 util-python-MODULE := util-python
269 util-python-SPEC := util-python/util-python.spec
270 ALL += util-python
271
272 # proper and util-vserver both use scripts in util-python for building
273 proper: util-python
274 util-vserver: util-python
275 PlanetLabAuth: util-python
276
277 #
278 # PLCAPI
279 #
280
281 PLCAPI-MODULE := new_plc_api
282 PLCAPI-SPEC := new_plc_api/PLCAPI.spec
283 ALL += PLCAPI
284
285 #
286 # PLCWWW
287 #
288
289 PLCWWW-MODULE := new_plc_www
290 PLCWWW-SPEC := new_plc_www/PLCWWW.spec
291 ALL += PLCWWW
292
293 #
294 # vserver-reference
295 #
296
297 vserver-reference-MODULE := vserver-reference build
298 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
299 # Package must be built as root
300 vserver-reference-RPMBUILD := sudo sh .rpmbuild.sh
301 ALL += vserver-reference
302
303 # vserver-reference may require current packages
304 vserver-reference: $(filter-out vserver-reference,$(ALL))
305
306 #
307 # bootmanager
308 #
309
310 bootmanager-MODULE := bootmanager build
311 bootmanager-SPEC := bootmanager/bootmanager.spec
312 bootmanager-RPMBUILD := sudo sh .rpmbuild.sh
313 ALL += bootmanager
314
315 # bootmanager requires current packages
316 bootmanager: $(filter-out bootmanager,$(ALL))
317
318 # ...and the yum manifest
319 bootmanager: RPMS/yumgroups.xml
320
321 #
322 # bootcd
323 #
324
325 bootcd-MODULE := bootcd build bootmanager
326 bootcd-SPEC := bootcd/bootcd.spec
327 bootcd-RPMBUILD := sudo sh .rpmbuild.sh
328 ALL += bootcd
329
330 # bootcd requires current packages
331 bootcd: $(filter-out bootcd,$(ALL))
332
333 #
334 # MyPLC
335 #
336
337 myplc-MODULE := build myplc new_plc_www plc/scripts
338 myplc-SPEC := myplc/myplc.spec
339 # Package must be built as root
340 myplc-RPMBUILD := sudo sh .rpmbuild.sh
341 ALL += myplc
342
343 # MyPLC may require current packages
344 myplc: $(filter-out myplc,$(ALL))
345
346 # ...and the yum manifest
347 myplc: RPMS/yumgroups.xml
348
349 #
350 # MyPLC development environment
351 #
352
353 myplc-devel-MODULE := build myplc
354 myplc-devel-SPEC := myplc/myplc-devel.spec
355 # Package must be built as root
356 myplc-devel-RPMBUILD := sudo sh .rpmbuild.sh
357 ALL += myplc-devel
358
359 #
360 # MyPLC native
361 #
362
363 myplc-native-MODULE := build myplc plc/scripts
364 myplc-native-SPEC := myplc/myplc-native.spec
365 # Package must be built as root
366 myplc-native-RPMBUILD := sudo sh .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 # libnl
376 #
377
378 libnl-MODULE := libnl
379 libnl-SPEC := libnl/libnl.spec
380 ALL += libnl
381
382 util-vserver: libnl
383
384 #
385 # Installation rules
386
387
388 # Upload packages to boot server
389 SERVERA := build@boot1.planet-lab.org
390 SERVERB := build@boot2.planet-lab.org
391 ARCHIVE := /plc/data/var/www/html/install-rpms/archive
392
393 # Put nightly alpha builds in a subdirectory
394 ifeq ($(TAG),HEAD)
395 ARCHIVE := $(ARCHIVE)/planetlab-alpha
396 REPOS := /plc/data/var/www/html/install-rpms/planetlab-alpha
397 endif
398
399 RPMS/yumgroups.xml:
400         install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
401
402 install:
403 ifeq ($(BASE),)
404         @echo make install is only meant to be called from ./build.sh
405 else
406 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
407         # Sign all RPMS. setsid detaches rpm from the terminal,
408         # allowing the (hopefully blank) GPG password to be entered
409         # from stdin instead of /dev/tty. Obviously, the build server
410         # should be secure.
411         echo | setsid rpm \
412         --define "_signature gpg" \
413         --define "_gpg_path /etc/planetlab" \
414         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
415         --resign RPMS/*/*.rpm
416 endif
417 ifneq ($(BUILDS),)
418         # Remove old runs
419         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
420         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
421 endif
422         # Create package manifest
423         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
424         # Update yum metadata
425         yum-arch RPMS >/dev/null
426         createrepo -g yumgroups.xml RPMS >/dev/null
427         # Populate repository
428         rsync \
429         --exclude '*-debuginfo-*' \
430         --recursive --links --perms --times --group --compress --rsh=ssh \
431         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
432         rsync \
433         --exclude '*-debuginfo-*' \
434         --recursive --links --perms --times --group --compress --rsh=ssh \
435         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
436 ifeq ($(TAG),HEAD)
437         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
438         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
439             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
440         fi
441         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
442         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
443             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
444         fi
445
446 endif
447 endif
448
449 .PHONY: install