Package: coreutils
Version: 8.5-1
Severity: wishlist
Tags: patch

Hi,

I'm currently working on cross-building bits of Debian and coreutils
fails to build. The reason is simple: the usage of help2man to
generate man pages by running each command with --help. This clearly
is not going to work in a cross-build situation.

For now, the attached debdiff simply disables generation of the docs
for cross-builds. The right answer (IMHO) would be to convince
upstream to generate their docs in a more sane way (e.g. having a
common source for help information that could be used both for --help
output *and* the man pages).

Cheers,
-- 
Steve McIntyre
[email protected]
diff -u coreutils-8.5/debian/changelog coreutils-8.5/debian/changelog
--- coreutils-8.5/debian/changelog
+++ coreutils-8.5/debian/changelog
@@ -1,3 +1,10 @@
+coreutils (8.5-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Don't build man or docs for cross builds.
+
+ -- Steve McIntyre <[email protected]>  Thu, 16 Jun 2011 17:39:18 +0100
+
 coreutils (8.5-1) unstable; urgency=low
 
   * New upstream version
diff -u coreutils-8.5/debian/rules coreutils-8.5/debian/rules
--- coreutils-8.5/debian/rules
+++ coreutils-8.5/debian/rules
@@ -5,6 +5,8 @@
 export DH_VERBOSE=1
 
 # work around dpkg changes
+DEB_HOST_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
 DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
 ifeq ($(DEB_HOST_ARCH_CPU),)
@@ -107,7 +109,11 @@
 	
 	# backward compatability
 	ln -s /usr/bin/md5sum $(d)/usr/bin/md5sum.textutils
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	ln -s /usr/share/man/man1/md5sum.1 $(d)/usr/share/man/man1/md5sum.textutils.1
+else
+	@echo "man & doc not built during cross builds"
+endif
 ifneq ($(DEB_HOST_ARCH_OS),hurd)
 		# touch used to be in /usr/bin, don't break scripts
 		ln -s /bin/touch $(d)/usr/bin/touch
@@ -127,13 +133,22 @@
 	rm -f $(d)/usr/bin/uptime $(d)/usr/share/man/man1/uptime.1
 
 	# the [ program doesn't have its own man page yet
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	ln -s test.1 $(d)/usr/share/man/man1/[.1
+else
+	@echo "man & doc not built during cross builds"
+endif
 
 	# gnu thinks chroot is in bin, debian thinks it's in sbin
-	install -d $(d)/usr/sbin $(d)/usr/share/man/man8
+	install -d $(d)/usr/sbin
 	mv $(d)/usr/bin/chroot $(d)/usr/sbin/chroot
+ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	install -d $(d)/usr/share/man/man8
 	sed s/\"1\"/\"8\"/1 $(d)/usr/share/man/man1/chroot.1 > $(d)/usr/share/man/man8/chroot.8
 	rm $(d)/usr/share/man/man1/chroot.1
+else
+	@echo "man & doc not built during cross builds"
+endif
 
 	# some build environments will leave a dangling info dir
 	rm -f $(d)/usr/share/info/dir
diff -u coreutils-8.5/debian/patches/00list coreutils-8.5/debian/patches/00list
--- coreutils-8.5/debian/patches/00list
+++ coreutils-8.5/debian/patches/00list
@@ -6,0 +7 @@
+100_cross
only in patch2:
unchanged:
--- coreutils-8.5.orig/debian/patches/100_cross
+++ coreutils-8.5/debian/patches/100_cross
@@ -0,0 +1,36 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 100_cross.dpatch by Peter Pearse <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Drop doc & man for cross builds
+
+@DPATCH@
+
+diff -urNad '--exclude=.bzr' base/Makefile.am patched/Makefile.am
+--- base/Makefile.am   2011-05-17 10:12:59.000000000 +0000
++++ patched/Makefile.am        2011-05-17 10:14:01.000000000 +0000
+@@ -17,7 +17,11 @@
+ 
+ ALL_RECURSIVE_TARGETS =
+ 
++if CROSS_COMPILING
++SUBDIRS = lib src doc po
++else
+ SUBDIRS = lib src doc man po tests gnulib-tests
++endif
+ 
+ changelog_etc =                               \
+   ChangeLog-2005                      \
+diff -urNad '--exclude=.bzr' base/Makefile.in patched/Makefile.in
+--- base/Makefile.in   2011-05-17 10:13:00.000000000 +0000
++++ patched/Makefile.in        2011-05-17 10:15:14.000000000 +0000
+@@ -1195,7 +1195,8 @@
+ 
+ # Some tests always need root privileges, others need them only sometimes.
+ ALL_RECURSIVE_TARGETS = install-root check-root distcheck-hook
+-SUBDIRS = lib src doc man po tests gnulib-tests
++@CROSS_COMPILING_FALSE@SUBDIRS = lib src doc man po tests gnulib-tests
++@CROSS_COMPILING_TRUE@SUBDIRS = lib src doc po
+ changelog_etc = \
+   ChangeLog-2005                      \
+   ChangeLog-2006                      \

Reply via email to