b3e2df1f1e409740913cb8e7ec4fb092277a0602
[build.git] / plc.mk
1 #
2 # PlanetLab Central local RPM generation
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2003-2005 The Trustees of Princeton University
6 #
7 # $Id: plc.mk,v 1.2.2.10 2005/07/18 22:17:12 mlhuang Exp $
8 #
9
10 # Default target
11 all:
12
13 #
14 # CVSROOT: CVSROOT to use
15 # INITIAL: CVS tag to use for Source0 tarball
16 # TAG: CVS tag to patch to (if not HEAD)
17 # MODULE: CVS module name to use (if not HEAD)
18 # SPEC: RPM spec file template
19 # RPMBUILD: If not rpmbuild
20 # RPMFLAGS: Miscellaneous RPM flags
21 # CVS_RSH: If not ssh
22 # ALL: default targets
23 #
24 # If INITIAL is different than TAG, PatchSets will be generated
25 # automatically with cvsps(1) to bring Source0 up to TAG. If TAG is
26 # HEAD, a %{date} variable will be defined in the generated spec
27 # file. If a Patch: tag in the spec file matches a generated PatchSet
28 # number, the name of the patch will be as specified. Otherwise, the
29 # name of the patch will be the PatchSet number. %patch tags in the
30 # spec file are generated automatically.
31 #
32
33 # Default values
34 INITIAL := plc-0_2-9
35 TAG := plc-0_2-9
36 CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
37
38 #
39 # plc
40 #
41
42 plc-CVSROOT := :ext:cvs.planet-lab.org:/cvs
43 plc-MODULE := plc
44 plc-SPEC := plc/plc.spec
45 ALL += plc
46
47 #
48 # Proper: Privileged Operations Service
49 #
50
51 proper-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
52 proper-MODULE := proper
53 proper-SPEC := proper/proper.spec
54 ALL += proper
55
56 #
57 # util-python
58 #
59 util-python-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
60 util-python-MODULE := util-python
61 util-python-SPEC := util-python/util-python.spec
62 ALL += util-python
63
64 # proper and util-vserver both use scripts in util-python for building
65 proper: util-python
66 util-vserver: util-python
67
68 #
69 # ulogd
70 #
71
72 ulogd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
73 ulogd-MODULE := ulogd
74 ulogd-SPEC := ulogd/ulogd.spec
75 ALL += ulogd
76
77 ulogd: proper
78
79 #
80 # netflow
81 #
82
83 netflow-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
84 netflow-MODULE := netflow
85 netflow-SPEC := netflow/netflow.spec
86 ALL += netflow
87
88 #
89 # Request Tracker 3
90 #
91
92 rt3-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
93 rt3-MODULE := rt3
94 rt3-SPEC := rt3/etc/rt.spec
95 ALL += rt3
96
97 #
98 # Mail::SpamAssassin
99 #
100
101 spamassassin-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
102 spamassassin-MODULE := spamassassin
103 spamassassin-SPEC := spamassassin/spamassassin.spec
104 ALL += spamassassin
105
106 #
107 # TWiki
108 #
109
110 twiki-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
111 twiki-MODULE := twiki
112 twiki-SPEC := twiki/TWiki.spec
113 ALL += twiki
114
115 ifeq ($(findstring $(package),$(ALL)),)
116
117 # Build all packages
118 all: $(ALL)
119         install -D -m 644 groups/stock_fc2_groups.xml RPMS/yumgroups.xml
120
121 # Recurse
122 $(ALL):
123         $(MAKE) -f plc.mk package=$@
124
125 # Put packages in boot repository
126 ARCHIVE := /var/www/html/archive
127
128 # Put nightly alpha builds in a subdirectory
129 ifeq ($(TAG),HEAD)
130 ARCHIVE := $(ARCHIVE)/plc-alpha
131 REPOS := /var/www/html/plc-alpha
132 endif
133
134 install:
135 ifeq ($(BASE),)
136         @echo make install is only meant to be called from ./build.sh
137 else
138 ifneq ($(BUILDS),)
139         # Remove old runs
140         cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf
141 endif
142         # Populate repository
143         mkdir -p $(ARCHIVE)/$(BASE)
144         rsync --delete --links --perms --times --group \
145             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(ARCHIVE)/$(BASE)/
146         yum-arch $(ARCHIVE)/$(BASE) >/dev/null
147 ifeq ($(TAG),HEAD)
148         ln -nsf $(ARCHIVE)/$(BASE) $(REPOS)
149 endif
150 endif
151
152 # Remove files generated by this package
153 $(foreach package,$(ALL),$(package)-clean): %-clean:
154         $(MAKE) -f plc.mk package=$* clean
155
156 # Remove all generated files
157 clean:
158         rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps
159
160 .PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
161
162 else
163
164 # Define variables for Makerules
165 CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
166 INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
167 TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
168 MODULE := $($(package)-MODULE)
169 SPEC := $($(package)-SPEC)
170 RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),rpmbuild)
171 RPMFLAGS := $($(package)-RPMFLAGS)
172 CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh)
173
174 include Makerules
175
176 endif