From 633c17d99fe42f1a754e4df3e5c360421037c5f7 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 15 Dec 2021 21:37:56 +0100 Subject: [PATCH] ports: prevent automake from updating Makfile.in This patch discharges the dependency of Makefile.in from Makefile.am files whenever both files are present in a downloaded archive. Being based on make, the trigger of running automake is based on the timestamps for the extracted archive content. However, since we reset the timestamps (via 'tar -m') at extraction time, no assumptions about the timestamp relations between the extracted files can be made. In the event automake is triggered, we are faced with the tool dependency from a specific automake version on the host. The patch enforces the unconditional use the 'Makefile.in' version supplied by the archive. Fixes #4350 --- tool/ports/mk/install.mk | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tool/ports/mk/install.mk b/tool/ports/mk/install.mk index 7b53092625a..f96a30a5f8c 100644 --- a/tool/ports/mk/install.mk +++ b/tool/ports/mk/install.mk @@ -256,8 +256,24 @@ _extract_function = $(call _assert,\ %.archive: ARCHIVE = $(call _archive_name,$*) %.archive: DIR = $(call _archive_dir,$*) +# +# Quirk for automake +# +# If both 'Makefile.in' and 'Makefile.am' are present, and 'Makefile.am' +# happens to have the more recent timestamp (by chance, using 'tar -m'), +# a rule in the resulting 'Makefile' make will try to run automake to +# re-generate 'Makefile.in' from 'Makefile.am'. This step is brittle +# because it requires a specific automake version on the host. +# +# We rename the rule target to discharge this magic and keep using the +# provided 'Makefile.in'. +# +_discharge_automake = ( find $(DIR) -name "Makefile.in" |\ + xargs sed -i "/Makefile\.in:.*Makefile\.am/s/^/IGNORE-/" ) + %.archive: %.file @$(MSG_EXTRACT)"$(ARCHIVE) ($*)" $(VERBOSE)\ mkdir -p $(DIR);\ - $(call _extract_function,$*) + $(call _extract_function,$*);\ + $(_discharge_automake)