Package: coreutils
Version: 8.26-3
Followup-For: Bug #721358
I hit this problem cross-building coreutils.
I didn't find this bug report till now, and it seems that the 'use
native binaries' solution is not particularly favoured. Although in
the debian case it works well because you are normally cross-building
a current version of the package so the native version matches and
thus this produces matching manpages. Also for coreutils (which
doesn't change that fast) and bootstrapping, it really doesn't matter
too much if there is a minor manpage discrepancy.
The most significant feature of doing it this way is that the
cross-built package matches the native-built package, which is always
a good thing. Using pre-shipped manpages also does this of course.
As I went to trouble of making this work, here is the patch. I'm happy
if other methods are preferred to fix this issue but it is very
important that coreutils can be cross-built as it's essential.
Using the native binaries is made easier by the fact that links are
set up anyway, but harder due to the renaming of test-> [ and install
to ginstall. When using the native binaries you need the test rename
but not the ginstall rename, so it's not quite as clean as one would like.
MAF suggested that a profiled dependency on coreutils native would be
needed, but because coreutils is essential that seems to me to be
rather pointless: it will always be present. A comment pointing out
that such a dependency exists might be useful one day.
Doing this reveals a different bug to do with the problem of recursive
definition of $INSTALL which obviously got fixed once for crossing in
the past but has since been broken again. I'll file a second bug about
that.
patch attached.
Index: coreutils-8.26/man/local.mk
===================================================================
--- coreutils-8.26.orig/man/local.mk
+++ coreutils-8.26/man/local.mk
@@ -169,13 +169,17 @@ endif
.x.1:
$(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
## Ensure that help2man runs the 'src/ginstall' binary as 'install' when
-## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary
-## to create 'test.1'.
+## creating 'install.1' (except when crossbuilding).
+## Similarly, ensure that it uses the 'src/[' binary to create 'test.1'.
case $$name in \
- install) prog='ginstall'; argv=$$name;; \
- test) prog='['; argv='[';; \
- *) prog=$$name; argv=$$prog;; \
+ install) prog='ginstall'; crossman='install'; argv=$$name;; \
+ test) prog='['; crossman='['; argv='[';; \
+ *) prog=$$name; crossman=$$name; argv=$$prog;; \
esac; \
+## Use native binaries if cross-building
+@CROSS_COMPILING_TRUE@progpath=$$(which $$crossman) \
+@CROSS_COMPILING_FALSE@progpath='$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
+echo progpath:$$progpath \
## Note the use of $$t/$*, rather than just '$*' as in other packages.
## That is necessary to avoid failures for programs that are also shell
## built-in functions like echo, false, printf, pwd.
@@ -183,7 +187,7 @@ endif
&& t=$*.td \
&& rm -rf $$t \
&& $(MKDIR_P) $$t \
- && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
+ && (cd $$t && $(LN_S) $$progpath \
$$argv$(EXEEXT)) \
&& : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
&& export SOURCE_DATE_EPOCH && $(run_help2man) \