75ab5838069a37cd08cc3c1f2c219f59c1bf0f13
[openwrt/staging/stintel.git] / tools / libtool / patches / 100-libdir-fixes.patch
1 From 67ffe8e8582a7ba1f1d1307a419098e6dd88bdaf 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: cross-compilation path adjustments
5
6 Comments from the patch:
7
8 Adding 'libdir' from the .la file to our library search paths
9 breaks crosscompilation horribly. We cheat here and don't add
10 it, instead adding the path where we found the .la. -CL
11
12 OE sets installed=no in staging. We need to look in $objdir and $absdir,
13 preferring $objdir. RP 31/04/2008
14
15 This was originally commited to openwrt by Jo-Philipp Wich
16 <jow@openwrt.org>.
17
18 Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
19
20 --- a/libltdl/config/ltmain.m4sh
21 +++ b/libltdl/config/ltmain.m4sh
22 @@ -5731,8 +5731,14 @@ func_mode_link ()
23 absdir="$abs_ladir"
24 libdir="$abs_ladir"
25 else
26 - dir="$lt_sysroot$libdir"
27 - absdir="$lt_sysroot$libdir"
28 + # Adding 'libdir' from the .la file to our library search paths
29 + # breaks crosscompilation horribly. We cheat here and don't add
30 + # it, instead adding the path where we found the .la. -CL
31 + dir="$lt_sysroot$abs_ladir"
32 + absdir="$abs_ladir"
33 + libdir="$abs_ladir"
34 + #dir="$libdir"
35 + #absdir="$lt_sysroot$libdir"
36 fi
37 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
38 else
39 @@ -6130,8 +6136,6 @@ func_mode_link ()
40 add="$libdir/$linklib"
41 fi
42 else
43 - # We cannot seem to hardcode it, guess we'll fake it.
44 - add_dir="-L$libdir"
45 # Try looking first in the location we're being installed to.
46 if test -n "$inst_prefix_dir"; then
47 case $libdir in
48 @@ -6286,7 +6290,17 @@ func_mode_link ()
49 fi
50 ;;
51 *)
52 - path="-L$absdir/$objdir"
53 + # OE sets installed=no in staging. We need to look in $objdir and $absdir,
54 + # preferring $objdir. RP 31/04/2008
55 + if test -f "$absdir/$objdir/$depdepl" ; then
56 + depdepl="$absdir/$objdir/$depdepl"
57 + path="-L$absdir/$objdir"
58 + elif test -f "$absdir/$depdepl" ; then
59 + depdepl="$absdir/$depdepl"
60 + path="-L$absdir"
61 + else
62 + path="-L$absdir/$objdir"
63 + fi
64 ;;
65 esac
66 else
67 --- a/libltdl/config/ltmain.sh
68 +++ b/libltdl/config/ltmain.sh
69 @@ -6518,8 +6518,14 @@ func_mode_link ()
70 absdir="$abs_ladir"
71 libdir="$abs_ladir"
72 else
73 - dir="$lt_sysroot$libdir"
74 - absdir="$lt_sysroot$libdir"
75 + # Adding 'libdir' from the .la file to our library search paths
76 + # breaks crosscompilation horribly. We cheat here and don't add
77 + # it, instead adding the path where we found the .la. -CL
78 + dir="$lt_sysroot$abs_ladir"
79 + absdir="$abs_ladir"
80 + libdir="$abs_ladir"
81 + #dir="$libdir"
82 + #absdir="$lt_sysroot$libdir"
83 fi
84 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
85 else
86 @@ -6917,8 +6923,6 @@ func_mode_link ()
87 add="$libdir/$linklib"
88 fi
89 else
90 - # We cannot seem to hardcode it, guess we'll fake it.
91 - add_dir="-L$libdir"
92 # Try looking first in the location we're being installed to.
93 if test -n "$inst_prefix_dir"; then
94 case $libdir in
95 @@ -7073,7 +7077,17 @@ func_mode_link ()
96 fi
97 ;;
98 *)
99 - path="-L$absdir/$objdir"
100 + # OE sets installed=no in staging. We need to look in $objdir and $absdir,
101 + # preferring $objdir. RP 31/04/2008
102 + if test -f "$absdir/$objdir/$depdepl" ; then
103 + depdepl="$absdir/$objdir/$depdepl"
104 + path="-L$absdir/$objdir"
105 + elif test -f "$absdir/$depdepl" ; then
106 + depdepl="$absdir/$depdepl"
107 + path="-L$absdir"
108 + else
109 + path="-L$absdir/$objdir"
110 + fi
111 ;;
112 esac
113 else