Subject: [bug#73769] [PATCH] automake: distribute local gnulib directory modules

From: Bruno Haible <[email-masked]>
Date: Sun, 13 Oct 2024 00:51:14 +0200

Karl Berry wrote:
> What do others think? Bruno, would you mind taking a look at Michael's
> message? https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73769

The patch is wrong for three reasons:

1) Inversion of dependencies.

   Gnulib relies on Automake. (And Automake relies on Autoconf. And
   Autoconf relies on m4.) If anyone introduces a dependency in the
   opposite direction, namely that Automake relies on Gnulib (in the
   sense that Automake incorporate knowledge about how gnulib-tool
   operates), this makes evolution of both Automake and Gnulib
   extremely hard.

   It is as if the assembler had built-in knowledge of instruction
   patterns that a compiler emits. It makes it very hard for the
   compiler and for the assembler to evolve. Fortunately we don't
   see this mistake in many areas. But in areas where it exists, it
   causes major trouble, such as with the 'GNU-stack' section.

2) gnulib-tool's interface with the package maintainer is that
   gnulib-tool, after copying a number of files, makes a couple (5-10)
   of instructions for the package maintainer. For example:

    Don't forget to
      - "include Makefile.gnulib" from within "lib/Makefile.am",
      - "include Makefile.gnulib" from within "tests/Makefile.am",
      - mention "-I gnulib-m4" in ACLOCAL_AMFLAGS in Makefile.am
        or add an AC_CONFIG_MACRO_DIRS([gnulib-m4]) invocation in ./configure.ac,
      - mention "gnulib-m4/gnulib-cache.m4" in EXTRA_DIST in Makefile.am,
      - invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC,
      - invoke gl_INIT in ./configure.ac.

   The reason behind this is that the package maintainer MUST remain
   the master of his build system. We do NOT want a build system in
   which the package maintainer is a victim.

   If anyone feels that some adjustments to the build system should
   be done, relating to Gnulib, the proper way to do it is to add
   another instruction to the instruction pack shown above.

   But in this case, even this would be wrong, because:

3) The directory that is the argument of --local-dir is entirely
   maintained by the package. The developer decides which of the files
   he wants to distribute, and which he wants to keep for himself and
   not distribute. For example, it is perfectly reasonable for a
   developer to add  gl/modules/<module>.diff  if he wants to have
   a locally modified copy of <module> for his own purposes.
   It is not different from subdirectories with C source code, from
   subdirectories with data, from subdirectories with unit tests, etc.

Bruno