- define PLDISTRO
[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.6 2005/09/14 19:21:22 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 := HEAD
35 TAG := HEAD
36 CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
37
38 # By default, the naming convention for built RPMS is
39 # <name>-<version>-<release>.planetlab.<arch>.rpm
40 # Set PLDISTRO on the command line to differentiate between downstream
41 # variants.
42 PLDISTRO := planetlab
43
44 #
45 # plc
46 #
47
48 plc-CVSROOT := :ext:cvs.planet-lab.org:/cvs
49 plc-MODULE := plc
50 plc-SPEC := plc/plc.spec
51 ALL += plc
52
53 #
54 # Proper: Privileged Operations Service
55 #
56
57 proper-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
58 proper-MODULE := proper
59 proper-SPEC := proper/proper.spec
60 ALL += proper
61
62 #
63 # util-python
64 #
65 util-python-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
66 util-python-MODULE := util-python
67 util-python-SPEC := util-python/util-python.spec
68 ALL += util-python
69
70 # proper and util-vserver both use scripts in util-python for building
71 proper: util-python
72 util-vserver: util-python
73
74 #
75 # ulogd
76 #
77
78 ulogd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
79 ulogd-MODULE := ulogd
80 ulogd-SPEC := ulogd/ulogd.spec
81 ALL += ulogd
82
83 ulogd: proper
84
85 #
86 # netflow
87 #
88
89 netflow-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
90 netflow-MODULE := netflow
91 netflow-SPEC := netflow/netflow.spec
92 ALL += netflow
93
94 #
95 # Request Tracker 3
96 #
97
98 rt3-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
99 rt3-MODULE := rt3
100 rt3-SPEC := rt3/etc/rt.spec
101 ALL += rt3
102
103 #
104 # Mail::SpamAssassin
105 #
106
107 spamassassin-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
108 spamassassin-MODULE := spamassassin
109 spamassassin-SPEC := spamassassin/spamassassin.spec
110 ALL += spamassassin
111
112 #
113 # TWiki
114 #
115
116 twiki-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
117 twiki-MODULE := twiki
118 twiki-SPEC := twiki/TWiki.spec
119 ALL += twiki
120
121 ifeq ($(findstring $(package),$(ALL)),)
122
123 # Build all packages
124 all: $(ALL)
125         install -D -m 644 groups/stock_fc2_groups.xml RPMS/yumgroups.xml
126
127 # Recurse
128 $(ALL):
129         $(MAKE) -f plc.mk package=$@
130
131 # Put packages in boot repository
132 ARCHIVE := /var/www/html/archive
133
134 # Put nightly alpha builds in a subdirectory
135 ifeq ($(TAG),HEAD)
136 ARCHIVE := $(ARCHIVE)/plc-alpha
137 REPOS := /var/www/html/plc-alpha
138 endif
139
140 install:
141 ifeq ($(BASE),)
142         @echo make install is only meant to be called from ./build.sh
143 else
144 ifneq ($(BUILDS),)
145         # Remove old runs
146         cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf
147 endif
148         # Populate repository
149         mkdir -p $(ARCHIVE)/$(BASE)
150         rsync --delete --links --perms --times --group \
151             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(ARCHIVE)/$(BASE)/
152         yum-arch $(ARCHIVE)/$(BASE) >/dev/null
153 ifeq ($(TAG),HEAD)
154         ln -nsf $(ARCHIVE)/$(BASE) $(REPOS)
155 endif
156 endif
157
158 # Remove files generated by this package
159 $(foreach package,$(ALL),$(package)-clean): %-clean:
160         $(MAKE) -f plc.mk package=$* clean
161
162 # Remove all generated files
163 clean:
164         rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps
165
166 .PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
167
168 else
169
170 # Define variables for Makerules
171 CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
172 INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
173 TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
174 MODULE := $($(package)-MODULE)
175 SPEC := $($(package)-SPEC)
176 RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),rpmbuild)
177 RPMFLAGS := $($(package)-RPMFLAGS)
178 CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh)
179
180 include Makerules
181
182 endif