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
|
#!/usr/bin/make -f
INSTALL = install
INSTALL_PROGRAM = $(INSTALL) -p -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
build: stamp-configure
dh_testdir
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
dh_testdir
cd obj-static && $(MAKE)
touch build-static
build-debug: DEB_BUILD_OPTIONS+=debug
build-debug: build
stamp-configure:
dh_testdir
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:
dh_testdir
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:
dh_testdir
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))
dh_auto_clean
endif
dh_clean
-rm -rf config.cache obj obj-static autom4te.cache
binary-indep: checkroot build
dh_testdir
dh_installdirs -p$(package)-doc
-cd obj && $(MAKE) install.info DESTDIR=$(CURDIR)/debian/zsh-doc
rm -f debian/zsh-doc/usr/share/info/dir*
gzip -9frq debian/zsh-doc/usr/share/info/*
cd obj && $(MAKE) install.html DESTDIR=$(CURDIR)/debian/zsh-doc htmldir=/usr/share/doc/$(package)-doc/html
# Work around texi2html unfriendliness
sed -i -e 's/<BODY.*>/<BODY LANG="EN">/' debian/zsh-doc/usr/share/doc/$(package)-doc/html/*.html
dh_installdocs -p$(package)-doc
dh_installchangelogs -p$(package)-doc
dh_compress -p$(package)-doc -Xpdf
dh_fixperms -p$(package)-doc
dh_installdeb -p$(package)-doc
dh_md5sums -p$(package)-doc
dh_gencontrol -p$(package)-doc
dh_builddeb -p$(package)-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
dh_testdir
dh_installdirs -p$(package) -p$(package)-dbg
cd obj && $(MAKE) install.man DESTDIR=$(CURDIR)/debian/zsh
nroff -mandoc -Tascii Doc/zshbuiltins.1 | colcrt - | \
sed -e 's/�/{+|-}/' | ( cd debian/zsh/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/zsh/usr/share/man/man1/*.1
endif
# functions
dh_installexamples -p$(package) -X.distfiles
cd debian/zsh/usr/share/doc/$(package)/examples/; mv Example Functions
sed -i -e '1!b;s:^#!.*[ /]zsh:#!/bin/$(package):;s#/usr/local/bin#/usr/bin#' \
debian/zsh/usr/share/doc/$(package)/examples/Misc/*
cd obj && $(MAKE) install.bin DESTDIR=$(CURDIR)/debian/$(package) INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
cd obj && $(MAKE) install.modules DESTDIR=$(CURDIR)/debian/$(package) INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
cd obj && $(MAKE) install.fns DESTDIR=$(CURDIR)/debian/zsh
rm -r debian/zsh/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/zsh/bin/$(package) -fc 'setopt extendedglob; for i in debian/zsh/'`cat obj/Src/zshpaths.temp`'; do zcompile -U -M $$i.zwc $$i/*~*.zwc(^/) ; chmod 644 $$i.zwc ; done'
ifneq (zsh-beta,$(package))
mv debian/zsh/bin/zsh debian/zsh/bin/zsh5
rm debian/zsh/bin/zsh-5.[0-9]*
dh_link -p$(package)
dh_strip -p$(package) --dbg-package=$(package)-dbg
endif
dh_link -p$(package)-dbg
dh_install -p$(package) -p$(package)-dbg
sed -i -e 's,^local HELPDIR=.*,local HELPDIR=$${HELPDIR:-/usr/share/$(package)/help},;s,:-more,:-/usr/bin/pager,;' debian/zsh/usr/share/$(package)/functions/Misc/run-help
sed -i -e '1!b;s:^#!.*[ /]zsh:#!/bin/$(package):;s#/usr/local/bin#/usr/bin#;' `find debian/zsh/usr/share/$(package)/functions -type f`
chmod 755 debian/zsh/usr/share/$(package)/functions/Misc/checkmail \
debian/zsh/usr/share/$(package)/functions/Misc/harden \
debian/zsh/usr/share/$(package)/functions/Misc/run-help \
debian/zsh/usr/share/$(package)/functions/Misc/zkbd \
debian/zsh/usr/share/$(package)/functions/Misc/zcalc \
dh_installmenu -p$(package)
dh_shlibdeps -p$(package) -p$(package)-dbg -- -dDepends debian/zsh/bin/* -dRecommends debian/zsh/usr/lib/$(package)/*/zsh/*.so
dh_installdocs -p$(package) -p$(package)-dbg
dh_installchangelogs -p$(package) -p$(package)-dbg ChangeLog
dh_compress -p$(package) -p$(package)-dbg
dh_fixperms -p$(package) -p$(package)-dbg
dh_installdeb -p$(package) -p$(package)-dbg
dh_md5sums -p$(package) -p$(package)-dbg
dh_gencontrol -p$(package) -p$(package)-dbg
dh_builddeb -p$(package) -p$(package)-dbg
binary-arch-static: checkroot build-static
dh_testdir
dh_installdirs -p$(package)-static
dh_lintian -p$(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/zsh-static/usr/share/doc/$(package)-static/README.Debian
dh_install -p$(package)-static
mv debian/$(package)-static/bin/zsh debian/$(package)-static/bin/zsh5-static
ifneq (zsh-beta,$(package))
dh_shlibdeps -p$(package)-static
endif
dh_strip -p$(package)-static
dh_link -p$(package)-static
dh_installdocs -p$(package)-static
dh_installchangelogs -p$(package)-static
dh_compress -p$(package)-static
dh_fixperms -p$(package)-static
dh_installdeb -p$(package)-static
dh_md5sums -p$(package)-static
dh_gencontrol -p$(package)-static
dh_builddeb -p$(package)-static
binary-arch-dev: checkroot build
dh_installdirs -p$(package)-dev
dh_install -p$(package)-dev
cd debian/$(package)-dev/usr/share/aclocal; mv aczshoot.m4 zshoot.m4
dh_installdocs -p$(package)-dev
dh_installchangelogs -p$(package)-dev
dh_compress -p$(package)-dev
dh_fixperms -p$(package)-dev
dh_installdeb -p$(package)-dev
dh_md5sums -p$(package)-dev
dh_gencontrol -p$(package)-dev
dh_builddeb -p$(package)-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:
dh_testdir
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot binary-arch-dynamic binary-arch-static prebuild binary-arch-dev
|