prepare_ports: prevent execution of automake

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
This commit is contained in:
Norman Feske 2021-12-15 21:37:56 +01:00
parent c8a3497662
commit 4f820cf1e5

View File

@ -256,8 +256,24 @@ _extract_function = $(call _assert,\
%.archive: ARCHIVE = $(call _archive_name,$*) %.archive: ARCHIVE = $(call _archive_name,$*)
%.archive: DIR = $(call _archive_dir,$*) %.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 -r sed -i "/Makefile\.in:.*Makefile\.am/s/^/IGNORE-/" )
%.archive: %.file %.archive: %.file
@$(MSG_EXTRACT)"$(ARCHIVE) ($*)" @$(MSG_EXTRACT)"$(ARCHIVE) ($*)"
$(VERBOSE)\ $(VERBOSE)\
mkdir -p $(DIR);\ mkdir -p $(DIR);\
$(call _extract_function,$*) $(call _extract_function,$*);\
$(_discharge_automake)