Subject: Re: bug#13210: [PATCH] maint: cygwin build broken

From: Pádraig Brady <[email-masked]>
Date: Tue, 18 Dec 2012 10:20:37 +0000

On 12/18/2012 08:58 AM, Stefano Lattarini wrote:
> On 12/18/2012 12:20 AM, Pádraig Brady wrote:
>> On 12/17/2012 11:50 AM, Z. Majeed wrote:
>>> Building latest git source in a non-src directory on cygwin win7 with gcc 4.5.3 is broken - a patch follows -
>>> doc/local.mk: doc subdir is not created in build dir - I made it a prereq of doc/constants.texi
>>
>> That seems a little hacky, for what seems like an automake bug.
>> Maybe this one is the culprit?
>> http://git.sv.gnu.org/gitweb/?p=automake.git;a=commit;h=v1.11-328-ge87c030
>>
> Nope, that change had been later reverted, before any stable release:
> <http://git.sv.gnu.org/gitweb/?p=automake.git;a=commit;h=v1.11-512-g40c3432>
>
>> I use automake-1.11.6 and the coreutils configured min version is 1.11.2.
>> Specifically I'm not impacted as I have this in Makefile:
>>
>> $(srcdir)/doc/version.texi:  $(srcdir)/doc/stamp-vti
>> $(srcdir)/doc/stamp-vti: doc/coreutils.texi $(top_srcdir)/configure
>>          test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp)
>>          ...
>>
> This rules is there also for makefiles generated by Automake 1.12.x.
>
> And the issue here is really not Automake's fault; the problem really likes in
> the coreutil's build system, since the declaration:
>
>     doc/constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
>
> is hand-written in 'doc/local.mk', and is not provided by Automake.
>
> So what suggested by the OP is not a workaround, but a fix -- and it
> seems a correct fix to me (albeit a little abusing of Automake's
> internal).

I misread the above rule last night, and thought Zartaj's fix
to a broken coreutils.info build was to piggy back on the
working constants.texi build. In general it's best to send
error messages along with a patch like this so that reviewers
can follow the same train of thought.

Anyway an explicit `make doc/constants.texi` fails on my system too
(with a non-src build), and so can fail in a larger build
due to ordering of rules.

Since we're manually writing the doc/constants.texi rule anyway,
I prefer to just add in the MKDIR_P which is the technique we
use elsewhere in coreutils.

>
>> BTW, Steffano, how can I see what release the above commit
>> is included in?
>>
> No one :-)
>
>> Only minor versions seem to be tagged?
>>
> How so?  I see:
> <http://git.savannah.gnu.org/gitweb/?p=automake.git;a=commit;h=v1.12>

I was looking for a tag at each release. 1.11.6 etc.
They weren't done for the 1.11 series but they are in place
since 1.12, for example:
http://git.savannah.gnu.org/gitweb/?p=automake.git;a=commit;h=v1.12.5
There's probably little need to retag older releases,
so it's fine going forward.

>> I dislike dependency creep so am open to a workaround
>> as long as we know what's going on.
>>
> See above.

Thanks a lot for looking at this, and sorry for misreading
the rule last night, I shouldn't have bothered you at all,
with this now obvious issue.

It's good to know we could rely on am__dirstamp in future if needed.

Zartaj I'll apply the following in your name soon.

thanks!
Pádraig.

commit 860307bde02e12700e8a08daf3536801e86e8da8
Author: Zartaj Majeed <[email-masked]>
Date:   Tue Dec 18 09:50:50 2012 +0000

     build: fix cygwin build issues

     * doc/local.mk (doc/constants.texi): Ensure the doc directory
     is present which is needed when doing a non source dir build,
     when the doc/constants.texi target is built before other doc targets.
     * src/local.mk: Add $(EXEEXT) to the make-prime-list calls.

diff --git a/doc/local.mk b/doc/local.mk
index 585faf0..ad25528 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -36,6 +36,7 @@ AM_MAKEINFOFLAGS = --no-split

  doc/constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
         $(AM_V_GEN)LC_ALL=C; export LC_ALL; \
+       $(MKDIR_P) doc && \
         { sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
             $(top_srcdir)/src/tail.c && \
           sed -n -e \
diff --git a/src/local.mk b/src/local.mk
index ead3b8b..66028c9 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -387,9 +387,9 @@ src/dircolors.h: src/dcgen src/dircolors.hin
  # known ints (currently 128-bit).
  BUILT_SOURCES += $(top_srcdir)/src/primes.h
  $(top_srcdir)/src/primes.h:
-       $(MAKE) src/make-prime-list
+       $(MAKE) src/make-prime-list$(EXEEXT)
         $(AM_V_GEN)rm -f $@ $@-t
-       $(AM_V_at)src/make-prime-list 5000 > $@-t
+       $(AM_V_at)src/make-prime-list$(EXEEXT) 5000 > $@-t
         $(AM_V_at)chmod a-w $@-t
         $(AM_V_at)mv $@-t $@