88d1eaed02ceb8b554196150bbbc12e58341b1f4
[openwrt/staging/mkresin.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 (adjusted to v2.4.6)
10 Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
11
12 --- a/libtoolize.in
13 +++ b/libtoolize.in
14 @@ -40,11 +40,18 @@
15
16 : ${AUTOCONF="autoconf"}
17 : ${AUTOMAKE="automake"}
18 -: ${EGREP="@EGREP@"}
19 -: ${FGREP="@FGREP@"}
20 -: ${GREP="@GREP@"}
21 : ${LN_S="@LN_S@"}
22 -: ${SED="@SED@"}
23 +if test -n "$STAGING_DIR"; then
24 + : ${EGREP="$STAGING_DIR/../host/bin/grep -E"}
25 + : ${FGREP="$STAGING_DIR/../host/bin/grep -F"}
26 + : ${GREP="$STAGING_DIR/../host/bin/grep"}
27 + : ${SED="$STAGING_DIR/../host/bin/sed"}
28 +else
29 + : ${EGREP="@EGREP@"}
30 + : ${FGREP="@FGREP@"}
31 + : ${GREP="@GREP@"}
32 + : ${SED="@SED@"}
33 +fi
34
35
36 ## -------------------------- ##
37 --- a/m4/libtool.m4
38 +++ b/m4/libtool.m4
39 @@ -929,9 +929,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], [])
40 # ----------------
41 m4_defun([_LT_TAG_COMPILER],
42 [AC_REQUIRE([AC_PROG_CC])dnl
43 -
44 _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
45 -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
46 +_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR:-$STAGING_DIR}/../host/include"], [LTCC compiler flags])dnl
47 _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
48 _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
49
50 @@ -8160,9 +8159,9 @@ m4_defun([_LT_DECL_EGREP],
51 [AC_REQUIRE([AC_PROG_EGREP])dnl
52 AC_REQUIRE([AC_PROG_FGREP])dnl
53 test -z "$GREP" && GREP=grep
54 -_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
55 -_LT_DECL([], [EGREP], [1], [An ERE matcher])
56 -_LT_DECL([], [FGREP], [1], [A literal string matcher])
57 +_LT_DECL([], [GREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep"], [A grep program that handles long lines])
58 +_LT_DECL([], [EGREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep -E"], [An ERE matcher])
59 +_LT_DECL([], [FGREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep -F"], [A literal string matcher])
60 dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
61 AC_SUBST([GREP])
62 ])
63 @@ -8195,9 +8194,8 @@ AC_SUBST([DLLTOOL])
64 # as few characters as possible. Prefer GNU sed if found.
65 m4_defun([_LT_DECL_SED],
66 [AC_PROG_SED
67 -test -z "$SED" && SED=sed
68 Xsed="$SED -e 1s/^X//"
69 -_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
70 +_LT_DECL([], [SED], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/sed"], [A sed program that does not truncate output])
71 _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
72 [Sed that helps us avoid accidentally triggering echo(1) options like -n])
73 ])# _LT_DECL_SED