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