Skip to content

Commit

Permalink
ports: prevent automake from updating Makfile.in
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nfeske committed Dec 16, 2021
1 parent 7c103f6 commit 633c17d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tool/ports/mk/install.mk
Expand Up @@ -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)

0 comments on commit 633c17d

Please sign in to comment.