e6189d562a4024a46afac576e4293b3c08145ffc
[openwrt/staging/jow.git] / tools / libtool / patches / 000-relocatable.patch
1 From ca10caa502f971f90d8c041aa2476de54ef0ce2b Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cotequeiroz@gmail.com>
3 Date: Tue, 20 Jul 2021 16:41:11 -0300
4 Subject: openwrt: make relocatable, search resources relative to STAGING_DIR
5
6 This was originally commited to openwrt by Jo-Philipp Wich
7 <jow@openwrt.org>.
8
9 Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
10
11 --- a/libtoolize.in
12 +++ b/libtoolize.in
13 @@ -38,14 +38,23 @@
14 # with bootstrap, so set those here where they can still be over-
15 # ridden by the user, but otherwise take precedence.
16
17 -: ${AUTOCONF="autoconf"}
18 -: ${AUTOMAKE="automake"}
19 -: ${EGREP="@EGREP@"}
20 -: ${FGREP="@FGREP@"}
21 -: ${GREP="@GREP@"}
22 : ${LN_S="@LN_S@"}
23 -: ${SED="@SED@"}
24
25 +if test -n "$STAGING_DIR_HOST"; then
26 + : ${AUTOCONF="$STAGING_DIR_HOST/bin/autoconf"}
27 + : ${AUTOMAKE="$STAGING_DIR_HOST/bin/automake"}
28 + : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"}
29 + : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"}
30 + : ${GREP="$STAGING_DIR_HOST/bin/grep"}
31 + : ${SED="$STAGING_DIR_HOST/bin/sed"}
32 +else
33 + : ${AUTOCONF="autoconf"}
34 + : ${AUTOMAKE="automake"}
35 + : ${EGREP="@EGREP@"}
36 + : ${FGREP="@FGREP@"}
37 + : ${GREP="@GREP@"}
38 + : ${SED="@SED@"}
39 +fi
40
41 ## -------------------------- ##
42 ## Source external libraries. ##
43 @@ -1901,11 +1910,21 @@ func_require_seen_libtool ()
44 pkgmacro_files="@pkgmacro_files@"
45
46 # Locations for important files:
47 - prefix="@prefix@"
48 - datadir="@datadir@"
49 - pkgauxdir="@pkgauxdir@"
50 - pkgltdldir="@pkgdatadir@"
51 - aclocaldir="@aclocaldir@"
52 + if test -n "$STAGING_DIR_HOST"; then
53 + prefix="$STAGING_DIR_HOST"
54 + datadir="$STAGING_DIR_HOST/share"
55 + pkgauxdir="$STAGING_DIR_HOST/share/libtool/build-aux"
56 + pkgdatadir="$STAGING_DIR_HOST/share/libtool"
57 + pkgltdldir="$STAGING_DIR_HOST/share/libtool"
58 + aclocaldir="$STAGING_DIR_HOST/share/aclocal"
59 + else
60 + prefix="@prefix@"
61 + datadir="@datadir@"
62 + pkgauxdir="@pkgauxdir@"
63 + pkgdatadir="@pkgdatadir@"
64 + pkgltdldir="@pkgdatadir@"
65 + aclocaldir="@aclocaldir@"
66 + fi
67
68 # Allow the user to override the master libtoolize repository:
69 if test -n "$_lt_pkgdatadir"; then
70 --- a/m4/libtool.m4
71 +++ b/m4/libtool.m4
72 @@ -931,7 +931,7 @@ m4_defun([_LT_TAG_COMPILER],
73 [AC_REQUIRE([AC_PROG_CC])dnl
74
75 _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
76 -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
77 +_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/include"], [LTCC compiler flags])dnl
78 _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
79 _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
80
81 @@ -8160,9 +8160,9 @@ m4_defun([_LT_DECL_EGREP],
82 [AC_REQUIRE([AC_PROG_EGREP])dnl
83 AC_REQUIRE([AC_PROG_FGREP])dnl
84 test -z "$GREP" && GREP=grep
85 -_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
86 -_LT_DECL([], [EGREP], [1], [An ERE matcher])
87 -_LT_DECL([], [FGREP], [1], [A literal string matcher])
88 +_LT_DECL([], [GREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep"], [A grep program that handles long lines])
89 +_LT_DECL([], [EGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -E"], [An ERE matcher])
90 +_LT_DECL([], [FGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -F"], [A literal string matcher])
91 dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
92 AC_SUBST([GREP])
93 ])
94 @@ -8195,9 +8195,8 @@ AC_SUBST([DLLTOOL])
95 # as few characters as possible. Prefer GNU sed if found.
96 m4_defun([_LT_DECL_SED],
97 [AC_PROG_SED
98 -test -z "$SED" && SED=sed
99 Xsed="$SED -e 1s/^X//"
100 -_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
101 +_LT_DECL([], [SED], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/sed"], [A sed program that does not truncate output])
102 _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
103 [Sed that helps us avoid accidentally triggering echo(1) options like -n])
104 ])# _LT_DECL_SED