1SUMMARY = "GNU binary utilities" 2DESCRIPTION = "The GNU Binutils are a collection of binary tools. \ 3The main ones are ld (GNU Linker), and as (GNU Assembler). This \ 4package also includes addition tools such as addr2line (Converts \ 5addresses into filenames and line numbers), ar (utility for creating, \ 6modifying and extracting archives), nm (list symbols in object \ 7files), objcopy (copy and translate object files), objdump (Display \ 8object information), and other tools and related libraries." 9HOMEPAGE = "http://www.gnu.org/software/binutils/" 10BUGTRACKER = "http://sourceware.org/bugzilla/" 11SECTION = "devel" 12LICENSE = "GPLv3" 13 14DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native" 15 16# 17# we need chrpath > 0.14 and some distros like centos 7 still have older chrpath 18# 19DEPENDS_append_class-target = " chrpath-replacement-native" 20EXTRANATIVEPATH_append_class-target = " chrpath-native" 21 22inherit autotools gettext multilib_header texinfo 23 24FILES_${PN} = " \ 25 ${bindir}/${TARGET_PREFIX}* \ 26 ${libdir}/lib*-*.so \ 27 ${prefix}/${TARGET_SYS}/bin/* \ 28 ${bindir}/embedspu" 29 30RPROVIDES_${PN} += "${PN}-symlinks" 31 32FILES_${PN}-dev = " \ 33 ${includedir} \ 34 ${libdir}/*.la \ 35 ${libdir}/libbfd.so \ 36 ${libdir}/libopcodes.so" 37 38# Rather than duplicating multiple entries for these, make one 39# list and reuse it. 40 41LDGOLD_ALTS ?= "ld.gold dwp" 42LDGOLD_ALTS_riscv64 = "" 43 44USE_ALTERNATIVES_FOR = " \ 45 addr2line \ 46 ar \ 47 as \ 48 c++filt \ 49 elfedit \ 50 gprof \ 51 ld \ 52 ld.bfd \ 53 ${LDGOLD_ALTS} \ 54 nm \ 55 objcopy \ 56 objdump \ 57 ranlib \ 58 readelf \ 59 size \ 60 strings \ 61 strip \ 62" 63 64python do_package_prepend() { 65 make_alts = d.getVar("USE_ALTERNATIVES_FOR") or "" 66 prefix = d.getVar("TARGET_PREFIX") 67 bindir = d.getVar("bindir") 68 for alt in make_alts.split(): 69 d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt) 70 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt) 71} 72 73B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" 74 75EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \ 76 --disable-werror \ 77 --enable-deterministic-archives \ 78 --enable-plugins \ 79 ${LDGOLD} \ 80 ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}" 81 82LDGOLD_class-native = "" 83LDGOLD_class-crosssdk = "" 84LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}" 85 86# This is necessary due to a bug in the binutils Makefiles 87# EXTRA_OEMAKE = "configure-build-libiberty all" 88 89export AR = "${HOST_PREFIX}ar" 90export AS = "${HOST_PREFIX}as" 91export LD = "${HOST_PREFIX}ld" 92export NM = "${HOST_PREFIX}nm" 93export RANLIB = "${HOST_PREFIX}ranlib" 94export OBJCOPY = "${HOST_PREFIX}objcopy" 95export OBJDUMP = "${HOST_PREFIX}objdump" 96 97export AR_FOR_TARGET = "${TARGET_PREFIX}ar" 98export AS_FOR_TARGET = "${TARGET_PREFIX}as" 99export LD_FOR_TARGET = "${TARGET_PREFIX}ld" 100export NM_FOR_TARGET = "${TARGET_PREFIX}nm" 101export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" 102 103export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" 104export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" 105 106# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need 107# to unset LD_LIBRARY_PATH. 108export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}" 109 110MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}" 111do_configure[vardeps] += "MULTIARCH" 112do_configure () { 113 (cd ${S}; gnu-configize) || die "Failed to run gnu-configize" 114 oe_runconf 115# 116# must prime config.cache to ensure the build of libiberty 117# 118 mkdir -p ${B}/build-${BUILD_SYS} 119 for i in ${CONFIG_SITE}; do 120 cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true 121 done 122} 123 124do_compile_append_class-target() { 125 chrpath -d ${B}/binutils/elfedit 126 chrpath -d ${B}/binutils/readelf 127} 128do_install () { 129 autotools_do_install 130 131 # We don't really need these, so we'll remove them... 132 rm -rf ${D}${libdir}/ldscripts 133 134 bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')} 135 136 # Fix the /usr/${TARGET_SYS}/bin/* links 137 for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do 138 rm -f $l 139 ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l 140 done 141 142 # Install the libiberty header 143 install -d ${D}${includedir} 144 install -m 644 ${S}/include/ansidecl.h ${D}${includedir} 145 install -m 644 ${S}/include/libiberty.h ${D}${includedir} 146 147 cd ${D}${bindir} 148 149 # Symlinks for ease of running these on the native target 150 for p in ${TARGET_PREFIX}* ; do 151 ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,` 152 done 153 154 for alt in ${USE_ALTERNATIVES_FOR}; do 155 rm -f ${D}${bindir}/$alt 156 done 157 158 oe_multilib_header bfd.h 159} 160 161inherit update-alternatives 162 163ALTERNATIVE_PRIORITY = "100" 164 165ALTERNATIVE_${PN}_class-target = "${USE_ALTERNATIVES_FOR}" 166