ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/tools/automake/Makefile b/tools/automake/Makefile
new file mode 100644
index 0000000..7f129c1
--- /dev/null
+++ b/tools/automake/Makefile
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=automake
+PKG_CPE_ID:=cpe:/a:gnu:automake
+PKG_VERSION:=1.16.5
+PKG_API_VERSION:=$(word 2,$(subst ., ,$(PKG_VERSION)))
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/automake
+PKG_HASH:=07bd24ad08a64bc17250ce09ec56e921d6343903943e99ccf63bbf0705e34605
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOST_CONFIGURE_ARGS += \
+ --disable-silent-rules
+
+HOST_CONFIGURE_VARS += \
+ PERL="/usr/bin/env perl" \
+ am_cv_prog_PERL_ithreads=no
+
+define Host/Configure
+ (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR_HOST="" ./bootstrap)
+ $(call Host/Configure/Default)
+endef
+
+define Host/Install
+ # remove old automake resources to avoid version conflicts
+ $(call Host/Uninstall)
+ $(call Host/Compile/Default,install)
+ mv $(STAGING_DIR_HOST)/bin/aclocal $(STAGING_DIR_HOST)/bin/aclocal.real
+ $(INSTALL_BIN) ./files/aclocal $(STAGING_DIR_HOST)/bin
+ ( \
+ api=$(PKG_API_VERSION); \
+ while [ "$$$$api" -ge 11 ]; do \
+ ln -sf aclocal "$(STAGING_DIR_HOST)/bin/aclocal-1.$$$$api"; \
+ api=$$$$(($$$$api - 1)); \
+ done; \
+ )
+endef
+
+define Host/Uninstall
+ -$(call Host/Compile/Default,uninstall)
+ rm -rf $(STAGING_DIR_HOST)/share/aclocal-[0-9]*
+ rm -rf $(STAGING_DIR_HOST)/share/automake-[0-9]*
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/automake/files/aclocal b/tools/automake/files/aclocal
new file mode 100755
index 0000000..689cb04
--- /dev/null
+++ b/tools/automake/files/aclocal
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+${STAGING_DIR_HOST}/bin/aclocal.real $ACLOCAL_INCLUDE $@
diff --git a/tools/automake/patches/000-relocatable.patch b/tools/automake/patches/000-relocatable.patch
new file mode 100644
index 0000000..0b61eae
--- /dev/null
+++ b/tools/automake/patches/000-relocatable.patch
@@ -0,0 +1,52 @@
+--- a/lib/Automake/Config.in
++++ b/lib/Automake/Config.in
+@@ -34,7 +34,7 @@ our $PACKAGE = '@PACKAGE@';
+ our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@';
+ our $VERSION = '@VERSION@';
+ our $RELEASE_YEAR = '@RELEASE_YEAR@';
+-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@';
++our $libdir = $ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@';
+
+ our $perl_threads = 0;
+ # We need at least this version for CLONE support.
+--- a/bin/aclocal.in
++++ b/bin/aclocal.in
+@@ -23,9 +23,11 @@ use 5.006;
+ use strict;
+ use warnings FATAL => 'all';
+
++$^W = 1;
++
+ BEGIN
+ {
+- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@')
++ unshift (@INC, ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'))
+ unless $ENV{AUTOMAKE_UNINSTALLED};
+ }
+
+@@ -65,8 +67,8 @@ $perl_threads = 0;
+ # ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
+ # option.
+ my @user_includes = ();
+-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION);
+-my @system_includes = ('@datadir@/aclocal');
++my @automake_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . "/share/aclocal-$APIVERSION" : "@datadir@/aclocal-$APIVERSION");
++my @system_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/aclocal' : '@datadir@/aclocal');
+
+ # Whether we should copy M4 file in $user_includes[0].
+ my $install = 0;
+--- a/bin/automake.in
++++ b/bin/automake.in
+@@ -26,9 +26,11 @@ use 5.006;
+ use strict;
+ use warnings FATAL => 'all';
+
++$^W = 1;
++
+ BEGIN
+ {
+- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@')
++ unshift (@INC, ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'))
+ unless $ENV{AUTOMAKE_UNINSTALLED};
+
+ # Override SHELL. This is required on DJGPP so that system() uses
diff --git a/tools/automake/patches/100-aclocal-skip-not-existing-directories.patch b/tools/automake/patches/100-aclocal-skip-not-existing-directories.patch
new file mode 100644
index 0000000..a0d04e2
--- /dev/null
+++ b/tools/automake/patches/100-aclocal-skip-not-existing-directories.patch
@@ -0,0 +1,15 @@
+--- a/bin/aclocal.in
++++ b/bin/aclocal.in
+@@ -371,6 +371,12 @@ sub scan_m4_dirs ($$@)
+
+ foreach my $m4dir (@dirlist)
+ {
++ if (! -d $m4dir)
++ {
++ msg ('override', "warning: skipping not existing directory `$m4dir'");
++ next;
++ }
++
+ if (! opendir (DIR, $m4dir))
+ {
+ # TODO: maybe avoid complaining only if errno == ENONENT?
diff --git a/tools/automake/patches/101-do-not-require-files.patch b/tools/automake/patches/101-do-not-require-files.patch
new file mode 100644
index 0000000..3a8c9fc
--- /dev/null
+++ b/tools/automake/patches/101-do-not-require-files.patch
@@ -0,0 +1,29 @@
+--- a/bin/automake.in
++++ b/bin/automake.in
+@@ -4513,7 +4513,7 @@ sub handle_gettext ()
+ && grep ($_ eq 'intl', @subdirs));
+ }
+
+- require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
++ require_file ($ac_gettext_location, GNITS, 'ABOUT-NLS');
+ }
+
+ # Emit makefile footer.
+@@ -5641,7 +5641,7 @@ sub check_gnu_standards ()
+ # otherwise require non-.md.
+ my $required
+ = (! -f $file && -f "$file.md") ? "$file.md" : $file;
+- require_file ("$am_file.am", GNU, $required);
++ require_file ("$am_file.am", GNITS, $required);
+ }
+
+ # Accept one of these three licenses; default to COPYING.
+@@ -5655,7 +5655,7 @@ sub check_gnu_standards ()
+ last;
+ }
+ }
+- require_file ("$am_file.am", GNU, 'COPYING')
++ require_file ("$am_file.am", GNITS, 'COPYING')
+ unless $license;
+ }
+
diff --git a/tools/automake/patches/200-other-V-values-for-verbosity.patch b/tools/automake/patches/200-other-V-values-for-verbosity.patch
new file mode 100644
index 0000000..1ea9d38
--- /dev/null
+++ b/tools/automake/patches/200-other-V-values-for-verbosity.patch
@@ -0,0 +1,59 @@
+From: Bogdan Drozdowski <bogdandr AT op.pl>
+Date: Sat, 31 Dec 2022 20:17:35 +0100
+Subject: [PATCH] Allow other V values for verbosity
+
+---
+ m4/silent.m4 | 2 +-
+ t/silent-gen.sh | 24 ++++++++++++++++++++++++
+ 2 files changed, 25 insertions(+), 1 deletion(-)
+
+--- a/m4/silent.m4
++++ b/m4/silent.m4
+@@ -43,7 +43,7 @@ else
+ fi])
+ if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+- AM_V='$(V)'
++ AM_V='$(shell if ( test "x$(V)" = "x0" ); then echo 0; elif ( test "x$(V)" = "x" ); then echo $(AM_DEFAULT_VERBOSITY); else echo 1; fi)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+ else
+ AM_V=$AM_DEFAULT_VERBOSITY
+--- a/t/silent-gen.sh
++++ b/t/silent-gen.sh
+@@ -54,6 +54,18 @@ grep 'cp ' stdout
+ grep 'echo ' stdout
+
+ $MAKE clean
++run_make -O V=99
++grep 'GEN ' stdout && exit 1
++grep 'cp ' stdout
++grep 'echo ' stdout
++
++$MAKE clean
++run_make -O V=vvv
++grep 'GEN ' stdout && exit 1
++grep 'cp ' stdout
++grep 'echo ' stdout
++
++$MAKE clean
+ run_make -O V=0
+ grep 'GEN .*foo' stdout
+ grep 'cp ' stdout && exit 1
+@@ -78,5 +90,17 @@ run_make -O V=1
+ grep 'GEN ' stdout && exit 1
+ grep 'cp ' stdout
+ grep 'echo ' stdout
++
++$MAKE clean
++run_make -O V=99
++grep 'GEN ' stdout && exit 1
++grep 'cp ' stdout
++grep 'echo ' stdout
++
++$MAKE clean
++run_make -O V=v
++grep 'GEN ' stdout && exit 1
++grep 'cp ' stdout
++grep 'echo ' stdout
+
+ :