1 |
Signed-off-by: David Seifert <soap@g.o> |
2 |
--- |
3 |
eclass/usr-ldscript.eclass | 38 ++++++++++++++++++++------------------ |
4 |
1 file changed, 20 insertions(+), 18 deletions(-) |
5 |
|
6 |
diff --git a/eclass/usr-ldscript.eclass b/eclass/usr-ldscript.eclass |
7 |
index c821abd6084..b73d538ae5b 100644 |
8 |
--- a/eclass/usr-ldscript.eclass |
9 |
+++ b/eclass/usr-ldscript.eclass |
10 |
@@ -4,11 +4,11 @@ |
11 |
# @ECLASS: usr-ldscript.eclass |
12 |
# @MAINTAINER: |
13 |
# Toolchain Ninjas <toolchain@g.o> |
14 |
-# @SUPPORTED_EAPIS: 6 7 8 |
15 |
+# @SUPPORTED_EAPIS: 7 8 |
16 |
# @BLURB: Defines the gen_usr_ldscript function. |
17 |
|
18 |
case ${EAPI} in |
19 |
- 6|7|8) ;; |
20 |
+ 7|8) ;; |
21 |
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
22 |
esac |
23 |
|
24 |
@@ -84,27 +84,27 @@ gen_usr_ldscript() { |
25 |
# Ensure /lib/${lib} exists to avoid dangling scripts/symlinks. |
26 |
# This especially is for AIX where $(get_libname) can return ".a", |
27 |
# so /lib/${lib} might be moved to /usr/lib/${lib} (by accident). |
28 |
- [[ -r ${ED%/}/${libdir}/${lib} ]] || continue |
29 |
+ [[ -r ${ED}/${libdir}/${lib} ]] || continue |
30 |
#TODO: better die here? |
31 |
fi |
32 |
|
33 |
case ${CTARGET:-${CHOST}} in |
34 |
*-darwin*) |
35 |
if ${auto} ; then |
36 |
- tlib=$(scanmacho -qF'%S#F' "${ED%/}"/usr/${libdir}/${lib}) |
37 |
+ tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) |
38 |
else |
39 |
- tlib=$(scanmacho -qF'%S#F' "${ED%/}"/${libdir}/${lib}) |
40 |
+ tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}) |
41 |
fi |
42 |
[[ -z ${tlib} ]] && die "unable to read install_name from ${lib}" |
43 |
tlib=${tlib##*/} |
44 |
|
45 |
if ${auto} ; then |
46 |
- mv "${ED%/}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED%/}"/${libdir}/ || die |
47 |
+ mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die |
48 |
# some install_names are funky: they encode a version |
49 |
if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then |
50 |
- mv "${ED%/}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED%/}"/${libdir}/ || die |
51 |
+ mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die |
52 |
fi |
53 |
- rm -f "${ED%/}"/${libdir}/${lib} |
54 |
+ rm -f "${ED}"/${libdir}/${lib} |
55 |
fi |
56 |
|
57 |
# Mach-O files have an id, which is like a soname, it tells how |
58 |
@@ -114,34 +114,36 @@ gen_usr_ldscript() { |
59 |
# libdir=/lib because that messes up libtool files. |
60 |
# Make sure we don't lose the specific version, so just modify the |
61 |
# existing install_name |
62 |
- if [[ ! -w "${ED%/}/${libdir}/${tlib}" ]] ; then |
63 |
- chmod u+w "${ED%/}/${libdir}/${tlib}" # needed to write to it |
64 |
+ if [[ ! -w "${ED}/${libdir}/${tlib}" ]] ; then |
65 |
+ chmod u+w "${ED}/${libdir}/${tlib}" || die # needed to write to it |
66 |
local nowrite=yes |
67 |
fi |
68 |
install_name_tool \ |
69 |
-id "${EPREFIX}"/${libdir}/${tlib} \ |
70 |
- "${ED%/}"/${libdir}/${tlib} || die "install_name_tool failed" |
71 |
- [[ -n ${nowrite} ]] && chmod u-w "${ED%/}/${libdir}/${tlib}" |
72 |
+ "${ED}"/${libdir}/${tlib} || die "install_name_tool failed" |
73 |
+ if [[ -n ${nowrite} ]] ; then |
74 |
+ chmod u-w "${ED}/${libdir}/${tlib}" || die |
75 |
+ fi |
76 |
# Now as we don't use GNU binutils and our linker doesn't |
77 |
# understand linker scripts, just create a symlink. |
78 |
- pushd "${ED%/}/usr/${libdir}" > /dev/null |
79 |
+ pushd "${ED}/usr/${libdir}" > /dev/null |
80 |
ln -snf "../../${libdir}/${tlib}" "${lib}" |
81 |
popd > /dev/null |
82 |
;; |
83 |
*) |
84 |
if ${auto} ; then |
85 |
- tlib=$(scanelf -qF'%S#F' "${ED%/}"/usr/${libdir}/${lib}) |
86 |
+ tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) |
87 |
[[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" |
88 |
- mv "${ED%/}"/usr/${libdir}/${lib}* "${ED%/}"/${libdir}/ || die |
89 |
+ mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die |
90 |
# some SONAMEs are funky: they encode a version before the .so |
91 |
if [[ ${tlib} != ${lib}* ]] ; then |
92 |
- mv "${ED%/}"/usr/${libdir}/${tlib}* "${ED%/}"/${libdir}/ || die |
93 |
+ mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die |
94 |
fi |
95 |
- rm -f "${ED%/}"/${libdir}/${lib} |
96 |
+ rm -f "${ED}"/${libdir}/${lib} |
97 |
else |
98 |
tlib=${lib} |
99 |
fi |
100 |
- cat > "${ED%/}/usr/${libdir}/${lib}" <<-END_LDSCRIPT |
101 |
+ cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT |
102 |
/* GNU ld script |
103 |
Since Gentoo has critical dynamic libraries in /lib, and the static versions |
104 |
in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we |
105 |
-- |
106 |
2.39.0 |