openwrt/tools/libtool/patches/000-relocatable.patch
Eneas U de Queiroz 0d0cfe9f2d tools/libtool: bump to 2.4.6
This updates libtool to its current release, from 2015.  Current patches
were renumbered and given a description text.  The fix in
160-passthrough-ssp.patch is no longer needed.

A patch to speed up build was cherry-picked, and another openwrt
specific patch was needed to not use quotes in $(SHELL), to acommodate
our "SHELL=/usr/bin/env bash" usage.

The already present call to ./bootstrap ensures that generated files are
refreshed, so the patches are applied only to their sources.  Also, that
bootstrap call was adjusted to run at the appropriate time when QUILT=1.

References below are relevant commits to upstream libtool
regarding some of the changes to patches.

This commit is being reapplied after previous revertion, and after some editing.
The fix for the issue that prompted reverting is the parent of this commit.

Ref: 435cb8d71 ("libtoolize: simplify runtime by substituting pkgauxdir")
Ref: 3cf11cfe2 ("libtoolize: rewritten over funclib.sh instead of general.m4sh")
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
[refactored to simplify patch changes, expanded patches, added upstream references]
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2023-03-13 22:53:41 +01:00

105 lines
3.8 KiB
Diff

From ca10caa502f971f90d8c041aa2476de54ef0ce2b Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
Date: Tue, 20 Jul 2021 16:41:11 -0300
Subject: openwrt: make relocatable, search resources relative to STAGING_DIR
This was originally commited to openwrt by Jo-Philipp Wich
<jow@openwrt.org>.
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
--- a/libtoolize.in
+++ b/libtoolize.in
@@ -38,14 +38,23 @@
# with bootstrap, so set those here where they can still be over-
# ridden by the user, but otherwise take precedence.
-: ${AUTOCONF="autoconf"}
-: ${AUTOMAKE="automake"}
-: ${EGREP="@EGREP@"}
-: ${FGREP="@FGREP@"}
-: ${GREP="@GREP@"}
: ${LN_S="@LN_S@"}
-: ${SED="@SED@"}
+if test -n "$STAGING_DIR_HOST"; then
+ : ${AUTOCONF="$STAGING_DIR_HOST/bin/autoconf"}
+ : ${AUTOMAKE="$STAGING_DIR_HOST/bin/automake"}
+ : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"}
+ : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"}
+ : ${GREP="$STAGING_DIR_HOST/bin/grep"}
+ : ${SED="$STAGING_DIR_HOST/bin/sed"}
+else
+ : ${AUTOCONF="autoconf"}
+ : ${AUTOMAKE="automake"}
+ : ${EGREP="@EGREP@"}
+ : ${FGREP="@FGREP@"}
+ : ${GREP="@GREP@"}
+ : ${SED="@SED@"}
+fi
## -------------------------- ##
## Source external libraries. ##
@@ -1901,11 +1910,21 @@ func_require_seen_libtool ()
pkgmacro_files="@pkgmacro_files@"
# Locations for important files:
- prefix="@prefix@"
- datadir="@datadir@"
- pkgauxdir="@pkgauxdir@"
- pkgltdldir="@pkgdatadir@"
- aclocaldir="@aclocaldir@"
+ if test -n "$STAGING_DIR_HOST"; then
+ prefix="$STAGING_DIR_HOST"
+ datadir="$STAGING_DIR_HOST/share"
+ pkgauxdir="$STAGING_DIR_HOST/share/libtool/build-aux"
+ pkgdatadir="$STAGING_DIR_HOST/share/libtool"
+ pkgltdldir="$STAGING_DIR_HOST/share/libtool"
+ aclocaldir="$STAGING_DIR_HOST/share/aclocal"
+ else
+ prefix="@prefix@"
+ datadir="@datadir@"
+ pkgauxdir="@pkgauxdir@"
+ pkgdatadir="@pkgdatadir@"
+ pkgltdldir="@pkgdatadir@"
+ aclocaldir="@aclocaldir@"
+ fi
# Allow the user to override the master libtoolize repository:
if test -n "$_lt_pkgdatadir"; then
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -931,7 +931,7 @@ m4_defun([_LT_TAG_COMPILER],
[AC_REQUIRE([AC_PROG_CC])dnl
_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/include"], [LTCC compiler flags])dnl
_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
@@ -8160,9 +8160,9 @@ m4_defun([_LT_DECL_EGREP],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_REQUIRE([AC_PROG_FGREP])dnl
test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
+_LT_DECL([], [GREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep"], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -E"], [An ERE matcher])
+_LT_DECL([], [FGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -F"], [A literal string matcher])
dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
AC_SUBST([GREP])
])
@@ -8195,9 +8195,8 @@ AC_SUBST([DLLTOOL])
# as few characters as possible. Prefer GNU sed if found.
m4_defun([_LT_DECL_SED],
[AC_PROG_SED
-test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [SED], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/sed"], [A sed program that does not truncate output])
_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
[Sed that helps us avoid accidentally triggering echo(1) options like -n])
])# _LT_DECL_SED