1 From: Richard Purdie <richard.purdie@linuxfoundation.org>
2 Subject: [PATCH 05/12] ltmain.in: Don't encode RATHS which match default linker paths
4 We don't want to add RPATHS which match default linker search paths, they're
5 a waste of space. This patch filters libtools list of paths to encoode and
6 removes the ones we don't need.
8 Libtool may be passed link paths of the form "/usr/lib/../lib" so normalize
9 the paths before comparision.
11 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13 Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00013.html]
15 diff -u b/build-aux/ltmain.in b/build-aux/ltmain.in
16 --- b/build-aux/ltmain.in
17 +++ b/build-aux/ltmain.in 2012-08-22 11:01:34.191345989 -0700
18 @@ -7286,8 +7286,16 @@
22 - eval flag=\"$hardcode_libdir_flag_spec\"
23 - func_append dep_rpath " $flag"
24 + # We only want to hardcode in an rpath if it isn't in the
25 + # default dlsearch path.
26 + func_normal_abspath "$libdir"
27 + libdir_norm=$func_normal_abspath_result
28 + case " $sys_lib_dlsearch_path " in
29 + *" $libdir_norm "*) ;;
30 + *) eval flag=\"$hardcode_libdir_flag_spec\"
31 + func_append dep_rpath " $flag"
35 elif test -n "$runpath_var"; then
36 case "$perm_rpath " in
37 @@ -8019,8 +8027,16 @@
41 - eval flag=\"$hardcode_libdir_flag_spec\"
42 - func_append rpath " $flag"
43 + # We only want to hardcode in an rpath if it isn't in the
44 + # default dlsearch path.
45 + func_normal_abspath "$libdir"
46 + libdir_norm=$func_normal_abspath_result
47 + case " $sys_lib_dlsearch_path " in
48 + *" $libdir_norm "*) ;;
49 + *) eval flag=\"$hardcode_libdir_flag_spec\"
54 elif test -n "$runpath_var"; then
55 case "$perm_rpath " in
56 @@ -8070,8 +8086,14 @@
60 - eval flag=\"$hardcode_libdir_flag_spec\"
61 - func_append rpath " $flag"
62 + # We only want to hardcode in an rpath if it isn't in the
63 + # default dlsearch path.
64 + case " $sys_lib_dlsearch_path " in
66 + *) eval flag=\"$hardcode_libdir_flag_spec\"
67 + func_append rpath " $flag"
71 elif test -n "$runpath_var"; then
72 case "$finalize_perm_rpath " in