summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/binutils/binutils.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils.inc')
-rw-r--r--meta/recipes-devtools/binutils/binutils.inc128
1 files changed, 71 insertions, 57 deletions
diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
index 08c14b2dee..7efe13fdf6 100644
--- a/meta/recipes-devtools/binutils/binutils.inc
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -1,4 +1,4 @@
-SUMMARY = "A GNU collection of binary utilities"
+SUMMARY = "GNU binary utilities"
DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
The main ones are ld (GNU Linker), and as (GNU Assembler). This \
package also includes addition tools such as addr2line (Converts \
@@ -11,45 +11,75 @@ BUGTRACKER = "http://sourceware.org/bugzilla/"
SECTION = "devel"
LICENSE = "GPLv3"
-DEPENDS = "flex-native bison-native zlib-native"
+DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native"
-inherit autotools gettext
+#
+# we need chrpath > 0.14 and some distros like centos 7 still have older chrpath
+#
+DEPENDS_append_class-target = " chrpath-replacement-native"
+EXTRANATIVEPATH_append_class-target = " chrpath-native"
-PACKAGES += "${PN}-symlinks"
+inherit autotools gettext multilib_header texinfo
FILES_${PN} = " \
${bindir}/${TARGET_PREFIX}* \
${libdir}/lib*-*.so \
- ${prefix}/${TARGET_SYS}/bin/*"
+ ${prefix}/${TARGET_SYS}/bin/* \
+ ${bindir}/embedspu"
+
+RPROVIDES_${PN} += "${PN}-symlinks"
FILES_${PN}-dev = " \
${includedir} \
- ${libdir}/*.a \
${libdir}/*.la \
${libdir}/libbfd.so \
${libdir}/libopcodes.so"
-FILES_${PN}-symlinks = " \
- ${bindir}/addr2line \
- ${bindir}/as \
- ${bindir}/c++filt \
- ${bindir}/gprof \
- ${bindir}/ld \
- ${bindir}/nm \
- ${bindir}/objcopy \
- ${bindir}/objdump \
- ${bindir}/ranlib \
- ${bindir}/readelf \
- ${bindir}/size \
- ${bindir}/strip"
+# Rather than duplicating multiple entries for these, make one
+# list and reuse it.
+
+USE_ALTERNATIVES_FOR = " \
+ addr2line \
+ ar \
+ as \
+ c++filt \
+ elfedit \
+ gprof \
+ ld \
+ ld.bfd \
+ ld.gold dwp \
+ nm \
+ objcopy \
+ objdump \
+ ranlib \
+ readelf \
+ size \
+ strings \
+ strip \
+"
+
+python do_package_prepend() {
+ make_alts = d.getVar("USE_ALTERNATIVES_FOR") or ""
+ prefix = d.getVar("TARGET_PREFIX")
+ bindir = d.getVar("bindir")
+ for alt in make_alts.split():
+ d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt)
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt)
+}
B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
- --enable-install-libbfd \
- --enable-shared"
+ --disable-werror \
+ --enable-deterministic-archives \
+ --enable-plugins \
+ ${LDGOLD} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
-EXTRA_OECONF_virtclass-native = "--enable-target=all --enable-64-bit-bfd --enable-install-libbfd"
+LDGOLD_class-native = ""
+LDGOLD_class-crosssdk = ""
+LDGOLD_sdkmingw32 = ""
+LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
# This is necessary due to a bug in the binutils Makefiles
# EXTRA_OEMAKE = "configure-build-libiberty all"
@@ -71,10 +101,12 @@ export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
-export CC_FOR_BUILD = "${BUILD_CC}"
-export CPP_FOR_BUILD = "${BUILD_CPP}"
-export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
+# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need
+# to unset LD_LIBRARY_PATH.
+export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
+MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
+do_configure[vardeps] += "MULTIARCH"
do_configure () {
(cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
oe_runconf
@@ -83,10 +115,14 @@ do_configure () {
#
mkdir -p ${B}/build-${BUILD_SYS}
for i in ${CONFIG_SITE}; do
- cat $i >> ${B}/build-${BUILD_SYS}/config.cache
+ cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true
done
}
+do_compile_append_class-target() {
+ chrpath -d ${B}/binutils/elfedit
+ chrpath -d ${B}/binutils/readelf
+}
do_install () {
autotools_do_install
@@ -109,41 +145,19 @@ do_install () {
cd ${D}${bindir}
# Symlinks for ease of running these on the native target
- for p in ${TARGET_SYS}-* ; do
+ for p in ${TARGET_PREFIX}* ; do
ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
done
- rm ${D}${bindir}/ar ${D}${bindir}/strings
-}
-
-do_install_virtclass-native () {
- autotools_do_install
-
- # Install the libiberty header
- install -d ${D}${includedir}
- install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
- install -m 644 ${S}/include/libiberty.h ${D}${includedir}
+ for alt in ${USE_ALTERNATIVES_FOR}; do
+ rm -f ${D}${bindir}/$alt
+ done
- # We only want libiberty, libbfd and libopcodes
- rm -rf ${D}${bindir}
- rm -rf ${D}${prefix}/${TARGET_SYS}
- rm -rf ${D}${prefix}/lib/ldscripts
- rm -rf ${D}${prefix}/share/info
- rm -rf ${D}${prefix}/share/locale
- rm -rf ${D}${prefix}/share/man
- rmdir ${D}${prefix}/share || :
- rmdir ${D}/${libdir}/gcc-lib || :
- rmdir ${D}/${libdir}64/gcc-lib || :
- rmdir ${D}/${libdir} || :
- rmdir ${D}/${libdir}64 || :
+ oe_multilib_header bfd.h
}
-pkg_postinst_${PN}-symlinks () {
- update-alternatives --install ${bindir}/ar ar ${TARGET_PREFIX}ar 100
- update-alternatives --install ${bindir}/strings strings ${TARGET_PREFIX}strings 100
-}
+inherit update-alternatives
-pkg_prerm_${PN}-symlinks () {
- update-alternatives --remove ar ${TARGET_PREFIX}ar
- update-alternatives --remove strings ${TARGET_PREFIX}strings
-}
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN}_class-target = "${USE_ALTERNATIVES_FOR}"