diff options
author | Peter Seebach <peter.seebach@windriver.com> | 2013-10-08 19:03:57 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-08 17:25:33 +0000 |
commit | 77ff02ffa8e8f81bcec11c277de69da5af1d76ad (patch) | |
tree | 2e4888f500b019167bc0a82dc05213fa4e64a3ee /meta/recipes-devtools/binutils/binutils.inc | |
parent | d6cc7c8ed76c8b1117cf03c7bd4b0742f98f79b3 (diff) | |
download | poky-77ff02ffa8e8f81bcec11c277de69da5af1d76ad.tar.gz |
binutils: Use alternatives for the binutils-symlinks package.
The ar and strings utilities are provided as alternatives, but
the rest of binutils is being done with binutils-symlinks. This
has the side effect that if you want "as", and you install
binutils-symlinks to get it, you don't get "ar" from it, because
it's not in the symlinks package.
Solution: Use the same mechanisms for everything, putting
everything in ALTERNATIVES, so installing binutils on a target
produces the expected behavior of having the various utilities in place.
(We do this only for class-target, though.)
Issues: The "embedspu" and "ld.gold" binaries may or may not exist,
but the determination of whether to list them as alternatives is
being made before the point at which we can easily check for them,
so that can produce warnings.
(From OE-Core rev: 1395aefcaeac94dd0e6ed3a718b7e58dd43b355e)
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils.inc')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils.inc | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc index 5e78dc03df..05cbc6f3be 100644 --- a/meta/recipes-devtools/binutils/binutils.inc +++ b/meta/recipes-devtools/binutils/binutils.inc | |||
@@ -22,31 +22,49 @@ FILES_${PN} = " \ | |||
22 | ${libdir}/lib*-*.so \ | 22 | ${libdir}/lib*-*.so \ |
23 | ${prefix}/${TARGET_SYS}/bin/*" | 23 | ${prefix}/${TARGET_SYS}/bin/*" |
24 | 24 | ||
25 | # Use alternatives rather than actual symlinks. | ||
26 | FILES_${PN}-symlinks = "" | ||
27 | |||
28 | ALLOW_EMPTY_${PN}-symlinks = "1" | ||
29 | |||
25 | FILES_${PN}-dev = " \ | 30 | FILES_${PN}-dev = " \ |
26 | ${includedir} \ | 31 | ${includedir} \ |
27 | ${libdir}/*.la \ | 32 | ${libdir}/*.la \ |
28 | ${libdir}/libbfd.so \ | 33 | ${libdir}/libbfd.so \ |
29 | ${libdir}/libopcodes.so" | 34 | ${libdir}/libopcodes.so" |
30 | 35 | ||
31 | FILES_${PN}-symlinks = " \ | 36 | # Rather than duplicating multiple entries for these, make one |
32 | ${bindir}/addr2line \ | 37 | # list and reuse it. |
33 | ${bindir}/as \ | 38 | |
34 | ${bindir}/c++filt \ | 39 | USE_ALTERNATIVES_FOR = " \ |
35 | ${bindir}/embedspu \ | 40 | addr2line \ |
36 | ${bindir}/gprof \ | 41 | ar \ |
37 | ${bindir}/ld \ | 42 | as \ |
38 | ${bindir}/ld.bfd \ | 43 | c++filt \ |
39 | ${bindir}/ld.gold \ | 44 | elfedit \ |
40 | ${bindir}/nm \ | 45 | gprof \ |
41 | ${bindir}/objcopy \ | 46 | ld \ |
42 | ${bindir}/objdump \ | 47 | ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld.gold', 'ld.bfd', d)} \ |
43 | ${bindir}/ranlib \ | 48 | nm \ |
44 | ${bindir}/readelf \ | 49 | objcopy \ |
45 | ${bindir}/elfedit \ | 50 | objdump \ |
46 | ${bindir}/size \ | 51 | ranlib \ |
47 | ${bindir}/strip" | 52 | readelf \ |
48 | 53 | size \ | |
49 | FILES_${PN}-dbg += "${prefix}/${TARGET_SYS}/bin/.debug" | 54 | strings \ |
55 | strip \ | ||
56 | " | ||
57 | |||
58 | python do_package_prepend() { | ||
59 | make_alts = d.getVar("USE_ALTERNATIVES_FOR", True) or "" | ||
60 | prefix = d.getVar("TARGET_PREFIX", True) | ||
61 | bindir = d.getVar("bindir", True) | ||
62 | for alt in make_alts.split(): | ||
63 | d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt) | ||
64 | d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt) | ||
65 | } | ||
66 | |||
67 | # FILES_${PN}-dbg = "${prefix}/${TARGET_SYS}/bin/.debug ${prefix}/${libdir}/.debug" | ||
50 | 68 | ||
51 | B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" | 69 | B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" |
52 | 70 | ||
@@ -120,7 +138,9 @@ do_install () { | |||
120 | ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,` | 138 | ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,` |
121 | done | 139 | done |
122 | 140 | ||
123 | rm -f ${D}${bindir}/ar ${D}${bindir}/strings | 141 | for alt in ${USE_ALTERNATIVES_FOR}; do |
142 | rm -f ${D}${bindir}/$alt | ||
143 | done | ||
124 | 144 | ||
125 | oe_multilib_header bfd.h | 145 | oe_multilib_header bfd.h |
126 | } | 146 | } |
@@ -129,10 +149,5 @@ inherit update-alternatives | |||
129 | 149 | ||
130 | ALTERNATIVE_PRIORITY = "100" | 150 | ALTERNATIVE_PRIORITY = "100" |
131 | 151 | ||
132 | ALTERNATIVE_${PN}-symlinks = "ar strings" | 152 | ALTERNATIVE_${PN}-symlinks_class-target = "${USE_ALTERNATIVES_FOR}" |
133 | |||
134 | ALTERNATIVE_LINK_NAME[ar] = "${bindir}/ar" | ||
135 | ALTERNATIVE_TARGET[ar] = "${bindir}/${TARGET_PREFIX}ar" | ||
136 | 153 | ||
137 | ALTERNATIVE_LINK_NAME[strings] = "${bindir}/strings" | ||
138 | ALTERNATIVE_TARGET[strings] = "${bindir}/${TARGET_PREFIX}strings" | ||