forked from neymanna/fusionforge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.debian
365 lines (291 loc) · 13.1 KB
/
Makefile.debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
#! /usr/bin/make -f
FUSIONFORGE=FusionForge
PKGDIR=gforge
PKGNAME=$(shell head -1 $(PKGDIR)/debian/changelog | sed 's/ .*//')
PKGLETTER=$(shell echo $(PKGNAME) | cut -c1)
ORIGIN=debian.fusionforge.org
BRANCH=$(shell [ "$(shell echo $(basename $(CURDIR)) | sed 's/.*runk.*/trunk/')" = "trunk" ] && echo svn || echo brc)
#
ifeq (,$(shell echo "$$BUILDERDIR"))
BUILDERDIR=$(CURDIR)/builder
else
BUILDERDIR=$(shell echo $$BUILDERDIR)
endif
BUILDRESULT=$(CURDIR)/result
TARBALLS=$(CURDIR)/tarballs
#
BUILDPLACE=$(BUILDERDIR)/buildplace
BUILDFILES=$(BUILDERDIR)/buildfiles
COWBUILDERBASE=$(BUILDERDIR)/cow
PBUILDERTGZ=$(BUILDERDIR)/tgz
APTCACHE=$(BUILDERDIR)/cache
#
LOCALREPODEB=/var/www/debian-fusionforge-$(BRANCH)
LOCALREPOUBU=/var/www/ubuntu-fusionforge-$(BRANCH)
#
DISTRIB=$(shell echo $(XDISTRIB) | cut -c2-)
SIGNKEY=yes
DEBIANLIST=1lenny 2squeeze 3sid
DEBIANLISTP=1etch
DEBLIST=$(DEBIANLIST) $(DEBIANLISTP)
UBUNTULIST=1hardy 1intrepid 1jaunty 1karmic
UBUNTULIST=1jaunty 1karmic 1lucid
UBUNTULISTP=1gutsy
UBULIST=$(UBUNTULIST) $(UBUNTULISTP)
# Try if a local mirror is available
LOCALMIRROR=http://localhost/ubuntu
UBUNTUOP=$(shell wget -q -S http://localhost/ubuntu -O /dev/null 2>&1 && echo "--mirror $(LOCALMIRROR)" || echo "--mirror http://archive.ubuntu.com/ubuntu") --debootstrap debootstrap
UBUNTUOP=--mirror http://archive.ubuntu.com/ubuntu --debootstrap debootstrap
DEBIANOP=--debootstrapopts --include=apt --debootstrap debootstrap
ASKPASS=--ask-passphrase
ASKPASS=
MAJOR=$(shell head -1 $(PKGDIR)/debian/changelog | sed 's/.*(\(.*\)-[^-]*).*/\1/')
in_svn_repo:= $(wildcard .svn/)
ifeq ($(strip $(in_svn_repo)),)
#in_bzr_repo:= $(shell bzr info | grep parent | cut -d: -f2-)
in_bzr_repo:= $(wildcard .bzr/)
ifeq ($(strip $(in_bzr_repo)),)
svnrev=unknown
else
#svnrev=$(shell LANG=C bzr log -r-1 2>&1 | grep "svn revno" | cut -d" " -f3)
svnrev=bzr$(shell bzr revno)
endif
else
svnrev=$(shell LANG=C svn info 2>&1 | grep Revision | cut -d: -f2| sed 's/ //g')
endif
MINOR=-1
MINOR=-$(BRANCH)$(svnrev)+$(XDISTRIB)
DEBUG=--debug
DEBUG=
DEBBUILDOPTS=--debbuildopts -sa
ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
UBUHOOK="--hookdir $(CURDIR)/hook/ubuntu"
# Some doc found there http://wiki.debian.org/cowbuilder
# Hook are not anymore necessary, but I keep as an example
UBUHOOK="--components 'main universe' --debootstrapopts --exclude=udev,pcmciautils,initramfs-tools"
UBUHOOK=--components "main universe" --hookdir $(CURDIR)/hook/ubuntu
ORIGFILE=$(PKGNAME)_$(MAJOR).orig.tar.gz
DSCFILE=$(PKGNAME)_$(MAJOR)$(MINOR).dsc
PDSCFILE=$(PKGNAME)_$(MAJOR)$(MINOR)+p.dsc
CHANGEFILE=$(PKGNAME)_$(MAJOR)$(MINOR)_$(ARCH).changes
PCHANGEFILE=$(PKGNAME)_$(MAJOR)$(MINOR)+p_$(ARCH).changes
# Quite heavy version, but still requires to be root
COWBUILDERCMD=cd $(BUILDPLACE) && dpkg-source -x $(BUILDFILES)/$(DSCFILE) ; cd $(BUILDPLACE)/$(PKGNAME)-$(MAJOR) && pdebuild --pbuilder cowbuilder --buildresult $(BUILDRESULT) -- --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --buildplace $(BUILDPLACE) --aptcache $(APTCACHE) ; rm -rf $(BUILDPLACE)/$(PKGNAME)-$(MAJOR)
# This one is with sudo and probably faster
COWBUILDERCMD=sudo /usr/sbin/cowbuilder --build --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --configfile $(COWBUILDERBASE)/config $(BUILDFILES)/$(DSCFILE) $(DEBBUILDOPTS)
# This one is with pbuilder
PBUILDERCMD=cd $(BUILDFILES) && sudo /usr/sbin/pbuilder --build --basetgz $(PBUILDERTGZ)/base-$(DISTRIB).tgz --configfile $(PBUILDERTGZ)/config $(BUILDFILES)/$(PDSCFILE)
default: list
list:
@echo ======================================================================================
@echo '= Available targets are listed below ($(BRANCH))($(ARCH)) ='
@echo '= BUILDERDIR = $(BUILDERDIR) ='
@echo ======================================================================================
@cat Makefile.debian | grep '^.*:.*#$$' | sed 's/FUSIONFORGE/$(FUSIONFORGE)/' | sed 's/^\(.*:\).*#\(.*\)#$$/\1 \2/'
@echo ======================================================================================
#
# Simple targets
#
#:======== Debian Builds ============#
lenny: # Simply build lenny packages #
$(MAKE) cowbuilddeb DEBIANLIST=1lenny
rlenny: # Make a lenny repository #
$(MAKE) repodeb DEBIANLIST=1lenny
squeeze: # Simply build squeeze packages #
$(MAKE) cowbuilddeb DEBIANLIST=2squeeze
rsqueeze: # Make a squeeze repository #
$(MAKE) repodeb DEBIANLIST=2squeeze
sid: # Simply build sid packages #
$(MAKE) cowbuilddeb DEBIANLIST=3sid
rsid: # Make a sid repository #
$(MAKE) repodeb DEBIANLIST=3sid
#:======== Ubuntu Builds ============#
intrepid: # Simply build intrepid packages #
$(MAKE) cowbuildubu UBUNTULIST=1intrepid
rintrepid: # Make an intrepid repository #
$(MAKE) repoubu UBUNTULIST=1intrepid
jaunty: # Simply build jaunty packages #
$(MAKE) cowbuildubu UBUNTULIST=1jaunty
rjaunty: # Make a jaunty repository #
$(MAKE) repoubu UBUNTULIST=1jaunty
karmic: # Simply build karmic packages #
$(MAKE) cowbuildubu UBUNTULIST=1karmic
rkarmic: # Make a karmic repository #
$(MAKE) repoubu UBUNTULIST=1karmic
lucid: # Simply build lucid packages #
$(MAKE) cowbuildubu UBUNTULIST=1lucid
rlucid: # Make a lucid repository #
$(MAKE) repoubu UBUNTULIST=1lucid
#:======== Other and Multiple Builds ============#
documentor_path=/tmp
documentor_url=http://downloads.sourceforge.net/project/phpdocu/PhpDoc/phpDocumentor-1.4.3/PhpDocumentor-1.4.3.tgz
documentor_file=PhpDocumentor-1.4.3.tgz
documentor_subdir=PhpDocumentor-1.4.3
#
# FUSIONFORGE
#
orig: $(TARBALLS)/$(ORIGFILE) # Make FUSIONFORGE orig file
#
# PHPDOCUMENTOR
#
# Get phpdocumentor, install phpdocumentor, build $(PKGNAME) phpdoc
phpdoc: $(PKGDIR)/docs/phpdoc/docs
doc:
(cd gforge/docs/docbook ; make debian)
cleandoc:
(cd gforge/docs/docbook ; make clean)
phpdocumentor_get:
[ ! -f $(documentor_path)/$(documentor_file) ] && \
cd $(documentor_path) && \
wget $(documentor_url) || true
phpdocumentor_unpack: phpdocumentor_get
[ ! -d $(documentor_path)/$(documentor_subdir) ] && \
cd $(documentor_path) && \
tar -xvzf $(documentor_file) || true
$(documentor_path)/$(documentor_subdir)/patched: phpdocumentor_unpack
cd $(documentor_path)/$(documentor_subdir) && \
patch < $(CURDIR)/$(PKGDIR)/docs/phpdoc/phpDocumentor.ini.patch \
&& touch $(documentor_path)/$(documentor_subdir)/patched
$(PKGDIR)/docs/phpdoc/docs: $(documentor_path)/$(documentor_subdir)/patched
cd $(PKGDIR)/docs/phpdoc/ && ./makedoc.sh
#
# Build with cowbuilder or pbuilder
#
all: cleanorig cowbuilddeb cowbuildubu # ***** Build all package for debian and ubuntu ***** #
deploy: repodeb repoubu # ***** Deploy packages in Debian and Ubuntu repositories ***** #
repodeb: cowbuilddeb
@for dist in $(DEBIANLIST); do \
$(MAKE) -f Makefile.debian localrepo reprepro XDISTRIB=$$dist LOCALREPO=$(LOCALREPODEB) DISTRIBLIST="$(DEBLIST)" ; \
done
repoubu: cowbuildubu
@for dist in $(UBUNTULIST); do \
$(MAKE) -f Makefile.debian localrepo reprepro XDISTRIB=$$dist LOCALREPO=$(LOCALREPOUBU) DISTRIBLIST="$(UBULIST)" ; \
done
cowbuildtest:
@echo "Will build $(PKGNAME)_$(MAJOR)$(MINOR)$(DISTRIB)"
cowbuilddeb: # ***** This is the one to cowbuild debian packages ***** #
@for dist in $(DEBIANLIST); do \
$(MAKE) -f Makefile.debian cowbuilddist XDISTRIB=$$dist DISTROOP="$(DEBIANOP)" ; \
done
cowbuildubu: # ***** This is the one to cowbuild ubuntu packages ***** #
@for dist in $(UBUNTULIST); do \
$(MAKE) -f Makefile.debian cowbuilddist XDISTRIB=$$dist DISTROOP="$(UBUNTUOP)" HOOK='$(UBUHOOK)' ; \
done
pbuilddeb: # pbuild debian packages (less recommended) #
@for dist in $(DEBIANLISTP); do \
$(MAKE) -f Makefile.debian pbuilddist XDISTRIB=$$dist DISTROOP="$(DEBIANOP)" LOCALREPO=$(LOCALREPODEB) ; \
done
pbuildubu: # pbuild ubuntu packages (less recommended) #
@for dist in $(UBUNTULISTP); do \
$(MAKE) -f Makefile.debian pbuilddist XDISTRIB=$$dist DISTROOP="$(UBUNTUOP)" LOCALREPO=$(LOCALREPOUBU) ; \
done
cowbuilddist: cowbuilderenv $(BUILDFILES) $(BUILDRESULT)/$(CHANGEFILE)
pbuilddist: pbuilderenv $(BUILDFILES) $(BUILDRESULT)/$(PCHANGEFILE)
$(BUILDRESULT)/$(CHANGEFILE): $(BUILDFILES)/$(DSCFILE)
$(COWBUILDERCMD)
$(BUILDRESULT)/$(PCHANGEFILE): $(BUILDFILES)/$(PDSCFILE)
$(PBUILDERCMD)
$(BUILDFILES)/$(DSCFILE):
@echo "================> Have to cowbuild $@ <=================="
cd $(PKGDIR) ; debclean
find $(PKGDIR) -type f -or -type l | grep -v '/CVS/' | \
grep -v '/.svn/' | grep -v '/.testbox/' | \
grep -v rpm-specific | grep -v docs/phpdoc/docs | \
grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
# Set version for given distrib
cd $(BUILDFILES)/$(PKGDIR); dch -b -v $(MAJOR)$(MINOR) -D UNRELEASED "This is $(DISTRIB) autobuild"
perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGDIR)/debian/changelog
cd $(BUILDFILES) ; dpkg-source -b $(PKGDIR)
rm -rf $(BUILDFILES)/$(PKGDIR)
$(BUILDFILES)/$(PDSCFILE):
@echo "================> Have to pbuild $@ <=================="
cd $(PKGDIR) ; debclean
find $(PKGDIR) -type f -or -type l | grep -v '/CVS/' | \
grep -v '/.svn/' | grep -v '/.testbox/' | \
grep -v rpm-specific | grep -v docs/phpdoc/docs | \
grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
# Set version for given distrib
cd $(BUILDFILES)/$(PKGDIR); dch -b -v $(MAJOR)$(MINOR)+p -D UNRELEASED "This is $(DISTRIB) autobuild"
perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGDIR)/debian/changelog
cd $(BUILDFILES) ; dpkg-source -b $(PKGDIR)
rm -rf $(BUILDFILES)/$(PKGDIR)
$(BUILDFILES)/$(ORIGFILE): $(TARBALLS)/$(ORIGFILE)
cp $(TARBALLS)/$(ORIGFILE) $(BUILDFILES)
$(TARBALLS)/$(ORIGFILE): $(TARBALLS)
cd $(PKGDIR) ; debclean
find $(PKGDIR) -type f -or -type l | grep -v '/CVS/' | \
grep -v '/.svn/' | grep -v '/.testbox/' | \
grep -v rpm-specific | grep -v docs/phpdoc/docs | \
grep -v ^./debian/ | grep -v \\.jar$$ | \
grep -v \\.pdf$$ | grep -v plugins/fckeditor/www/_samples | \
grep -v plugins/wiki/www/lib/pear | \
cpio -o -H ustar | gzip > $(TARBALLS)/$(ORIGFILE)
pbuilderenv: $(PBUILDERTGZ) $(PBUILDERTGZ)/base-$(DISTRIB).tgz
@echo "=========> Ready for $(DISTRIB)"
cowbuilderenv: $(COWBUILDERBASE) $(COWBUILDERBASE)/base-$(DISTRIB).stamp.update
@echo "=========> Ready for $(DISTRIB)"
forceupdatecow: # Force update of cowbuilder env #
rm -f $(COWBUILDERBASE)/base-*.stamp.update
$(COWBUILDERBASE)/base-$(DISTRIB).stamp.update: $(COWBUILDERBASE)/base-$(DISTRIB).stamp
sudo /usr/sbin/cowbuilder --update $(HOOK) --distribution $(DISTRIB) --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --configfile $(COWBUILDERBASE)/config $(DISTROOP)
touch $@
$(PBUILDERTGZ)/base-$(DISTRIB).tgz: $(PBUILDERTGZ)/config
sudo /usr/sbin/pbuilder --create --distribution $(DISTRIB) --basetgz $(PBUILDERTGZ)/base-$(DISTRIB).tgz --configfile $(PBUILDERTGZ)/config $(DISTROOP)
$(COWBUILDERBASE)/base-$(DISTRIB).stamp: $(COWBUILDERBASE)/config
sudo /usr/sbin/cowbuilder --create $(HOOK) --distribution $(DISTRIB) --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --configfile $(COWBUILDERBASE)/config $(DISTROOP)
touch $@.update
touch $@
$(PBUILDERTGZ)/config: /usr/sbin/pbuilder
echo "APTCACHE=$(APTCACHE)" > $(PBUILDERTGZ)/config
echo "BUILDPLACE=$(BUILDPLACE)" >> $(PBUILDERTGZ)/config
echo "BUILDRESULT=$(BUILDRESULT)" >> $(PBUILDERTGZ)/config
$(COWBUILDERBASE)/config: /usr/sbin/cowbuilder
echo "APTCACHE=$(APTCACHE)" > $(COWBUILDERBASE)/config
echo "BUILDPLACE=$(BUILDPLACE)" >> $(COWBUILDERBASE)/config
echo "BUILDRESULT=$(BUILDRESULT)" >> $(COWBUILDERBASE)/config
/usr/sbin/pbuilder:
sudo apt-get install pbuilder
ubukey:
gpg --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
gpg --export --armor 40976EAF437D05B5 | sudo apt-key add -
/usr/sbin/cowbuilder:
sudo apt-get install cowdancer
localrepo: $(LOCALREPO) $(LOCALREPO)/conf $(LOCALREPO)/conf/distributions
reprepro: $(LOCALREPO)/pool/main/$(PKGLETTER)/$(PKGNAME)/$(DSCFILE) # Install in repository
$(LOCALREPO)/pool/main/$(PKGLETTER)/$(PKGNAME)/$(DSCFILE): $(BUILDRESULT)/$(CHANGEFILE)
@echo "Installing $(BUILDRESULT)/$(CHANGEFILE) in $@"
cd $(BUILDRESULT); reprepro $(ASKPASS) -Vb $(LOCALREPO) include $(DISTRIB) $(CHANGEFILE)
$(LOCALREPO)/conf/distributions:
for xdist in $(DISTRIBLIST) ; do \
dist=`echo $$xdist | cut -c2-` ; \
echo "Codename: $$dist" ; \
echo "Suite: $$dist" ; \
echo "Components: main" ; \
echo "UDebComponents: main" ; \
echo "Architectures: amd64 i386 source" ; \
echo "Origin: $(ORIGIN)" ; \
echo "Version: 5.0" ; \
echo "Description: My $(FUSIONFORGE) $$dist repository" ; \
echo "SignWith: $(SIGNKEY)" ; \
echo "" ; done >> $(LOCALREPO)/conf/distributions
$(LOCALREPO)/conf:
mkdir $(LOCALREPO)/conf
$(TARBALLS):
mkdir -p $(TARBALLS)
$(BUILDFILES):
mkdir -p $(BUILDFILES)
$(COWBUILDERBASE):
mkdir -p $(COWBUILDERBASE)
$(PBUILDERTGZ):
mkdir -p $(PBUILDERTGZ)
$(LOCALREPO):
sudo mkdir $@
sudo chown `id -u`.`id -g` $@
clean: # Clean $(BUILDPLACE) $(BUILDFILES) $(TARBALLS) (intermediate files) #
rm -rf $(BUILDPLACE) $(BUILDFILES) $(TARBALLS)
cleanenv: # Clean $(COWBUILDERBASE) $(PBUILDERTGZ) (chroots)#
rm -rf $(COWBUILDERBASE) $(PBUILDERTGZ)
cleancache: # Clean $(APTCACHE) (apt cache) #
rm -rf $(APTCACHE)
cleanorig: # Clean $(TARBALLS)/$(ORIGFILE) #
rm -f $(TARBALLS)/$(ORIGFILE)