Просмотр исходного кода

Added -static support. There is support for building a dpkg-static.deb,
but this is not used during a normal run. However, a
-static.nondebbin.tar.gz file is created, in addition to the normal
nondebbin.tar.gz.

Adam Heath лет назад: 25
Родитель
Сommit
9bf6182944
10 измененных файлов с 154 добавлено и 80 удалено
  1. 1 0
      .cvsignore
  2. 9 0
      ChangeLog
  3. 2 1
      Makefile.conf.in
  4. 14 0
      configure.in
  5. 2 3
      debian/.cvsignore
  6. 21 1
      debian/control
  7. 74 66
      debian/rules
  8. 12 4
      dpkg-deb/Makefile.in
  9. 10 2
      main/Makefile.in
  10. 9 3
      utils/Makefile.in

+ 1 - 0
.cvsignore

@@ -17,3 +17,4 @@ config.log
 build
 build
 stamp-build
 stamp-build
 stamp-binary
 stamp-binary
+stamp-binary-static

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+Sun Apr 29 22:08:37 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * Makefile.conf.in, configure.in, debian/control, debian/rules,
+    dpkg-deb/Makefile.in, main/Makefile.in, utils/Makefile.in,
+    .cvsignore debian/.cvsignore: Added -static support.  There is support
+    for building a dpkg-static.deb, but this is not used during a normal
+    run.  However, a -static.nondebbin.tar.gz file is created, in addition
+    to the normal nondebbin.tar.gz.
+
 Mon Apr 30 02:35:02 CEST 2001 Wichert Akkerman <wakkerma@debian.org>
 Mon Apr 30 02:35:02 CEST 2001 Wichert Akkerman <wakkerma@debian.org>
 
 
   * debian/control: update section and priorities to match the dinstall
   * debian/control: update section and priorities to match the dinstall

+ 2 - 1
Makefile.conf.in

@@ -66,13 +66,14 @@ SSD_LIBS		= @SSD_LIBS@
 
 
 ZLIB_CFLAGS		= @ZLIB_CFLAGS@
 ZLIB_CFLAGS		= @ZLIB_CFLAGS@
 ZLIB_LIBS		= @ZLIB_LIBS@
 ZLIB_LIBS		= @ZLIB_LIBS@
+ZLIB_LIBS_ALSO_STATIC	= @ZLIB_LIBS_ALSO_STATIC@
 
 
 ALL_CFLAGS		= $(CFLAGS) $(DEFS) $(NLS_CFLAGS) $(INCLUDE_CFLAGS) $(ZLIB_CFLAGS) 
 ALL_CFLAGS		= $(CFLAGS) $(DEFS) $(NLS_CFLAGS) $(INCLUDE_CFLAGS) $(ZLIB_CFLAGS) 
 ALL_CXXFLAGS		= $(ALL_CFLAGS) $(CXXFLAGS)
 ALL_CXXFLAGS		= $(ALL_CFLAGS) $(CXXFLAGS)
 
 
+ALSO_STATIC		= @ALSO_STATIC@
 .c.o:
 .c.o:
 	$(CC) $(ALL_CFLAGS) -c $<
 	$(CC) $(ALL_CFLAGS) -c $<
 
 
 .cc.o:
 .cc.o:
 	$(CXX) $(ALL_CXXFLAGS) -c $<
 	$(CXX) $(ALL_CXXFLAGS) -c $<
-

+ 14 - 0
configure.in

