Subject: Re: bug#25358: Cross Compiling fails because of help2man

From: Assaf Gordon <[email-masked]>
Date: Wed, 4 Jan 2017 18:22:51 -0500

Hello Vishal,

On 01/04/2017 11:48 AM, Vishal Biswas wrote:
> GNU sed 4.3 cannot be successfully cross compiled because the Makefile tries to 
> run help2man even if cross compiling.

Thank you for reporting this, it is a bug in the build system.

As a temporary work-around (if one is needed):
first, the cross-copmiled binary is already successfully built when the
help2man error is encountered. Not sure if this is sufficient for you or
not. The binary file is 'sed/sed'.

second,
the 'doc/sed.1' file is already pre-built and included in the
'sed-4.3.tar.xz' file, So running
    touch doc/sed.1 ; make
should 'just work' and complete the build successfully.

> 	  GEN      doc/sed.1
> 	help2man: can't get `--help' info from sed/sed
> 	make[2]: *** [Makefile:5775: doc/sed.1] Error 126

The bug in the build system is that 'doc/sed.1' depends on the binary
'sed/sed', even if 'sed.1' already exists in the tarball and there's no
need to re-generate it.

Jim,
I can think of two ways around this:

1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x' instead
   of the binary 'sed/sed'. The assumption is that if the C
   source hasn't changed, there's no need to update the man page.

2. make the building of 'doc/sed.1' conditional, depending on wether
   it is being built from '.git' (then regenerate it) or from
   a tarball (then it already exists).
   something like:

      AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])

   and then in 'doc/local.mk':

      if BUILD_FROM_GIT
         doc/sed.1: sed/sed$(EXEEXT) .version $(srcdir)/doc/sed.x
                    ...
      endif

What do you think ?

regards,
 - assaf