Source: zlib
Version: 1:1.2.8.dfsg-1
Severity: wishlist
Tags: patch

The attached patch allows for building zlib in a bootstrapping situation where 
the multilib compilation packages are not yet available.

(The context: my pbuildd project has the aim of making it possible to 
bootstrap the Debian archive from source packages and a minimal debootstrap 
chroot.  Given that starting point, even though zlib1g is installed, neither 
zlib1g-dev nor gcc-multilib / libc6-i386 / etc. is available.  So, it's of 
course tough to get much of anywhere before bootstrapping zlib1g-dev, whereas 
gcc-multilib and libc6-i386 are both easy to defer and hard to bootstrap at 
such an early stage.)
-- 
Daniel Schepler
diff -urN zlib-1.2.8.dfsg.old/debian/rules zlib-1.2.8.dfsg/debian/rules
--- zlib-1.2.8.dfsg.old/debian/rules	2013-05-03 09:00:06.000000000 -0700
+++ zlib-1.2.8.dfsg/debian/rules	2013-05-23 15:16:05.229482829 -0700
@@ -34,6 +34,13 @@
 	CFLAGS += -O3
 endif
 
+ifeq ($(DEB_BUILD_PROFILE),stage1)
+
+bootstrap_dh_flags = -Nlib64z1 -Nlib64z1-dev -Nlib32z1 -Nlib32z1-dev \
+	-Nlibn32z1 -Nlibn32z1-dev
+
+else
+
 32-ARCHS=amd64 ppc64 kfreebsd-amd64 s390x
 64-ARCHS=s390 sparc i386 powerpc mips mipsel
 
@@ -69,6 +76,8 @@
 mn32=-mabi=n32
 endif
 
+endif  # DEB_BUILD_PROFILE != stage1
+
 UNALIGNED_ARCHS=i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 lpia
 ifneq (,$(findstring $(DEB_HOST_ARCH), $(UNALIGNED_ARCHS)))
 CFLAGS+=-DUNALIGNED_OK
@@ -160,7 +169,7 @@
 	dh_testdir
 	dh_testroot
 	dh_prep
-	dh_installdirs
+	dh_installdirs $(bootstrap_dh_flags)
 
 	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
 
@@ -186,19 +195,19 @@
 binary-arch: build install $(EXTRA_INSTALL)
 	dh_testdir
 	dh_testroot
-	dh_installchangelogs -s ChangeLog
-	dh_installdocs -s
-	dh_installexamples -s
+	dh_installchangelogs -s ChangeLog $(bootstrap_dh_flags)
+	dh_installdocs -s $(bootstrap_dh_flags)
+	dh_installexamples -s $(bootstrap_dh_flags)
 	mkdir -p debian/tmp/usr/bin
 	cp contrib/minizip/minizip debian/tmp/usr/bin
 	cp contrib/minizip/miniunz debian/tmp/usr/bin/miniunzip
-	dh_install -s --sourcedir=debian/tmp
-	dh_installman -s
-	dh_lintian -s
-	dh_link -s
-	dh_strip -s --dbg-package=zlib1g-dbg
-	dh_compress -s
-	dh_fixperms -s
+	dh_install -s --sourcedir=debian/tmp $(bootstrap_dh_flags)
+	dh_installman -s $(bootstrap_dh_flags)
+	dh_lintian -s $(bootstrap_dh_flags)
+	dh_link -s $(bootstrap_dh_flags)
+	dh_strip -s --dbg-package=zlib1g-dbg $(bootstrap_dh_flags)
+	dh_compress -s $(bootstrap_dh_flags)
+	dh_fixperms -s $(bootstrap_dh_flags)
 	dh_makeshlibs -pzlib1g -V"zlib1g (>= 1:1.2.3.3.dfsg-1)" --add-udeb=zlib1g-udeb
 ifneq (,$(findstring $(DEB_HOST_ARCH), $(32-ARCHS)))
 	dh_makeshlibs -plib32z1 -V"lib32z1 (>= 1:1.2.3.3.dfsg-1)"
@@ -211,11 +220,11 @@
 ifneq (,$(findstring $(DEB_HOST_ARCH), $(N32-ARCHS)))
 	dh_makeshlibs -plibn32z1 -V"libn32z1 (>= 1:1.2.3.3.dfsg-1)"
 endif
-	dh_installdeb -s
-	dh_shlibdeps -s
-	dh_gencontrol -s
-	dh_md5sums -s
-	dh_builddeb -s
+	dh_installdeb -s $(bootstrap_dh_flags)
+	dh_shlibdeps -s $(bootstrap_dh_flags)
+	dh_gencontrol -s $(bootstrap_dh_flags)
+	dh_md5sums -s $(bootstrap_dh_flags)
+	dh_builddeb -s $(bootstrap_dh_flags)
 
 binary: binary-indep binary-arch
 .PHONY: build clean binary-indep binary-arch binary install install64 install32

Reply via email to