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

From: Assaf Gordon <[email-masked]>
Date: Thu, 5 Jan 2017 19:44:28 -0500

Hello Jim and all,

> On Jan 5, 2017, at 11:41, Jim Meyering <[email-masked]> wrote:
> 
>> 1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x' 
> I'm pretty sure we must retain the dependency, at least when not
> cross-compiling. If we were to attempt to remove that dependency, I
> believe that would leave a race condition where help2man may attempt
> to run the binary before it is built.

GNU Make has a good solution for it with its "order-only-prerequisites"
(which ensure proper order but ignore timestamp of the dependency):

 https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

Too bad it's not portable...

> 
>> 2. make the building of 'doc/sed.1' conditional, depending on wether
>>   it is being built from '.git' (then regenerate it)
> 
> Even when building from a tarball, we should leave as many build rules
> as we can.

We do already distribute 'doc/sed.1' in the tarball, and currently always rebuild it,
I wonder if it's worth making an exception in this case?

For example in coreutils I think man pages are skipped if there's no perl. Doing the same in sed will allow building it on system without perl (BTW this was the cause for bug #25367 - it was a system with non-working perl).

If we do go with only skipping for cross-compilation,
does this suffice for 'configure.ac' ?

    AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])

In that case, perhaps it's worth adding a test for perl and skipping if it doesn't exist ?

I'm expecting more system will ship without perl as time goes by...

regards,
 - assaf