Patch ./configure, or use autogen.sh instead?
Ryan Schmidt
ryandesign at macports.org
Mon Feb 21 23:21:03 UTC 2022
On Feb 21, 2022, at 16:32, Jim DeLaHunt wrote:
> But I also thought, why not also patch the m4 macros which generate the configure script? It keeps the codebase on the user's machine consistent. It keeps the patches in the MacPorts repository. What harm could it do?
>
> I'm glad you asked that! It turns out that this codebase's Makefile includes rules to rerun aclocal, autoconf, and automake if any of the m4
> macro files are newer than aclocal.m4, or configure, or config.status,
> or a few other files. When the Portfile patches these m4 scripts, it
> updates their modification times to the present, which is newer than aclocal.m4. Thus at build time, the Makefile attempts to perform the
> configuration phase all over again. port -t (trace mode) exposes that
> this adds dependencies on those autotools.
>
> I worked around this by adding a post-patch clause which used the
> "touch -r" macro to reset the modification times of the files I patched to be the same an an unpatched macro file. This keeps the Makefile happy.
>
> It might turn out to be smarter to remove the patches and the touches of those macro files. It makes for a simpler Portfile. I have not decided.
It's not just this codebase that does that; it's a feature of autotools. That's one of the reasons why I said to decide whether to patch the generated files or the files they're generated from, not both.
More information about the macports-dev
mailing list