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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
#!/usr/bin/make -f
INSTALL = install
INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755
INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755
package=zsh
ifeq (zsh-beta,$(package))
snapshot_date := $(shell dpkg-parsechangelog | sed -n '/^Version: [0-9.][0-9.]*.*+20[0-9][0-9]\([0-9][0-9][0-9][0-9]\)-[0-9][0-9]*$$/ {s//\1/;p}')
endif
-include /usr/share/dpkg/buildflags.mk
export CFLAGS LDFLAGS CPPFLAGS
H_LDFLAGS = $(LDFLAGS)
CFLAGS += -Wall -g
ifeq (zsh-beta,$(package))
CFLAGS += -W
endif
CONFIGFLAGS = --prefix=/usr --mandir=/usr/share/man --bindir=/bin LDFLAGS="-Wl,--as-needed -g $(H_LDFLAGS)"
ifeq (zsh-beta,$(package))
CONFIGFLAGS += --program-suffix=-beta
endif
CONFIGFLAGS += --infodir=/usr/share/info --enable-maildir-support
CONFIGFLAGS += --enable-max-jobtable-size=256 --enable-etcdir=/etc/$(package)
CONFIGFLAGS += --enable-function-subdirs
CONFIGFLAGS += --enable-site-fndir=/usr/local/share/$(package)/site-functions
CONFIGFLAGS += --enable-fndir=/usr/share/$(package)/functions
CONFIGFLAGS += --with-tcsetpgrp --with-term-lib="ncursesw tinfo"
CONFIGFLAGS += --enable-cap --enable-pcre
CONFIGFLAGS += --enable-readnullcmd=pager
CONFIGFLAGS += --enable-custom-patchlevel=Debian
CONFIGFLAGS += --enable-additional-fpath=/usr/share/zsh/vendor-functions,/usr/share/zsh/vendor-completions
STATICFLAGS = --disable-dynamic --enable-ldflags=-static
ifneq (zsh-beta,$(package))
STATICFLAGS += --disable-dynamic-nss
endif
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CONFIGFLAGS += --enable-zsh-debug --enable-zsh-mem-debug --enable-zsh-mem-warning --enable-zsh-secure-free --enable-zsh-hash-debug
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (zsh-beta,$(package))
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
endif
build: stamp-configure
$(checkdir)
ifeq (zsh-beta,$(package))
touch stamp-h.in
endif
cd obj && $(MAKE)
-cd obj && HOME="$(CURDIR)/obj/testhome" $(MAKE) check
ifeq (zsh,$(package))
cd obj && $(MAKE) pdf
endif
touch build
build-static: stamp-configure-static
$(checkdir)
cd obj-static && $(MAKE)
touch build-static
build-debug: DEB_BUILD_OPTIONS+=debug
build-debug: build
stamp-configure:
$(checkdir)
touch stamp-h.in configure
chmod 755 configure
mkdir -p obj/testhome
ifeq (zsh-beta,$(package))
test -f Config/version.mk.orig || cp Config/version.mk Config/version.mk.orig
sed -i -e 's/^VERSION=\([^+]*\)$$/VERSION=\1-cvs$(snapshot_date)/' Config/version.mk
endif
cd obj && CFLAGS='$(CFLAGS)' ../configure $(CONFIGFLAGS)
touch stamp-configure
stamp-configure-static:
$(checkdir)
mkdir obj-static
cd obj-static && CFLAGS='$(CFLAGS)' ../configure $(CONFIGFLAGS) $(STATICFLAGS)
# cp debian/static.conf obj-static/Src/mymods.conf
sed -i -e 's/files.mdd link=no/files.mdd link=static/;s/stat.mdd link=no/stat.mdd link=static/' obj-static/config.modules
touch stamp-configure-static
clean:
$(checkdir)
ifeq (zsh-beta,$(package))
test ! -f Config/version.mk.orig || mv Config/version.mk.orig Config/version.mk
endif
-rm -f build build-static
if test -d obj && cd obj && test -f Makefile; then $(MAKE) distclean; fi
if test -d obj-static && cd obj-static && test -f Makefile; then $(MAKE) distclean; fi
ifneq (zsh-beta,$(package))
test ! -f Makefile || $(MAKE) distclean
endif
-rm -f `find . -name "*~"` \
debian/files* core debian/*ubstvars \
stamp-configure stamp-configure-static \
config.cache config.status config.status.lineno \
Doc/zsh.idx config.h.in~
-rm -rf debian/tmp debian/tmp-doc debian/tmp-static debian/tmp-dbg \
debian/tmp-dev config.cache obj obj-static \
autom4te.cache
binary-indep: checkroot build
$(checkdir)
-rm -rf debian/tmp-doc
$(INSTALL_DIR) debian/tmp-doc
cd debian/tmp-doc && $(INSTALL_DIR) usr/share/doc-base \
usr/share/info \
usr/share/doc/$(package)-doc/html \
DEBIAN
-cd obj && $(MAKE) install.info DESTDIR=$(CURDIR)/debian/tmp-doc
rm -f debian/tmp-doc/usr/share/info/dir*
gzip -9frq debian/tmp-doc/usr/share/info/*
cd obj && $(MAKE) install.html DESTDIR=$(CURDIR)/debian/tmp-doc htmldir=/usr/share/doc/$(package)-doc/html
# Work around texi2html unfriendliness
sed -i -e 's/<BODY.*>/<BODY LANG="EN">/' debian/tmp-doc/usr/share/doc/$(package)-doc/html/*.html
ifeq (zsh,$(package))
$(INSTALL_FILE) obj/Doc/zsh.pdf debian/tmp-doc/usr/share/doc/$(package)-doc/
endif
$(INSTALL_FILE) debian/copyright debian/tmp-doc/usr/share/doc/$(package)-doc/copyright
$(INSTALL_FILE) debian/changelog debian/tmp-doc/usr/share/doc/$(package)-doc/changelog.Debian
gzip -9frq debian/tmp-doc/usr/share/doc/$(package)-doc/changelog.Debian
$(INSTALL_FILE) debian/$(package).doc-base debian/tmp-doc/usr/share/doc-base/$(package)
cd debian/tmp-doc && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
dpkg-gencontrol -isp -p$(package)-doc -Pdebian/tmp-doc
chown -R root.root debian/tmp-doc
chmod -R go=rX debian/tmp-doc
dpkg --build debian/tmp-doc ..
ifneq (zsh-beta,$(package))
binary-arch: binary-arch-dynamic binary-arch-static binary-arch-dev
else
binary-arch: binary-arch-dynamic
endif
binary-arch-dynamic: checkroot build
$(checkdir)
-rm -rf debian/tmp debian/tmp-dbg
$(INSTALL_DIR) debian/tmp debian/tmp-dbg/usr/lib/debug/bin debian/tmp-dbg/DEBIAN
cd debian/tmp && $(INSTALL_DIR) etc/$(package) \
bin \
usr/lib/$(package) \
usr/share/menu \
usr/share/man \
usr/share/$(package)/help \
usr/share/doc/$(package)/examples/Functions \
usr/share/doc/$(package)/examples/Misc \
usr/share/doc/$(package)/examples/old \
DEBIAN
cd obj && $(MAKE) install.man DESTDIR=$(CURDIR)/debian/tmp
nroff -mandoc -Tascii Doc/zshbuiltins.1 | colcrt - | \
sed -e 's/�/{+|-}/' | ( cd debian/tmp/usr/share/$(package)/help && \
perl $(CURDIR)/Util/helpfiles )
ifeq (zsh-beta,$(package))
sed -r -i -e \
's/zsh(all|builtins|compctl|compsys|compwid|contrib|expn|misc|modules|options|param|roadmap|tcpsys|zftpsys|zle|calsys)/$(package)\1/g' \
debian/tmp/usr/share/man/man1/*.1
endif
# functions
$(INSTALL_FILE) -m 644 Misc/* debian/tmp/usr/share/doc/$(package)/examples/Misc/.
$(INSTALL_FILE) -m 644 Functions/Example/* debian/tmp/usr/share/doc/$(package)/examples/Functions/.
sed -i -e '1!b;s:^#!.*[ /]zsh:#!/bin/$(package):;s#/usr/local/bin#/usr/bin#' \
debian/tmp/usr/share/doc/$(package)/examples/Misc/*
$(INSTALL_FILE) StartupFiles/* debian/tmp/usr/share/doc/$(package)/examples/.
$(INSTALL_FILE) Util/reporter debian/tmp/usr/share/doc/$(package)/examples/.
$(INSTALL_FILE) debian/examples/ssh_completion \
debian/examples/ssh_completion2 \
debian/examples/carstenh.zshrc \
debian/tmp/usr/share/doc/$(package)/examples/.
ifneq (zsh-beta,$(package))
$(INSTALL_FILE) debian/examples/compctl.dpkg debian/examples/jhm.zshrc debian/tmp/usr/share/doc/$(package)/examples/old/.
endif
cd obj && $(MAKE) install.bin DESTDIR=$(CURDIR)/debian/tmp INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
cd obj && $(MAKE) install.modules DESTDIR=$(CURDIR)/debian/tmp INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
cd obj && $(MAKE) install.fns DESTDIR=$(CURDIR)/debian/tmp
rm -r debian/tmp/usr/local
# move this to a non-root section; also drop it for cross-compiles
awk '/^#define FPATH_DIR/ { head=$$3; gsub(/"/,"",head); }; /^#define FPATH_SUBDIRS/ { $$1=""; $$2=""; gsub(/[" ]/,""); tail=$$0; } END { printf "%s/%s\n", head, tail; };' obj/Src/zshpaths.h >obj/Src/zshpaths.temp
debian/tmp/bin/$(package) -fc 'setopt extendedglob; for i in debian/tmp/'`cat obj/Src/zshpaths.temp`'; do zcompile -U -M $$i.zwc $$i/*~*.zwc(^/) ; chmod 644 $$i.zwc ; done'
ifneq (zsh-beta,$(package))
mv debian/tmp/bin/zsh debian/tmp/bin/zsh5
rm debian/tmp/bin/zsh-5.[0-9]*
ln -s zsh.1.gz debian/tmp/usr/share/man/man1/zsh5.1.gz
for i in `find debian/tmp/usr/lib/zsh -type d | sed 's#^debian/tmp/##'`; \
do mkdir -p debian/tmp-dbg/usr/lib/debug/"$$i"; done
objcopy --only-keep-debug debian/tmp/bin/zsh5 \
debian/tmp-dbg/usr/lib/debug/bin/zsh5.dbg
strip --remove-section=.comment --remove-section=.note debian/tmp/bin/zsh5
objcopy --add-gnu-debuglink=debian/tmp-dbg/usr/lib/debug/bin/zsh5.dbg debian/tmp/bin/zsh5
for i in `find debian/tmp/usr/lib/zsh -name "*.so"`; \
do objcopy --only-keep-debug $$i debian/tmp-dbg/usr/lib/debug/`echo $$i | sed 's#^debian/tmp/##'`.debug; \
strip --remove-section=.comment --remove-section=.note \
--strip-unneeded $$i; \
objcopy --add-gnu-debuglink=debian/tmp-dbg/usr/lib/debug/`echo $$i | sed 's#^debian/tmp/##'`.debug $$i; \
done
else
rm debian/tmp/bin/zsh-beta-*
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
strip --remove-section=.comment --remove-section=.note debian/tmp/bin/zsh-beta
strip --remove-section=.comment --remove-section=.note \
--strip-unneeded `find debian/tmp/usr/lib/zsh-beta -name "*.so"`
endif
endif
$(INSTALL_DIR) debian/tmp-dbg/usr/share/doc
ln -s zsh debian/tmp-dbg/usr/share/doc/$(package)-dbg
$(INSTALL_FILE) debian/zlogin debian/zlogout debian/zprofile debian/zshenv debian/zshrc debian/newuser.zshrc.recommended debian/tmp/etc/$(package)/.
sed -i -e 's,^local HELPDIR=.*,local HELPDIR=$${HELPDIR:-/usr/share/$(package)/help},;s,:-more,:-/usr/bin/pager,;' debian/tmp/usr/share/$(package)/functions/Misc/run-help
sed -i -e '1!b;s:^#!.*[ /]zsh:#!/bin/$(package):;s#/usr/local/bin#/usr/bin#;' `find debian/tmp/usr/share/$(package)/functions -type f`
chmod 755 debian/tmp/usr/share/$(package)/functions/Misc/checkmail \
debian/tmp/usr/share/$(package)/functions/Misc/harden \
debian/tmp/usr/share/$(package)/functions/Misc/run-help \
debian/tmp/usr/share/$(package)/functions/Misc/zkbd \
debian/tmp/usr/share/$(package)/functions/Misc/zcalc \
$(INSTALL_FILE) Etc/ChangeLog* README META-FAQ Doc/zsh.texi Etc/BUGS Etc/CONTRIBUTORS FEATURES \
Etc/FTP-README MACHINES NEWS Etc/TODO Etc/completion-style-guide Etc/zsh-development-guide Functions/README.zftp debian/tmp/usr/share/doc/$(package)/
$(INSTALL_FILE) ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
chmod -R u+rw,go=rX debian/tmp/usr/share/doc
$(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/$(package)/copyright
$(INSTALL_FILE) debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
ifeq (zsh-beta,$(package))
$(INSTALL_FILE) debian/NEWS debian/tmp/usr/share/doc/$(package)/NEWS.Debian
endif
$(INSTALL_FILE) debian/README.Debian debian/tmp/usr/share/doc/$(package)/README.Debian
$(INSTALL_FILE) debian/menu debian/tmp/usr/share/menu/$(package)
chmod 644 `find debian/tmp/usr/share/man -type f` `find debian/tmp/usr/share/doc -type f`
chmod 644 `find debian/tmp/usr/lib/$(package) -type f -name "*.so"`
chmod 644 `find debian/tmp/usr/share/$(package) -type f -name "_*"`
gzip -9f `find debian/tmp/usr/share/man -type f` `find debian/tmp/usr/share/doc -type f ! -name "copyright"`
dpkg-shlibdeps -Tdebian/substvars -dDepends debian/tmp/bin/* -dRecommends debian/tmp/usr/lib/$(package)/*/zsh/*.so
dpkg-gencontrol -ldebian/changelog -isp -p$(package) -Tdebian/substvars -Pdebian/tmp
ifneq (zsh-beta,$(package))
cd debian/tmp-dbg && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
dpkg-gencontrol -ldebian/changelog -isp -p$(package)-dbg -Tdebian/substvars -Pdebian/tmp-dbg
endif
$(INSTALL_SCRIPT) debian/postinst debian/tmp/DEBIAN/postinst
$(INSTALL_SCRIPT) debian/postrm debian/tmp/DEBIAN/postrm
$(INSTALL_SCRIPT) debian/prerm debian/tmp/DEBIAN/prerm
$(INSTALL_FILE) debian/conffiles debian/tmp/DEBIAN/conffiles
cd debian/tmp && find * -type f ! -path "etc/$(package)/zlogin" ! -path "etc/$(package)/zlogout" ! -path "etc/$(package)/zprofile" ! -path "etc/$(package)/zshenv" ! -path "etc/$(package)/zshrc" ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
ifneq (zsh-beta,$(package))
chown -R root:root debian/tmp debian/tmp-dbg
chmod -R go=rX debian/tmp debian/tmp-dbg
else
chown -R root:root debian/tmp
chmod -R go=rX debian/tmp
endif
dpkg --build debian/tmp ..
ifneq (zsh-beta,$(package))
dpkg --build debian/tmp-dbg ..
endif
define checkdir
test -f debian/rules
endef
binary-arch-static: checkroot build-static
$(checkdir)
-rm -rf debian/tmp-static
$(INSTALL_DIR) debian/tmp-static/usr/share/man/man1/
cd debian/tmp-static && $(INSTALL_DIR) bin \
usr/share/doc/$(package)-static \
usr/share/lintian/overrides \
DEBIAN
$(INSTALL_SCRIPT) debian/static.prerm debian/tmp-static/DEBIAN/prerm
$(INSTALL_SCRIPT) debian/static.postinst debian/tmp-static/DEBIAN/postinst
$(INSTALL_SCRIPT) debian/static.postrm debian/tmp-static/DEBIAN/postrm
$(INSTALL_FILE) debian/changelog debian/tmp-static/usr/share/doc/$(package)-static/changelog.Debian
$(INSTALL_FILE) debian/$(package)-static.lintian-overrides debian/tmp-static/usr/share/lintian/overrides/$(package)-static
awk 'BEGIN { print "The following modules are statically-compiled into the static $(package) binary:\n"; } /link=static/ { printf "%s (%s %s)\n", substr($$1,6), $$4, $$5; }' obj-static/config.modules >debian/tmp-static/usr/share/doc/$(package)-static/README.Debian
$(INSTALL_FILE) debian/copyright debian/tmp-static/usr/share/doc/$(package)-static/copyright
$(INSTALL_PROGRAM) obj-static/Src/zsh debian/tmp-static/bin/zsh5-static
strip --remove-section=.comment --remove-section=.note debian/tmp-static/bin/zsh5-static
gzip -9f debian/tmp-static/usr/share/doc/$(package)-static/changelog.Debian
cd debian/tmp-static && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
ln -s $(package).1.gz debian/tmp-static/usr/share/man/man1/zsh5-static.1.gz
ifneq (zsh-beta,$(package))
dpkg-shlibdeps -Tdebian/$(package)-static.substvars -dDepends debian/tmp-static/bin/*
endif
dpkg-gencontrol -ldebian/changelog -isp -p$(package)-static -Tdebian/$(package)-static.substvars -Pdebian/tmp-static
chown -R root.root debian/tmp-static
chmod -R go=rX debian/tmp-static
dpkg --build debian/tmp-static ..
binary-arch-dev: checkroot build
$(INSTALL_DIR) debian/tmp-dev/usr/include/$(package) \
debian/tmp-dev/usr/share/$(package)-dev \
debian/tmp-dev/usr/share/doc/$(package)-dev \
debian/tmp-dev/usr/share/aclocal \
debian/tmp-dev/DEBIAN
$(INSTALL_FILE) obj/Src/*.epro obj/Src/sigcount.h \
Src/hashtable.h Src/prototypes.h \
Src/signals.h Src/zsh_system.h Src/zsh.h Src/ztype.h \
debian/tmp-dev/usr/include/$(package)
$(INSTALL_FILE) Src/makepro.awk debian/tmp-dev/usr/share/$(package)-dev
$(INSTALL_FILE) Config/aczshoot.m4 debian/tmp-dev/usr/share/aclocal/$(package)oot.m4
$(INSTALL_FILE) debian/changelog debian/tmp-dev/usr/share/doc/$(package)-dev/changelog.Debian
$(INSTALL_FILE) debian/copyright debian/tmp-dev/usr/share/doc/$(package)-dev/
gzip -9f debian/tmp-dev/usr/share/doc/$(package)-dev/changelog.Debian
cd debian/tmp-dev && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
dpkg-gencontrol -ldebian/changelog -isp -p$(package)-dev -Tdebian/$(package)-dev.substvars -Pdebian/tmp-dev
chown -R root.root debian/tmp-dev
chmod -R go=rX debian/tmp-dev
dpkg --build debian/tmp-dev ..
ifneq (zsh-beta,$(package))
binary: binary-indep binary-arch binary-arch-static binary-arch-dev
else
binary: binary-indep binary-arch
endif
prebuild:
Util/preconfig
./configure
make -C Doc
make distclean
rm -rf autom4te.cache
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot binary-arch-dynamic binary-arch-static prebuild binary-arch-dev
|