blob: 57f45e77c2937c365f701b0cd02000e65c900346 (
plain)
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
|
#!/usr/bin/make -f
# vim: nowrap ts=8
# Build locations
BUILD := $(shell pwd)/build
TMP := $(shell pwd)/debian/tmp
TMP_DPKG := $(TMP)-dpkg
TMP_DPKG_DEV := $(TMP)-dpkg-dev
TMP_DPKG_DOC := $(TMP)-dpkg-doc
DIR := $(shell pwd)
# We should really get this in a different way...
arch = $(shell dpkg --print-architecture)
# Setup the buildlocation
$(BUILD)/config.status:
$(checkdir)
install -d $(BUILD)
cd $(BUILD) && $(DIR)/configure \
--prefix=/usr \
--datadir=/usr/share \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--sharedstatedir=/var/lib \
--localstatedir=/var/lib \
--with-admindir=/var/lib/dpkg
clean:
$(checkdir)
rm -f debian/files debian/substvars
rm -f debian/dpkg,substvars
rm -fr $(BUILD) $(TMP) $(TMP_DPKG) $(TMP_DPKG_DEV) $(TMP_DPKG_DOC)
rm -f stamp-build stamp-binary
build: stamp-build
stamp-build: $(BUILD)/config.status
$(MAKE) $(MFLAGS) -C $(BUILD)
touch stamp-build
binary: binary-arch binary-indep
stamp-binary: stamp-build
$(checkdir)
test "`id -u`" -eq 0
rm -rf $(TMP)
$(MAKE) $(MFLAGS) -C $(BUILD) \
admindir=$(TMP)/var/lib/dpkg \
prefix=$(TMP)/usr \
datadir=$(TMP)/usr/share \
mandir=$(TMP)/usr/share/man \
infodir=$(TMP)/usr/share/info \
sysconfdir=$(TMP)/etc \
sharedstatedir=$(TMP)/var/lib \
localstatedir=$(TMP)/var/lib \
install
find $(TMP) -type d | xargs chmod 755
touch stamp-binary
binary-dpkg: stamp-binary
rm -rf $(TMP_DPKG)
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/doc/dpkg
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/lib/dpkg
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/bin
install -d -m 755 -o root -g root $(TMP_DPKG)/sbin
mv $(TMP)/etc $(TMP_DPKG)/
mv $(TMP)/var $(TMP_DPKG)/
mv $(TMP)/usr/sbin/start-stop-daemon $(TMP_DPKG)/sbin/
mv $(TMP)/usr/sbin $(TMP_DPKG)/usr/
mv $(TMP)/usr/lib/dpkg/mksplit $(TMP_DPKG)/usr/lib/dpkg/
mv $(TMP)/usr/lib/dpkg/methods $(TMP_DPKG)/usr/lib/dpkg/
mv $(TMP)/usr/share/locale $(TMP_DPKG)/usr/share/
set -e ; for i in dpkg dpkg-deb dpkg-split md5sum dselect ; do \
mv $(TMP)/usr/bin/$$i $(TMP_DPKG)/usr/bin/ ; \
done
set -e ; for i in ChangeLog THANKS TODO copyright ; do \
mv $(TMP)/usr/share/doc/dpkg/$$i $(TMP_DPKG)/usr/share/doc/dpkg/ ; \
done
set -e ; for i in "" ja ; do \
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man1 ; \
for m in md5sum.1 dpkg-deb.1 ; do \
if [ -f $(TMP)/usr/share/man/$$i/man1/$$m ] ; then \
mv $(TMP)/usr/share/man/$$i/man1/$$m $(TMP_DPKG)/usr/share/man/$$i/man1/$$m ; \
fi ; \
done ; \
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man8 ; \
for m in dpkg.8 dselect.8 dpkg-split.8 start-stop-daemon.8 \
cleanup-info.8 dpkg-divert.8 \
install-info.8 update-alternatives.8 update-rc.d.8 ; do \
if [ -f $(TMP)/usr/share/man/$$i/man8/$$m ] ; then \
mv $(TMP)/usr/share/man/$$i/man8/$$m $(TMP_DPKG)/usr/share/man/$$i/man8/$$m ; \
fi ; \
done ; \
done
# Now that dpkg has been installed, Debianize it
# Policy stuff
find $(TMP_DPKG)/usr/share/man -type f | xargs gzip -9f
strip $(TMP_DPKG)/usr/bin/* $(TMP_DPKG)/sbin/*
mv $(TMP_DPKG)/usr/share/doc/dpkg/ChangeLog \
$(TMP_DPKG)/usr/share/doc/dpkg/changelog
install -p -m 644 -o root -g root debian/changelog \
$(TMP_DPKG)/usr/share/doc/dpkg/changelog.Debian
rm -f $(TMP_DPKG)/usr/share/doc/dpkg/copyright
gzip -9 $(TMP_DPKG)/usr/share/doc/dpkg/*
install -p -m 644 -o root -g root debian/copyright \
$(TMP_DPKG)/usr/share/doc/dpkg/
# Final package creation
install -d -m 755 -o root -g root $(TMP_DPKG)/DEBIAN
install -p -m 755 -o root -g root debian/dpkg.preinst $(TMP_DPKG)/DEBIAN/preinst
install -p -m 755 -o root -g root debian/dpkg.prerm $(TMP_DPKG)/DEBIAN/prerm
install -p -m 755 -o root -g root debian/dpkg.postinst $(TMP_DPKG)/DEBIAN/postinst
dpkg-shlibdeps -dPre-Depends -Tdebian/dpkg.substvars \
$(TMP_DPKG)/usr/bin/dpkg $(TMP_DPKG)/usr/bin/dselect
dpkg-gencontrol -Tdebian/dpkg.substvars -pdpkg -P$(TMP_DPKG)
dpkg --build $(TMP_DPKG) ..
binary-dpkg-dev: stamp-binary
rm -rf $(TMP_DPKG_DEV)
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/lib/dpkg
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/bin
mv $(TMP)/usr/lib/dpkg/parsechangelog $(TMP_DPKG_DEV)/usr/lib/dpkg/
mv $(TMP)/usr/lib/dpkg/controllib.pl $(TMP_DPKG_DEV)/usr/lib/dpkg/
mv $(TMP)/usr/share/emacs $(TMP_DPKG_DEV)/usr/share/
set -e ; for i in dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol \
dpkg-shlibdeps dpkg-buildpackage dpkg-distaddfile 822-date \
dpkg-scanpackages dpkg-scansources dpkg-architecture \
dpkg-parsechangelog ; do \
mv $(TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \
done
set -e ; for i in "" ja ; do \
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man1 ; \
for m in dpkg-name.1 dpkg-source.1 822-date.1 dpkg-architecture.1 \
dpkg-buildpackage.1 dpkg-distaddfile.1 dpkg-genchanges.1 \
dpkg-gencontrol.1 dpkg-parsechangelog.1 dpkg-shlibdeps.1 ; do \
if [ -e $(TMP)/usr/share/man/$$i/man1/$$m ] ; then \
mv $(TMP)/usr/share/man/$$i/man1/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man1/$$m ; \
fi ; \
done ; \
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man5 ; \
for m in deb.5 deb-control.5 deb-old.5 ; do \
if [ -e $(TMP)/usr/share/man/$$i/man5/$$m ] ; then \
mv $(TMP)/usr/share/man/$$i/man5/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man5/$$m ; \
fi ; \
done ; \
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man8 ; \
for m in dpkg-scanpackages.8 dpkg-scansources.8 ; do \
if [ -e $(TMP)/usr/share/man/$$i/man8/$$m ] ; then \
mv $(TMP)/usr/share/man/$$i/man8/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man8/$$m ; \
fi ; \
done ; \
done
# Now that dpkg-dev has been installed, Debianize it
# Policy stuff
find $(TMP_DPKG_DEV)/usr/share/man -type f | xargs gzip -9f
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/doc
ln -s dpkg $(TMP_DPKG_DEV)/usr/share/doc/dpkg-dev
# Of course our own emacs system
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/etc/emacs/site-start.d
install -p -m 644 -o root -g root debian/50dpkg-dev.el \
$(TMP_DPKG_DEV)/etc/emacs/site-start.d
# Final package creation
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/DEBIAN
install -p -m 644 -o root -g root debian/dpkg-dev.conffiles $(TMP_DPKG_DEV)/DEBIAN/conffiles
install -p -m 755 -o root -g root debian/dpkg-dev.prerm $(TMP_DPKG_DEV)/DEBIAN/prerm
install -p -m 755 -o root -g root debian/dpkg-dev.postinst $(TMP_DPKG_DEV)/DEBIAN/postinst
dpkg-gencontrol -Tdebian/dpkg-dev.substvars -pdpkg-dev -P$(TMP_DPKG_DEV)
dpkg --build $(TMP_DPKG_DEV) ..
binary-dpkg-doc: stamp-binary
rm -rf $(TMP_DPKG_DOC)
install -d -m 755 -o root -g root $(TMP_DPKG_DOC)/usr/share/doc/dpkg
mv $(TMP)/usr/share/doc/dpkg/internals $(TMP_DPKG_DOC)/usr/share/doc/dpkg/
mv $(TMP)/usr/share/doc/dpkg/ChangeLog.manuals \
$(TMP_DPKG_DOC)/usr/share/doc/dpkg/changelog.manuals
# Now that dpkg-dev has been installed, Debianize it
# Policy stuff
gzip -9f $(TMP_DPKG_DOC)/usr/share/doc/dpkg/[^i]*
ln -s dpkg $(TMP_DPKG_DOC)/usr/share/doc/dpkg-doc
# Register documentation with doc-base
install -d -m 755 -o root -g root $(TMP_DPKG_DOC)/usr/share/doc-base
install -p -m 644 -o root -g root debian/dpkg-doc.doc-base \
$(TMP_DPKG_DOC)/usr/share/doc-base/dpkg-doc
# Final package creation
install -d -m 755 -o root -g root $(TMP_DPKG_DOC)/DEBIAN
install -p -m 755 -o root -g root debian/dpkg-doc.prerm $(TMP_DPKG_DOC)/DEBIAN/prerm
install -p -m 755 -o root -g root debian/dpkg-doc.postinst $(TMP_DPKG_DOC)/DEBIAN/postinst
dpkg-gencontrol -Tdebian/dpkg-dev.substvars -pdpkg-doc -P$(TMP_DPKG_DOC)
dpkg --build $(TMP_DPKG_DOC) ..
binary-arch: binary-dpkg
set -e ; \
v=`sed -n 's/^Version: //p' $(TMP_DPKG)/DEBIAN/control`; \
f=dpkg-$${v}_$(arch).nondebbin.tar ; \
tar -C $(TMP_DPKG) -cf $(DIR)/../$$f usr var ; \
gzip -9f ../$$f ; \
dpkg-distaddfile -fdebian/files $$f.gz byhand -
binary-indep: binary-dpkg-dev binary-dpkg-doc
set -e ; set -x ; \
v=`sed -n 's/^Version: //p' $(TMP_DPKG_DEV)/DEBIAN/control`; \
f=dpkg-$${v}.tar.gz ; \
if [ -f ../dpkg_$${v}.tar.gz ] ; then \
cp ../dpkg_$${v}.tar.gz ../$$f ; \
dpkg-distaddfile -fdebian/files $$f byhand - ; \
fi
define checkdir
test -f include/dpkg.h.in
endef
.PHONY: clean build binary binary-arch binary-indep binary-dpkg binary-dpkg-dev
.PHONY: binary-dpkg-doc binary-nondebbin
|