@@ -5,6 +5,16 @@ AC_PREREQ([2.13])
 AC_INIT(include/dpkg.h.in)
 AC_INIT(include/dpkg.h.in)
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_HEADER(config.h)
 
 
+ALSO_STATIC=
+AC_ARG_WITH(static-progs,
+[  --with-static-progs     compile static versions of certain binaries as well],
+[case "$withval" in
+  "true" | "yes" )
+    ALSO_STATIC=1
+    ;;
+ esac])
+AC_SUBST(ALSO_STATIC)
+
 DSELECTDIR="dselect"
 DSELECTDIR="dselect"
 AC_ARG_WITH(dselect,
 AC_ARG_WITH(dselect,
 [  --with-dselect          the dselect package-management frontend],
 [  --with-dselect          the dselect package-management frontend],
@@ -142,12 +152,16 @@ else
 	ZLIB_CFLAGS=-DUSE_ZLIB
 	ZLIB_CFLAGS=-DUSE_ZLIB
 	if test "$use_zlib" = "static"  ; then
 	if test "$use_zlib" = "static"  ; then
 		ZLIB_LIBS="-Wl,-Bstatic -lz -Wl,-Bdynamic"
 		ZLIB_LIBS="-Wl,-Bstatic -lz -Wl,-Bdynamic"
+		if test "$ALSO_STATIC"; then
+			ZLIB_LIBS_ALSO_STATIC="-lz"
+		fi
 	else
 	else
 		ZLIB_LIBS=-lz
 		ZLIB_LIBS=-lz
 	fi
 	fi
 fi
 fi
 AC_SUBST(ZLIB_CFLAGS)
 AC_SUBST(ZLIB_CFLAGS)
 AC_SUBST(ZLIB_LIBS)
 AC_SUBST(ZLIB_LIBS)
+AC_SUBST(ZLIB_LIBS_ALSO_STATIC)
 
 
 AC_TRY_COMPILE([
 AC_TRY_COMPILE([
 #include <sys/types.h>
 #include <sys/types.h>

+ 2 - 3
debian/.cvsignore

@@ -1,6 +1,5 @@
-tmp-dpkg
-tmp-dpkg-dev
-tmp-dpkg-doc
+tmp
 files
 files
 substvars
 substvars
 dpkg.substvars
 dpkg.substvars
+dpkg-static.substvars

+ 21 - 1
debian/control

@@ -12,7 +12,27 @@ Architecture: any
 Essential: yes
 Essential: yes
 Pre-Depends: ${shlibs:Pre-Depends}
 Pre-Depends: ${shlibs:Pre-Depends}
 Depends: sysvinit (>= 2.72)
 Depends: sysvinit (>= 2.72)
-Replaces: dpkg-doc-ja
+Replaces: dpkg-doc-ja, dpkg-static
+Conflicts: dpkg-static
+Description: Package maintenance system for Debian
+ This package contains the programs which handle the installation and
+ removal of packages on your system.
+ .
+ The primary interface for the dpkg suite is the `dselect' program;
+ a more low-level and less user-friendly interface is available in
+ the form of the `dpkg' command.
+ .
+ In order to unpack and build Debian source packages you will need to
+ install the developers' package `dpkg-dev' as well as this one.
+
+Package: dpkg-static
+Architecture: any
+Priority: optional
+Pre-Depends: ${shlibs:Pre-Depends}
+Depends: sysvinit (>= 2.72)
+Replaces: dpkg-doc-ja, dpkg
+Conflicts: dpkg
+Provides: dpkg
 Description: Package maintenance system for Debian
 Description: Package maintenance system for Debian
  This package contains the programs which handle the installation and
  This package contains the programs which handle the installation and
  removal of packages on your system.
  removal of packages on your system.

+ 74 - 66
debian/rules

@@ -4,9 +4,10 @@
 # Build locations
 # Build locations
 BUILD		:= $(shell pwd)/build
 BUILD		:= $(shell pwd)/build
 TMP		:= $(shell pwd)/debian/tmp
 TMP		:= $(shell pwd)/debian/tmp
-TMP_DPKG	:= $(TMP)-dpkg
-TMP_DPKG_DEV	:= $(TMP)-dpkg-dev
-TMP_DPKG_DOC	:= $(TMP)-dpkg-doc
+INSTALL_TMP	:= $(TMP)/install
+TMP_DPKG	:= $(TMP)/dpkg
+TMP_DPKG_DEV	:= $(TMP)/dpkg-dev
+TMP_DPKG_DOC	:= $(TMP)/dpkg-doc
 DIR		:= $(shell pwd)
 DIR		:= $(shell pwd)
 
 
 # We should really get this in a different way...
 # We should really get this in a different way...
@@ -22,12 +23,11 @@ endif
 
 
 BUILD-DIRS	:= $(BUILD) $(BUILD)-static
 BUILD-DIRS	:= $(BUILD) $(BUILD)-static
 
 
-$(BUILD)-static/config.status:	LDFLAGS = -static
 # Setup the buildlocation
 # Setup the buildlocation
-$(BUILD)/config.status $(BUILD)-static/config.status:
+$(BUILD)/config.status:
 	$(checkdir)
 	$(checkdir)
 	install -d $(@D)
 	install -d $(@D)
-	cd $(@D) && LDFLAGS=$(LDFLAGS) CFLAGS=$(CFLAGS) $(DIR)/configure \
+	cd $(@D) && LDFLAGS=$(LDFLAGS) CFLAGS="$(CFLAGS) -g" $(DIR)/configure \
 		--prefix=/usr \
 		--prefix=/usr \
 		--datadir=/usr/share \
 		--datadir=/usr/share \
 		--mandir=/usr/share/man \
 		--mandir=/usr/share/man \
@@ -37,76 +37,79 @@ $(BUILD)/config.status $(BUILD)-static/config.status:
 		--localstatedir=/var/lib \
 		--localstatedir=/var/lib \
 		--with-admindir=/var/lib/dpkg \
 		--with-admindir=/var/lib/dpkg \
 		--with-zlib=static \
 		--with-zlib=static \
+		--with-static-progs \
 		$(config_arg)
 		$(config_arg)
 
 
 clean:
 clean:
 	$(checkdir)
 	$(checkdir)
 	rm -f debian/files debian/substvars
 	rm -f debian/files debian/substvars
-	rm -f debian/dpkg.substvars
-	rm -fr $(BUILD-DIRS) $(TMP) $(TMP_DPKG) $(TMP_DPKG_DEV) $(TMP_DPKG_DOC)
+	rm -f debian/dpkg.substvars debian/dpkg-static.substvars
+	rm -fr $(BUILD-DIRS) $(TMP)
 	rm -f po/{cat-id-tbl.c,stamp-cat-id,*.gmo}
 	rm -f po/{cat-id-tbl.c,stamp-cat-id,*.gmo}
-	rm -f stamp-build stamp-build-static stamp-binary
+	rm -f stamp-build stamp-binary
 
 
-build build-static: build%: stamp-build%
+build: stamp-build
 
 
-stamp-build stamp-build-static: stamp-build%: $(BUILD)%/config.status
-	$(MAKE) $(MFLAGS) -C $(BUILD)$*
-	touch $@
+stamp-build: $(BUILD)/config.status
+	$(MAKE) $(MFLAGS) -C $(BUILD)
+#	touch $@
 
 
+binary-static: binary-arch-static
 binary: binary-arch binary-indep
 binary: binary-arch binary-indep
 
 
+stamp-binary-static: stamp-binary
 stamp-binary: stamp-build
 stamp-binary: stamp-build
 	$(checkdir)
 	$(checkdir)
 	test "`id -u`" -eq 0
 	test "`id -u`" -eq 0
 	rm -rf $(TMP)
 	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 \
+	$(MAKE) $(MFLAGS) -C $(BUILD)$* \
+		DESTDIR=$(INSTALL_TMP) \
 		install
 		install
 	find $(TMP) -type d | xargs chmod 755
 	find $(TMP) -type d | xargs chmod 755
-	touch stamp-binary
+	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: stamp-binary
+binary-dpkg-most binary-dpkg-static-most: binary-dpkg%-most: stamp-binary%
 	rm -rf $(TMP_DPKG)
 	rm -rf $(TMP_DPKG)
 	install -d -m 755 -o root -g root $(TMP_DPKG)
 	install -d -m 755 -o root -g root $(TMP_DPKG)
 	chmod g-s $(TMP_DPKG)
 	chmod g-s $(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/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/lib/dpkg
 	install -d -m 755 -o root -g root $(TMP_DPKG)/usr/bin
 	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)/sbin
-	-test -d $(TMP)/etc && 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/enoent $(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/ ; \
+	-test -d $(INSTALL_TMP)/etc && mv $(INSTALL_TMP)/etc $(TMP_DPKG)/
+	cp -a $(INSTALL_TMP)/var $(TMP_DPKG)/
+	cp -a $(INSTALL_TMP)/usr/sbin/start-stop-daemon $(TMP_DPKG)/sbin/
+	cp -a $(INSTALL_TMP)/usr/sbin $(TMP_DPKG)/usr/
+	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/lib/dpkg/methods $(TMP_DPKG)/usr/lib/dpkg/
+	cp -a $(INSTALL_TMP)/usr/share/locale $(TMP_DPKG)/usr/share/
+	set -e ; for i in dpkg-split dselect ; do \
+		cp -a $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG)/usr/bin/ ; \
+	done
+	set -ex ; for i in dpkg dpkg-deb md5sum ; do \
+		cp -a $(INSTALL_TMP)/usr/bin/$$i$(static) $(TMP_DPKG)/usr/bin/$$i ; \
 	done
 	done
 	set -e ; for i in ChangeLog THANKS TODO copyright ; do \
 	set -e ; for i in ChangeLog THANKS TODO copyright ; do \
-		mv $(TMP)/usr/share/doc/dpkg/$$i $(TMP_DPKG)/usr/share/doc/dpkg/ ; \
+		cp -a $(INSTALL_TMP)/usr/share/doc/dpkg/$$i $(TMP_DPKG)/usr/share/doc/dpkg$(static)/ ; \
 	done
 	done
 	set -e ; for i in "" fr ja sv ; do \
 	set -e ; for i in "" fr ja sv ; do \
 		install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man1 ; \
 		install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man1 ; \
 		for m in md5sum.1 dpkg-deb.1 ; do \
 		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 ; \
+			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 ; \
 			fi ; \
 		done ; \
 		done ; \
 		install -d -m 755 -o root -g root $(TMP_DPKG)/usr/share/man/$$i/man8 ; \
 		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 \
 		for m in dpkg.8 dselect.8 dpkg-split.8 start-stop-daemon.8 \
 		    	cleanup-info.8 dpkg-divert.8 dpkg-statoverride.8 \
 		    	cleanup-info.8 dpkg-divert.8 dpkg-statoverride.8 \
 			install-info.8 update-alternatives.8 update-rc.d.8 ; do \
 			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 ; \
+			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 ; \
 			fi ; \
 		done ; \
 		done ; \
 	done
 	done
@@ -121,15 +124,15 @@ binary-dpkg: stamp-binary
 # Policy stuff
 # Policy stuff
 	find $(TMP_DPKG)/usr/share/man -type f | xargs gzip -9f
 	find $(TMP_DPKG)/usr/share/man -type f | xargs gzip -9f
 	strip $(TMP_DPKG)/usr/bin/* $(TMP_DPKG)/sbin/*
 	strip $(TMP_DPKG)/usr/bin/* $(TMP_DPKG)/sbin/*
-	mv $(TMP_DPKG)/usr/share/doc/dpkg/ChangeLog \
-		$(TMP_DPKG)/usr/share/doc/dpkg/changelog
+	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 \
 	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/*
+		$(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/copyright \
 	install -p -m 644 -o root -g root debian/copyright \
-		$(TMP_DPKG)/usr/share/doc/dpkg/
+		$(TMP_DPKG)/usr/share/doc/dpkg$(static)/
 
 
 # Final package creation
 # Final package creation
 	install -d -m 755 -o root -g root $(TMP_DPKG)/DEBIAN
 	install -d -m 755 -o root -g root $(TMP_DPKG)/DEBIAN
@@ -138,11 +141,13 @@ binary-dpkg: stamp-binary
 	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.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.postinst $(TMP_DPKG)/DEBIAN/postinst
 
 
-	dpkg-shlibdeps -dPre-Depends -Tdebian/dpkg.substvars \
-		$(TMP_DPKG)/usr/bin/dpkg $(TMP_DPKG)/usr/bin/dselect \
-		$(TMP_DPKG)/sbin/start-stop-daemon
+	dpkg-shlibdeps -dPre-Depends -Tdebian/dpkg$(static).substvars \
+		$(TMP_DPKG)/usr/bin/dselect $(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`
+
 	perl -I `pwd`/scripts scripts/dpkg-gencontrol.pl -isp \
 	perl -I `pwd`/scripts scripts/dpkg-gencontrol.pl -isp \
-		-Tdebian/dpkg.substvars -pdpkg -P$(TMP_DPKG)
+		-Tdebian/dpkg$(static).substvars -pdpkg$(static) -P$(TMP_DPKG)
+binary-dpkg binary-dpkg-static: %: %-most
 	dpkg --build $(TMP_DPKG) ..
 	dpkg --build $(TMP_DPKG) ..
 
 
 binary-dpkg-dev: stamp-binary
 binary-dpkg-dev: stamp-binary
@@ -157,13 +162,13 @@ binary-dpkg-dev: stamp-binary
 	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/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/share
 	install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/bin
 	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 $(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 \
 	set -e ; for i in dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol \
 		dpkg-shlibdeps dpkg-buildpackage dpkg-distaddfile 822-date \
 		dpkg-shlibdeps dpkg-buildpackage dpkg-distaddfile 822-date \
 		dpkg-scanpackages dpkg-scansources dpkg-architecture \
 		dpkg-scanpackages dpkg-scansources dpkg-architecture \
 		dpkg-parsechangelog dpkg-checkbuilddeps ; do \
 		dpkg-parsechangelog dpkg-checkbuilddeps ; do \
-		mv $(TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \
+		mv $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \
 	done
 	done
 	set -e ; for i in "" fr ja sv ; do \
 	set -e ; for i in "" fr ja sv ; do \
 		install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man1 ; \
 		install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man1 ; \
@@ -171,20 +176,20 @@ binary-dpkg-dev: stamp-binary
 			dpkg-buildpackage.1 dpkg-distaddfile.1 dpkg-genchanges.1 \
 			dpkg-buildpackage.1 dpkg-distaddfile.1 dpkg-genchanges.1 \
 			dpkg-gencontrol.1 dpkg-parsechangelog.1 dpkg-shlibdeps.1 \
 			dpkg-gencontrol.1 dpkg-parsechangelog.1 dpkg-shlibdeps.1 \
 			dpkg-checkbuilddeps.1 ; do \
 			dpkg-checkbuilddeps.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 ; \
+			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 ; \
 			fi ; \
 		done ; \
 		done ; \
 		install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man5 ; \
 		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 \
 		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 ; \
+			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 ; \
 			fi ; \
 		done ; \
 		done ; \
 		install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share/man/$$i/man8 ; \
 		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 \
 		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 ; \
+			if [ -e $(INSTALL_TMP)/usr/share/man/$$i/man8/$$m ] ; then \
+				mv $(INSTALL_TMP)/usr/share/man/$$i/man8/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man8/$$m ; \
 			fi ; \
 			fi ; \
 		done ; \
 		done ; \
 	done
 	done
@@ -209,8 +214,8 @@ binary-dpkg-doc: stamp-binary
 	install -d -m 755 -o root -g root $(TMP_DPKG_DOC)
 	install -d -m 755 -o root -g root $(TMP_DPKG_DOC)
 	chmod g-s $(TMP_DPKG_DOC)
 	chmod g-s $(TMP_DPKG_DOC)
 	install -d -m 755 -o root -g root $(TMP_DPKG_DOC)/usr/share/doc/dpkg
 	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 \
+	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
 		$(TMP_DPKG_DOC)/usr/share/doc/dpkg/changelog.manuals
 
 
 # Now that dpkg-dev has been installed, Debianize it
 # Now that dpkg-dev has been installed, Debianize it
@@ -232,13 +237,16 @@ binary-dpkg-doc: stamp-binary
 		-Tdebian/dpkg-dev.substvars -pdpkg-doc -P$(TMP_DPKG_DOC)
 		-Tdebian/dpkg-dev.substvars -pdpkg-doc -P$(TMP_DPKG_DOC)
 	dpkg --build $(TMP_DPKG_DOC) ..
 	dpkg --build $(TMP_DPKG_DOC) ..
 
 
-binary-arch: binary-dpkg
+binary-arch-static: binary-dpkg-static
+binary-arch: binary-dpkg binary-dpkg-static-most
 	set -e ; \
 	set -e ; \
 	v=`sed -n 's/^Version: //p' $(TMP_DPKG)/DEBIAN/control`; \
 	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 -
+	for type in "" -static; do\
+		f=dpkg-$${v}_$(arch)$$type.nondebbin.tar ; \
+		tar -C $(TMP_DPKG)$$type -cf $(DIR)/../$$f usr var ; \
+		gzip -9f ../$$f ; \
+		dpkg-distaddfile -fdebian/files $$f.gz byhand -; \
+	done
 
 
 binary-indep: binary-dpkg-dev binary-dpkg-doc
 binary-indep: binary-dpkg-dev binary-dpkg-doc
 	set -e ; set -x ; \
 	set -e ; set -x ; \

+ 12 - 4
dpkg-deb/Makefile.in

@@ -11,17 +11,20 @@ include ../Makefile.conf
 SOURCES		= build.c extract.c info.c main.c
 SOURCES		= build.c extract.c info.c main.c
 
 
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
-GENFILES	= $(OBJECTS) dpkg-deb
+GENFILES	= $(OBJECTS) dpkg-deb dpkg-deb-static
 
 
 .PHONY: all
 .PHONY: all
 all:: dpkg-deb
 all:: dpkg-deb
+ifdef ALSO_STATIC
+all:: dpkg-deb-static
+endif
 
 
 .PHONY: install
 .PHONY: install
 install:: all
 install:: all
 
 
 .PHONY: clean
 .PHONY: clean
 clean::
 clean::
-	$(RM) $(GENFILES)
+	-$(RM) $(GENFILES)
 
 
 .PHONY: distclean
 .PHONY: distclean
 cvslean:: clean
 cvslean:: clean
@@ -34,12 +37,17 @@ install:: install-program install-doc
 install-program:
 install-program:
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	$(INSTALL) dpkg-deb $(DESTDIR)$(bindir)
 	$(INSTALL) dpkg-deb $(DESTDIR)$(bindir)
+ifdef ALSO_STATIC
+	$(INSTALL) dpkg-deb-static $(DESTDIR)$(bindir)
+endif
 
 
 .PHONY: install-doc
 .PHONY: install-doc
 install-doc:
 install-doc:
 	$(mkinstalldirs) $(DESTDIR)$(man1dir)
 	$(mkinstalldirs) $(DESTDIR)$(man1dir)
 	$(INSTALL_DATA) $(srcdir)/dpkg-deb.1 $(DESTDIR)$(man1dir)
 	$(INSTALL_DATA) $(srcdir)/dpkg-deb.1 $(DESTDIR)$(man1dir)
 
 
-dpkg-deb: $(OBJECTS) ../lib/libdpkg.a
-	$(CC) $(LDFLAGS) -L../lib -o $@ $(OBJECTS) $(LIBS) $(NLS_LIBS) $(ZLIB_LIBS) -ldpkg
+dpkg-deb-static: LDFLAGS += -static
+dpkg-deb-static: ZLIB_LIBS = $(ZLIB_LIBS_ALSO_STATIC)
+dpkg-deb dpkg-deb-static: $(OBJECTS) ../lib/libdpkg.a
+	$(CC) $(LDFLAGS) -L../lib -o $@ $(OBJECTS) $(LIBS) $(NLS_LIBS) -ldpkg $(ZLIB_LIBS)
 
 

+ 10 - 2
main/Makefile.in

@@ -12,11 +12,15 @@ SOURCES		= main.c enquiry.c filesdb.c archives.c processarc.c \
 MAN8PAGES	= dpkg.8
 MAN8PAGES	= dpkg.8
 
 
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
-GENFILES	= $(OBJECTS) archtable.h dpkg
+GENFILES	= $(OBJECTS) archtable.h dpkg dpkg-static
 
 
 .PHONY: all
 .PHONY: all
 all:: dpkg
 all:: dpkg
 
 
+ifdef ALSO_STATIC
+all:: dpkg-static
+endif
+
 .PHONY: install
 .PHONY: install
 install:: all
 install:: all
 
 
@@ -35,6 +39,9 @@ install:: install-program install-doc
 install-program:
 install-program:
 	$(mkinstalldirs) $(DESTDIR)/$(bindir)
 	$(mkinstalldirs) $(DESTDIR)/$(bindir)
 	$(INSTALL_PROGRAM) dpkg $(DESTDIR)/$(bindir)
 	$(INSTALL_PROGRAM) dpkg $(DESTDIR)/$(bindir)
+ifdef ALSO_STATIC
+	$(INSTALL_PROGRAM) dpkg-static $(DESTDIR)/$(bindir)
+endif
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/alternatives
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/alternatives
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/info
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/info
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/updates
 	$(mkinstalldirs) $(DESTDIR)/$(admindir)/updates
@@ -47,7 +54,8 @@ install-doc:
 	    $(INSTALL_DATA) $$d$$i $(DESTDIR)/$(man8dir) ; \
 	    $(INSTALL_DATA) $$d$$i $(DESTDIR)/$(man8dir) ; \
 	done
 	done
 
 
-dpkg: $(OBJECTS) ../lib/libdpkg.a
+dpkg-static: LDFLAGS += -static
+dpkg dpkg-static: $(OBJECTS) ../lib/libdpkg.a
 	$(CC) $(LDFLAGS) -L../lib -o $@ $(OBJECTS) $(LIBS) $(NLS_LIBS) -ldpkg
 	$(CC) $(LDFLAGS) -L../lib -o $@ $(OBJECTS) $(LIBS) $(NLS_LIBS) -ldpkg
 
 
 enquiry.o: archtable.h
 enquiry.o: archtable.h

+ 9 - 3
utils/Makefile.in

@@ -19,7 +19,7 @@ MD5_MANPAGES		= md5sum.1
 ENOENT_SOURCES		= enoent.c
 ENOENT_SOURCES		= enoent.c
 ENOENT_OBJECTS		= $(patsubst %.c, %.o, $(ENOENT_SOURCES))
 ENOENT_OBJECTS		= $(patsubst %.c, %.o, $(ENOENT_SOURCES))
 
 
-GENFILES		= $(MD5_OBJECTS) md5sum $(ENOENT_OBJECTS) enoent
+GENFILES		= $(MD5_OBJECTS) md5sum md5sum-static $(ENOENT_OBJECTS) enoent
 ifeq (@USE_START_STOP_DAEMON@, true)
 ifeq (@USE_START_STOP_DAEMON@, true)
 GENFILES		+= $(SSD_OBJECTS) start-stop-daemon
 GENFILES		+= $(SSD_OBJECTS) start-stop-daemon
 endif
 endif
@@ -33,6 +33,9 @@ endif
 
 
 .PHONY: install
 .PHONY: install
 install:: all
 install:: all
+ifdef ALSO_STATIC
+all:: md5sum-static
+endif
 
 
 .PHONY: clean
 .PHONY: clean
 clean::
 clean::
@@ -53,7 +56,9 @@ ifeq (@USE_START_STOP_DAEMON@, true)
 endif
 endif
 	$(mkinstalldirs) $(DESTDIR)/$(bindir)
 	$(mkinstalldirs) $(DESTDIR)/$(bindir)
 	$(INSTALL_PROGRAM) md5sum $(DESTDIR)/$(bindir)
 	$(INSTALL_PROGRAM) md5sum $(DESTDIR)/$(bindir)
-
+ifdef ALSO_STATIC
+	$(INSTALL_PROGRAM) md5sum-static $(DESTDIR)/$(bindir)
+endif
 	$(mkinstalldirs) $(DESTDIR)/$(dpkglibdir)
 	$(mkinstalldirs) $(DESTDIR)/$(dpkglibdir)
 	$(INSTALL_PROGRAM) enoent $(DESTDIR)/$(dpkglibdir)
 	$(INSTALL_PROGRAM) enoent $(DESTDIR)/$(dpkglibdir)
 
 
@@ -69,5 +74,6 @@ endif
 start-stop-daemon: $(SSD_OBJECTS) ../lib/libdpkg.a
 start-stop-daemon: $(SSD_OBJECTS) ../lib/libdpkg.a
 	$(CC) $(LDFLAGS) -o $@ $^ $(SSD_LIBS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(SSD_LIBS)
 
 
-md5sum: $(MD5_OBJECTS) ../lib/libdpkg.a
+md5sum-static: LDFLAGS += -static
+md5sum md5sum-static: $(MD5_OBJECTS) ../lib/libdpkg.a
 	$(CC) $(LDFLAGS) -o $@ $^ $(NLS_LIBS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(NLS_LIBS)