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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
#! /usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1
unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES
# architecture dependent variables
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
VERSION := 3.1
#PKGVERSION := $(shell dpkg-parsechangelog \
# | sed -n '/Version:/s/\(.* \)\(.*\)-2\(.*\)/\2\3/p')
#PKGVERSION := 3.0
#dpkg_ctrl_args := -v$(PKGVERSION) -VBinary-Version=$(PKGVERSION)
with_gfdl = no
CC = gcc
CFLAGS = -g -O2
SHELL = bash
YACC = bison -y
IX = install -o 0 -g 0
ID = install -o 0 -g 0 -m 644
# built with installed libreadline?
with_installed_rl = no
debflags =
PWD := $(shell pwd)
p = bash
p_min = bash-minimal
p_stat = bash-static
d = debian/$(p)
d_min = debian/$(p_min)
d_stat = debian/$(p_stat)
conf_args = \
--with-curses \
--disable-net-redirections \
--enable-largefile \
--prefix=/usr \
--infodir=/usr/share/info \
--mandir=/usr/share/man
ifeq ($(with_installed_rl),yes)
conf_args += --with-installed-readline
endif
static_conf_args := $(conf_args) \
--enable-static-link \
--without-bash-malloc \
--host=$(DEB_HOST_GNU_TYPE)
conf_args += --host=$(DEB_HOST_GNU_TYPE)
min_conf_args = \
--enable-minimal-config \
--enable-largefile \
--prefix=/usr \
--infodir=/usr/share/info \
--mandir=/usr/share/man
min_conf_args += --host=$(DEB_HOST_GNU_TYPE)
#build: bash-build minimal-build static-build preinst-build all-bashdb-build check
build: before-build bash-build minimal-build static-build preinst-build
before-build:
: # see #327477, needed to have HAVE_DEV_STDIN defined
(test -d /dev/fd && test -r /dev/stdin < /dev/null) \
|| (test -d /proc/self/fd && test -r /dev/stdin < /dev/null)
ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux freebsd))
$(CC) $(CFLAGS) -o clear_console debian/clear_console.c -lncurses
endif
# ---------------------------------------------------------------------------
# build standard bash
bash-build:
$(MAKE) -f debian/rules do-build-bash \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=bash \
configure_args="$(conf_args)"
bash-configure:
$(MAKE) -f debian/rules do-configure-bash \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=bash \
configure_args="$(conf_args)"
# ---------------------------------------------------------------------------
# build minimal bash
minimal-build:
$(MAKE) -f debian/rules do-build-min \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=min \
configure_args="$(min_conf_args)"
minimal-configure:
$(MAKE) -f debian/rules do-configure-min \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=min \
configure_args="$(min_conf_args)"
# ---------------------------------------------------------------------------
# build static bash
static-build:
$(MAKE) -f debian/rules do-build-static \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=static \
configure_args="$(static_conf_args)"
static-configure:
$(MAKE) -f debian/rules do-configure-static \
bash_src=bash \
bash_patches="$(debian_patches)" \
build=static \
configure_args="$(static_conf_args)"
# ---------------------------------------------------------------------------
# build standard bash
all-bashdb-build: bashdb-build #bashdb-doc-build
bashdb-build:
DEBUGGER_START_FILE=/usr/share/bashdb/dbg-main.inc \
$(MAKE) -f debian/rules do-build-bashdb \
bash_src=bashdb \
bash_patches="$(bashdb_patches)" \
build=bashdb \
configure_args="$(conf_args)"
bashdb-configure:
DEBUGGER_START_FILE=/usr/share/bashdb/dbg-main.inc \
$(MAKE) -f debian/rules do-configure-bashdb \
bash_src=bashdb \
bash_patches="$(bashdb_patches)" \
build=bashdb \
configure_args="$(conf_args)"
bashdb-doc-build: stamps/stamp-build-bashdb-doc
stamps/stamp-build-bashdb-doc:
cp -p build-bashdb/doc/version.texi bashdb/doc/
cp -p build-bashdb/debugger/doc/version.texi bashdb/debugger/doc/
# $(MAKE) -C build-bashdb doc
$(MAKE) -C build-bashdb/debugger/doc
touch stamps/stamp-build-bashdb-doc
# ---------------------------------------------------------------------------
bash-doc-build: stamps/stamp-build-bash-doc
stamps/stamp-build-bash-doc:
ifeq ($(with_gfdl),yes)
rm -f bash/doc/bashref.info
$(MAKE) -C build-bash/doc bashref.info bashref.pdf
endif
touch stamps/stamp-build-bash-doc
# ---------------------------------------------------------------------------
check: stamps/stamp-check
stamps/stamp-check: bash-build
@echo BEGIN test
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-sh debian/locale-gen
LOCPATH=$(PWD)/locales \
$(MAKE) -C build-bash test 2>&1 | tee build-bash/test-protocol
else
@echo Suppress 'make' test, because this is cross build
endif
@echo END test
touch stamps/stamp-check
# ---------------------------------------------------------------------------
clean:
dh_testdir
dh_testroot
rm -rf stamps build-* bash bashdb
rm -f debian/bash.preinst
rm -f debian/README.Debian
rm -rf locales
rm -f clear_console
dh_clean
preinst-build: debian/bash.preinst
debian/bash.preinst: debian/bash.preinst.c
$(CC) -O2 -s -o debian/bash.preinst debian/bash.preinst.c
# ---------------------------------------------------------------------------
install: bash-install #bashdb-install
bash-install: bash-build stamps/stamp-install-bash
stamps/stamp-install-bash: stamps/stamp-build-bash
dh_testdir
dh_testroot
dh_clean -k -p$(p)
dh_installdirs -p$(p) \
bin \
etc/skel \
etc/bash_completion.d \
usr/share/doc/$(p)
ifeq ($(with_gfdl),yes)
# XXXXX
cp -p build-bash/doc/*.info bash/doc/
endif
: # install it
$(MAKE) -C build-bash install \
CC='$(CC)' \
CFLAGS='$(CFLAGS)' \
YACC="$(YACC)" \
DESTDIR=$(PWD)/$(d)
mv $(d)/usr/bin/bash $(d)/bin/.
chmod 755 $(d)/usr/bin/bashbug
ifneq ($(with_gfdl),yes)
mkdir -p $(d)/usr/share/man/man1
cp -p bash/doc/bash.1 $(d)/usr/share/man/man1/bash.1
endif
: # extra links
ln -sf bash $(d)/bin/rbash
ln -sf bash $(d)/bin/sh
ln -sf bash.1 $(d)/usr/share/man/man1/sh.1
: # skeleton files
$(ID) debian/etc.bash.bashrc $(d)/etc/bash.bashrc
$(ID) debian/skel.bashrc $(d)/etc/skel/.bashrc
$(ID) debian/skel.bash_profile $(d)/etc/skel/.bash_profile
$(ID) debian/skel.bash_logout $(d)/etc/skel/.bash_logout
: # clean_console
ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux freebsd))
$(IX) clear_console $(d)/usr/bin/
$(ID) debian/clear_console.1 $(d)/usr/share/man/man1/
endif
: # install bash-completion
$(ID) debian/bash_completion/bash_completion $(d)/etc/.
cp -a debian/bash_completion/contrib \
$(d)/usr/share/doc/$(p)/completion-contrib
chmod 755 $(d)/usr/share/doc/$(p)/completion-contrib
chmod 644 $(d)/usr/share/doc/$(p)/completion-contrib/*
$(ID) debian/bash_completion/Changelog \
$(d)/usr/share/doc/$(p)/changelog.bash_completion
$(ID) debian/README.bash_completion $(d)/usr/share/doc/$(p)/
cat debian/bash_completion/README \
>> $(d)/usr/share/doc/$(p)/README.bash_completion
$(ID) debian/bash_completion/BUGS \
$(d)/usr/share/doc/bash/BUGS.bash_completion
ifeq ($(with_gfdl),yes)
: # files for the bash-doc package
mv $(d)/usr/share/info/bash.info $(d)/usr/share/info/bashref.info
ln -sf bashref.info $(d)/usr/share/info/bash.info
: # mv $(d)/usr/share/info $(d_doc)/usr/share/
rm -rf $(d)/usr/share/info
endif
: # cat debian/README stamps/stamp-patch-bash > debian/README.Debian
cat debian/README > debian/README.Debian
touch stamps/stamp-install-bash
binary-bash: bash-install debian/bash.preinst
dh_testdir
dh_testroot
dh_installchangelogs -p$(p) bash/CWRU/changelog
dh_installdocs -p$(p) \
bash/{CHANGES,NEWS,COMPAT,doc/INTRO,POSIX} \
debian/{README.Debian,README.abs-guide,README.commands} \
debian/inputrc.arrows
ifeq ($(with_gfdl),yes)
cp -p bash/doc/FAQ $(d)/usr/share/doc/$(p)/.
endif
cp -p debian/FAQ $(d)/usr/share/doc/$(p)/.
dh_installman -p$(p) bash/doc/rbash.1 debian/bash-builtins.7
dh_installmenu -p$(p)
dh_strip -p$(p)
dh_compress -p$(p)
dh_fixperms -p$(p)
dh_shlibdeps -p$(p) -- -dPre-Depends $(d)/bin/bash debian/bash.preinst
dh_installdeb -p$(p)
dh_gencontrol -p$(p)
dh_md5sums -p$(p)
dh_builddeb -p$(p)
binary-static: static-build
dh_testdir
dh_testroot
dh_clean -k -p$(p_stat)
dh_installdirs -p$(p_stat) \
bin \
usr/share/man/man1
cp -p build-static/bash $(d_stat)/bin/bash-static
cp -p bash/doc/bash.1 $(d_stat)/usr/share/man/man1/bash-static.1
dh_installdocs -p$(p_stat)
dh_installchangelogs -p$(p_stat)
dh_strip -p$(p_stat)
dh_compress -p$(p_stat)
dh_fixperms -p$(p_stat)
dh_installdeb -p$(p_stat)
dh_gencontrol -p$(p_stat)
dh_md5sums -p$(p_stat)
dh_builddeb -p$(p_stat)
binary-minimal: minimal-build
dh_testdir
dh_testroot
dh_clean -k -p$(p_min)
dh_installdirs -p$(p_min) \
bin \
usr/share/man/man1
cp -p build-min/bash $(d_min)/bin/bash-minimal
cp -p debian/bash-minimal.1 $(d_min)/usr/share/man/man1/.
dh_installdocs -p$(p_min)
dh_installchangelogs -p$(p_min)
dh_strip -p$(p_min)
dh_compress -p$(p_min)
dh_fixperms -p$(p_min)
dh_shlibdeps -p$(p_min)
dh_installdeb -p$(p_min)
dh_gencontrol -p$(p_min)
dh_md5sums -p$(p_min)
dh_builddeb -p$(p_min)
binary-indep: binary-doc
binary-arch: binary-bash binary-builtins binary-static binary-minimal #binary-bashdb
binary: binary-indep binary-arch
# ---------------------------------------------------------------------------
# common rules for all bash build variations
do-build-$(build): stamps/stamp-build-$(build)
stamps/stamp-build-$(build): stamps/stamp-configure-$(build)
dh_testdir
$(MAKE) -C build-$(build) \
CC='$(CC)' \
CFLAGS='$(CFLAGS)' \
YACC="$(YACC)" \
deb_builddir=build-$(build)/ \
$(debflags)
ifeq ($(with_gfdl),yes)
# XXX not done by toplevel make?
$(MAKE) -C build-$(build)/doc \
bash.info
endif
touch stamps/stamp-build-$(build)
do-configure-$(build): stamps/stamp-configure-$(build)
stamps/stamp-configure-$(build): stamps/stamp-unpack-$(bash_src)
dh_testdir
rm -rf build-$(build)
mkdir build-$(build)
cd build-$(build) && \
CC="$(CC)" CFLAGS="$(CFLAGS)" YACC="$(YACC)" \
../$(bash_src)/configure $(configure_args)
if ! grep -q '#define HAVE_DEV_STDIN 1' build-$(build)/config.h; then \
echo "HAVE_DEV_STDIN not defined, abortig build"; \
exit 1; \
fi
touch stamps/stamp-configure-$(build)
patchdir = debian/patches
debian_patches = \
bash31-001 \
bash31-002 \
bash31-003 \
bash31-004 \
bash31-005 \
bash31-006 \
bash31-007 \
bash31-008 \
bash31-009 \
bash31-010 \
bash31-011 \
bash31-012 \
bash31-013 \
bash31-014 \
bash31-015 \
bash31-016 \
bash31-017 \
readline51-001 \
rl-inputrc \
bashbug-editor \
deb-bash-config \
deb-examples \
man-arithmetic \
man-fignore \
man-bashrc \
man-bashlogout \
man-substring-exp \
man-nocaseglob \
man-test \
man-test2 \
man-net-redirections \
privmode \
rbash-manpage \
command-not-found \
bash-default-editor \
ulimit \
po-sv \
bash-subst-param-length \
pgrp-pipe \
input-err \
read-memleak \
login-shell \
man-typos \
ifeq ($(with_gfdl),yes)
debian_patches += \
bash31-002-doc \
command-not-found-doc \
man-substring-exp-doc \
man-test2-doc \
ulimit-doc \
man-net-redirections-doc \
endif
# all debian_patches, without bash205b-*
# patches integrated in bashdb: builtins-shift, execute-cmd, man-arithmetic,
# man-builtin, man-fignore, random, rbash-manpage, report-155436,
# rl-8bit-init, s390-build
# and bashdb patch
# rbash-manpage \
bashdb_patches = \
bashdb \
rl-examples-bdb \
rl-inputrc \
bashbug-editor \
deb-bash-config \
deb-examples \
privmode \
# various \
# these are applied in bashdb cvs as well
# man-arithmetic \
# man-fignore \
# random \
# report-155436 \
# s390-build \
# builtins-shift
#patch-$(bash_src): stamps/stamp-patch-$(bash_src)
#stamps/stamp-patch-$(bash_src): stamps/stamp-unpack-$(bash_src) \
# $(foreach p,$(bash_patches),stamps/stamp-patch-$(bash_src)-$(p))
# echo -e "\nPatches applied in this version:" > pxxx
# for i in $(bash_patches); do \
# echo -e "\n$$i:" >> pxxx; \
# sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.dpatch >> pxxx; \
# done
# mv -f pxxx $@
#stamps/stamp-patch-$(bash_src)-%: $(patchdir)/%.dpatch
# if [ -x $< ]; then true; else chmod +x $<; fi
# if [ -f $@ ]; then \
# echo "$* patches already applied."; exit 1; \
# fi
# $< -patch -d $(bash_src)
# echo "$* patches applied." > $@
unpack-$(bash_src): stamps/stamp-unpack-$(bash_src)
stamps/stamp-unpack-$(bash_src):
mkdir -p stamps
rm -rf bash-$(VERSION) $(bash_src)
rm -f stamps/stamp-patch-$(bash_src){,-*}
tar c --exclude='bash-src.tar' --exclude='debian' --exclude='.git' \
--exclude='stamps' --exclude='bash' --exclude='build-bash' \
--exclude='build-min' --exclude='build-static' \
-f bash-src.tar .
mkdir -p $(bash_src)
tar x -C $(bash_src) -f bash-src.tar
rm -f bash-src.tar
cp -p /usr/share/misc/config.* $(bash_src)/.
cp -p /usr/share/misc/config.* $(bash_src)/support/.
touch stamps/stamp-unpack-$(bash_src)
.PHONY: unpack patch binary binary-arch binary-indep clean \
build bash-build minimal-build static-build preinst-build \
all-bashdb-build bashdb-build bashdb-doc-build \
check \
bash-configure minimal-configure static-configure bashdb-configure \
binary-doc binary-bash binary-builtins binary-static binary-bashdb \
install bash-install bashdb-install
# Local Variables:
# mode: makefile
# end:
|