| From 9c025c8be43d31cecdb161b942ce3a18fbe786bc Mon Sep 17 00:00:00 2001 |
| From: Petr Hosek <phosek@google.com> |
| Date: Fri, 31 Jul 2020 00:12:23 -0700 |
| Subject: [PATCH] Make automake relocatable |
| |
| This is the package definition for the automake tools and includes |
| a patch to make them relocatable (written against automake 1.16.2). |
| |
| By default automake hard-codes the --prefix value into the binaries it |
| deploys, making them unsuitable for relocatable deployment (e.g. with |
| CIPD). The patch here replaces all the hard-coded paths with either: |
| * The assumption that the tool is in $PATH, and so "/path/to/tool" is |
| replaced by "tool" |
| * The assumption that the data files are relative to the binary being |
| run, e.g. if we're running ".../bin/tool" that we can find the data |
| files at ".../share/extra_files". |
| |
| The patch was made by doing `make install` on the base package, looking |
| for absolute paths and then changing the sources so the absolute paths |
| no longer showed up in the output of `make install`. |
| --- |
| bin/aclocal.in | 11 ++++++++--- |
| bin/automake.in | 4 +++- |
| lib/Automake/Config.in | 4 +++- |
| 3 files changed, 14 insertions(+), 5 deletions(-) |
| |
| diff --git a/bin/aclocal.in b/bin/aclocal.in |
| index 9a20325..366805f 100644 |
| --- a/bin/aclocal.in |
| +++ b/bin/aclocal.in |
| @@ -21,7 +21,9 @@ |
| |
| BEGIN |
| { |
| - unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') |
| + use File::Basename; |
| + my $PREFIX = dirname(dirname(__FILE__)); |
| + unshift (@INC, "$PREFIX/share/@PACKAGE@-@APIVERSION@") |
| unless $ENV{AUTOMAKE_UNINSTALLED}; |
| } |
| |
| @@ -39,6 +41,9 @@ use File::Path (); |
| |
| # Some globals. |
| |
| +my $PREFIX = dirname(dirname(__FILE__)); |
| +my $DATADIR = "$PREFIX/share"; |
| + |
| # Support AC_CONFIG_MACRO_DIRS also with older autoconf. |
| # FIXME: To be removed in Automake 2.0, once we can assume autoconf |
| # 2.70 or later. |
| @@ -62,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 = ("$DATADIR/aclocal-" . $APIVERSION); |
| +my @system_includes = ("$DATADIR/aclocal"); |
| |
| # Whether we should copy M4 file in $user_includes[0]. |
| my $install = 0; |
| diff --git a/bin/automake.in b/bin/automake.in |
| index 212cb38..7c2d2a1 100644 |
| --- a/bin/automake.in |
| +++ b/bin/automake.in |
| @@ -26,7 +26,9 @@ use strict; |
| |
| BEGIN |
| { |
| - unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') |
| + use File::Basename; |
| + my $PREFIX = dirname(dirname(__FILE__)); |
| + unshift (@INC, "$PREFIX/share/@PACKAGE@-@APIVERSION@") |
| unless $ENV{AUTOMAKE_UNINSTALLED}; |
| |
| # Override SHELL. This is required on DJGPP so that system() uses |
| diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in |
| index f79b8cd..bfaf7ee 100644 |
| --- a/lib/Automake/Config.in |
| +++ b/lib/Automake/Config.in |
| @@ -16,6 +16,7 @@ |
| # along with this program. If not, see <https://www.gnu.org/licenses/>. |
| |
| package Automake::Config; |
| +use File::Basename; |
| use strict; |
| |
| use 5.006; |
| @@ -32,7 +33,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{"AUTOMAKE_LIBDIR"} || dirname(dirname(__FILE__)); |
| |
| our $perl_threads = 0; |
| # We need at least this version for CLONE support. |
| -- |
| 2.28.0.163.g6104cc2f0b6-goog |
| |