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
|
#!/usr/bin/make -f
# vim: nowrap ts=8
# Build locations
BUILD := $(CURDIR)/build
TMP := $(CURDIR)/debian/tmp
INSTALL_TMP := $(TMP)/install
TMP_DPKG := $(TMP)/dpkg
TMP_DPKG_DEV := $(TMP)/dpkg-dev
TMP_DPKG_DOC := $(TMP)/dpkg-doc
TMP_DSELECT := $(TMP)/dselect
# We should really get this in a different way...
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE 2> /dev/null || true)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE 2> /dev/null || true)
arch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
GENCONTROL := perl -I $(CURDIR)/scripts $(BUILD)/scripts/dpkg-gencontrol -isp
SHLIBDEPS := perl -I $(CURDIR)/scripts $(BUILD)/scripts/dpkg-shlibdeps
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
config_arg := --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
else
config_arg :=
endif
BUILD-DIRS := $(BUILD) $(BUILD)-static
# Hacky, but effective
MANDIRS := $(shell sed -n -e '/^SUBDIRS/{s/.*= *//;s/ en / /;p}' $(CURDIR)/man/Makefile.in)
aclocal.m4: $(wildcard automake/*.m4)
aclocal -I automake
# The following 2 rules should only be run, if their dependants have
# been modified. For clean builds, this won't happen. Only if the
# builder has modified these files after extraction.
configure: configure.in aclocal.m4
autoconf
config.h.in: configure.in
autoheader
config.guess config.sub: %: /usr/share/misc/%
cp -a $< $@.new
mv $@.new $@
# Setup the buildlocation
$(BUILD)/configure-stamp: configure config.h.in config.guess config.sub
$(checkdir)
install -d $(@D)
cd $(@D) && LDFLAGS="$(LDFLAGS)" $(shell echo "$(patsubst $(CURDIR)/%,%,$(@D))" | sed -e 's,^[^/][^/]*$$,..,;s,/[^/][^/]*,/..,g' )/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 \
--with-zlib=static \
--with-bz2lib=static \
--with-static-progs \
$(config_arg)
touch $@
clean:
$(checkdir)
rm -f debian/files debian/substvars
rm -f debian/dpkg.substvars debian/dpkg-static.substvars
rm -fr autom4te.cache
rm -fr $(BUILD-DIRS) $(TMP)
rm -f po/{cat-id-tbl.c,stamp-cat-id,*.gmo}
rm -f stamp-build stamp-binary
build: stamp-build
stamp-build: $(BUILD)/configure-stamp
$(MAKE) $(MFLAGS) -C $(BUILD)
# touch $@
binary-static: binary-arch-static
binary: binary-arch binary-indep
stamp-binary-static: stamp-binary
stamp-binary: stamp-build
$(checkdir)
test "`id -u`" -eq 0
rm -rf $(TMP)
$(MAKE) $(MFLAGS) -C $(BUILD)$* \
DESTDIR=$(INSTALL_TMP) \
install
find $(TMP) -type d | xargs chmod 755
touch $@
binary-dpkg-static-most: TMP_DPKG=$(TMP)/dpkg-static
binary-dpkg-static-most: static=-static
binary-dpkg-static: TMP_DPKG=$(TMP)/dpkg-static
binary-dpkg-static: static=-static
binary-dpkg-most binary-dpkg-static-most: binary-dpkg%-most: stamp-binary%
rm -rf $(TMP_DPKG)
install -d -m 755 -o root -g root $(TMP_DPKG)
chmod g-s $(TMP_DPKG)
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/doc/dpkg$(static)
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
install -d -m 755 -o root -g root $(TMP_DPKG)/var/lib/dpkg
-test -d $(INSTALL_TMP)/etc && cp -a $(INSTALL_TMP)/etc $(TMP_DPKG)/
set -e ; for i in info alternatives parts updates ; do \
cp -a $(INSTALL_TMP)/var/lib/dpkg/$$i $(TMP_DPKG)/var/lib/dpkg/ ; \
done
cp -a $(INSTALL_TMP)/usr/sbin $(TMP_DPKG)/usr/
mv $(TMP_DPKG)/usr/sbin/start-stop-daemon $(TMP_DPKG)/sbin/
cp -a $(INSTALL_TMP)/usr/lib/dpkg/mksplit $(TMP_DPKG)/usr/lib/dpkg/
cp -a $(INSTALL_TMP)/usr/lib/dpkg/enoent $(TMP_DPKG)/usr/lib/dpkg/
cp -a $(INSTALL_TMP)/usr/share/locale $(TMP_DPKG)/usr/share/
cp -a $(INSTALL_TMP)/usr/share/dpkg $(TMP_DPKG)/usr/share/
set -e ; for i in dpkg-split dpkg-query ; do \
cp -a $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG)/usr/bin/ ; \
done
set -e ; for i in dpkg dpkg-deb md5sum ; do \
cp -a $(INSTALL_TMP)/usr/bin/$$i$(static) $(TMP_DPKG)/usr/bin/$$i ; \
done
set -e ; for i in ChangeLog THANKS TODO copyright; do \
cp -a $(INSTALL_TMP)/usr/share/doc/dpkg/$$i $(TMP_DPKG)/usr/share/doc/dpkg$(static)/ ; \
done
cp -a debian/pseudo-tags $(TMP_DPKG)/usr/share/doc/dpkg$(static)/
set -e ; for i in "" $(MANDIRS) ; 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 $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m ] ; then \
cp -a $(INSTALL_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/man5 ; \
for m in dpkg.cfg.5 ; do \
if [ -f $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m ] ; then \
cp -a $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m $(TMP_DPKG)/usr/share/man/$$i/man5/$$m ; \
fi ; \
done ; \
install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man8 ; \
for m in dpkg.8 dpkg-query.8 dpkg-split.8 start-stop-daemon.8 \
cleanup-info.8 dpkg-divert.8 dpkg-statoverride.8 \
install-info.8 update-alternatives.8 ; do \
if [ -f $(INSTALL_TMP)/usr/share/man/$$i/man8/$$m ] ; then \
cp -a $(INSTALL_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 --remove-section=.comment --remove-section=.note \
--strip-unneeded $(TMP_DPKG)/usr/bin/* $(TMP_DPKG)/sbin/* \
$(TMP_DPKG)/usr/lib/dpkg/enoent
mv $(TMP_DPKG)/usr/share/doc/dpkg$(static)/ChangeLog \
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/changelog
install -p -m 644 -o root -g root debian/changelog \
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/changelog.Debian
rm -f $(TMP_DPKG)/usr/share/doc/dpkg$(static)/copyright
gzip -9 $(TMP_DPKG)/usr/share/doc/dpkg$(static)/*
install -p -m 644 -o root -g root debian/dpkg.cfg \
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/
install -p -m 644 -o root -g root debian/copyright \
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/
# Final package creation
install -d -m 755 -o root -g root $(TMP_DPKG)/DEBIAN
install -p -m 644 -o root -g root debian/dpkg.conffiles $(TMP_DPKG)/DEBIAN/conffiles
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
install -p -m 755 -o root -g root debian/dpkg.postrm $(TMP_DPKG)/DEBIAN/postrm
$(SHLIBDEPS) -dPre-Depends -Tdebian/dpkg$(static).substvars \
$(TMP_DPKG)/sbin/start-stop-daemon \
`test -z "$(static)" && echo $(TMP_DPKG)/usr/bin/dpkg $(TMP_DPKG)/usr/bin/md5sum $(TMP_DPKG)/usr/bin/dpkg-deb`
binary-dpkg binary-dpkg-static: %: %-most
$(GENCONTROL) -Tdebian/dpkg$(static).substvars -pdpkg$(static) -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)
chmod g-s $(TMP_DPKG_DEV)
install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/etc/dpkg
install -p -m 644 -o root -g root debian/shlibs.default \
$(TMP_DPKG_DEV)/etc/dpkg/
install -p -m 644 -o root -g root debian/shlibs.override \
$(TMP_DPKG_DEV)/etc/dpkg/
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 $(INSTALL_TMP)/usr/lib/dpkg/parsechangelog $(TMP_DPKG_DEV)/usr/lib/dpkg/
mv $(INSTALL_TMP)/usr/lib/dpkg/controllib.pl $(TMP_DPKG_DEV)/usr/lib/dpkg/
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 dpkg-checkbuilddeps ; do \
mv $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \
done
set -e ; for i in "" $(MANDIRS) ; 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 \
dpkg-checkbuilddeps.1 dpkg-scanpackages.1 dpkg-scansources.1; do \
if [ -e $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m ] ; then \
mv $(INSTALL_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 $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m ] ; then \
mv $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man5/$$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
# 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
$(GENCONTROL) -Tdebian/dpkg-dev.substvars -pdpkg-dev -P$(TMP_DPKG_DEV)
dpkg --build $(TMP_DPKG_DEV) ..
binary-dselect: stamp-binary
rm -rf $(TMP_DSELECT)
install -d -m 755 -o root -g root $(TMP_DSELECT)
chmod g-s $(TMP_DSELECT)
install -d -m 755 -o root -g root $(TMP_DSELECT)/usr/bin
mv $(INSTALL_TMP)/usr/bin/dselect $(TMP_DSELECT)/usr/bin/
install -d -m 755 -o root -g root $(TMP_DSELECT)/usr/lib/dpkg
mv $(INSTALL_TMP)/usr/lib/dpkg/methods $(TMP_DSELECT)/usr/lib/dpkg/
install -d -m 755 -o root -g root $(TMP_DSELECT)/var/lib/dpkg
mv $(INSTALL_TMP)/var/lib/dpkg/methods $(TMP_DSELECT)/var/lib/dpkg/
set -e ; for i in "" $(MANDIRS) ; do \
install -d -m 755 -o root -g root $(TMP_DSELECT)/usr/share/man/$$i/man5 ; \
for m in dselect.cfg.5 ; do \
if [ -f $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m ] ; then \
cp -a $(INSTALL_TMP)/usr/share/man/$$i/man5/$$m $(TMP_DSELECT)/usr/share/man/$$i/man5/$$m ; \
fi ; \
done ; \
install -d -m 755 -o root -g root $(TMP_DSELECT)/usr/share/man/$$i/man8 ; \
for m in dselect.8 ; do \
if [ -f $(INSTALL_TMP)/usr/share/man/$$i/man8/$$m ] ; then \
cp -a $(INSTALL_TMP)/usr/share/man/$$i/man8/$$m $(TMP_DSELECT)/usr/share/man/$$i/man8/$$m ; \
fi ; \
done ; \
done
install -d -m 755 -o root -g root $(TMP_DSELECT)/etc/dpkg
install -p -m 644 -o root -g root debian/dselect.cfg \
$(TMP_DSELECT)/etc/dpkg/
# Now do the usual Debian stuff
find $(TMP_DSELECT)/usr/share/man -type f | xargs gzip -9f
install -d -m 755 -o root -g root $(TMP_DSELECT)/usr/share/doc
ln -s dpkg $(TMP_DSELECT)/usr/share/doc/dselect
strip --remove-section=.comment --remove-section=.note \
--strip-unneeded $(TMP_DSELECT)/usr/bin/*
# Final package creation
install -d -m 755 -o root -g root $(TMP_DSELECT)/DEBIAN
install -p -m 644 -o root -g root debian/dselect.conffiles $(TMP_DSELECT)/DEBIAN/conffiles
$(SHLIBDEPS) -Tdebian/dselect.substvars \
$(TMP_DSELECT)/usr/bin/dselect
$(GENCONTROL) -Tdebian/dselect.substvars -pdselect -P$(TMP_DSELECT)
dpkg --build $(TMP_DSELECT) ..
binary-dpkg-doc: stamp-binary
rm -rf $(TMP_DPKG_DOC)
install -d -m 755 -o root -g root $(TMP_DPKG_DOC)
chmod g-s $(TMP_DPKG_DOC)
install -d -m 755 -o root -g root $(TMP_DPKG_DOC)/usr/share/doc/dpkg
mv $(INSTALL_TMP)/usr/share/doc/dpkg/internals $(TMP_DPKG_DOC)/usr/share/doc/dpkg/
mv $(INSTALL_TMP)/usr/share/doc/dpkg/ChangeLog.manuals \
$(TMP_DPKG_DOC)/usr/share/doc/dpkg/changelog.manuals
# Now that dpkg-doc 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
$(GENCONTROL) -Tdebian/dpkg-doc.substvars -pdpkg-doc -P$(TMP_DPKG_DOC)
dpkg --build $(TMP_DPKG_DOC) ..
binary-arch-static: binary-dpkg-static
binary-arch: binary-dpkg binary-dpkg-static-most binary-dselect
binary-indep: binary-dpkg-dev binary-dpkg-doc
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
|