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 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 41 | LDGOLD_ALTS ?= "ld.gold dwp" |
| 42 | LDGOLD_ALTS_riscv64 = "" |
| 43 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | USE_ALTERNATIVES_FOR = " \ |
| 45 | addr2line \ |
| 46 | ar \ |
| 47 | as \ |
| 48 | c++filt \ |
| 49 | elfedit \ |
| 50 | gprof \ |
| 51 | ld \ |
| 52 | ld.bfd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | ${LDGOLD_ALTS} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | nm \ |
| 55 | objcopy \ |
| 56 | objdump \ |
| 57 | ranlib \ |
| 58 | readelf \ |
| 59 | size \ |
| 60 | strings \ |
| 61 | strip \ |
| 62 | " |
| 63 | |
| 64 | python do_package_prepend() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 65 | make_alts = d.getVar("USE_ALTERNATIVES_FOR") or "" |
| 66 | prefix = d.getVar("TARGET_PREFIX") |
| 67 | bindir = d.getVar("bindir") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 73 | B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" |
| 74 | |
| 75 | EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \ |
| 76 | --disable-werror \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 77 | --enable-deterministic-archives \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 78 | --enable-plugins \ |
| 79 | ${LDGOLD} \ |
| 80 | ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}" |
| 81 | |
| 82 | LDGOLD_class-native = "" |
| 83 | LDGOLD_class-crosssdk = "" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 84 | 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] | 85 | |
| 86 | # This is necessary due to a bug in the binutils Makefiles |
| 87 | # EXTRA_OEMAKE = "configure-build-libiberty all" |
| 88 | |
| 89 | export AR = "${HOST_PREFIX}ar" |
| 90 | export AS = "${HOST_PREFIX}as" |
| 91 | export LD = "${HOST_PREFIX}ld" |
| 92 | export NM = "${HOST_PREFIX}nm" |
| 93 | export RANLIB = "${HOST_PREFIX}ranlib" |
| 94 | export OBJCOPY = "${HOST_PREFIX}objcopy" |
| 95 | export OBJDUMP = "${HOST_PREFIX}objdump" |
| 96 | |
| 97 | export AR_FOR_TARGET = "${TARGET_PREFIX}ar" |
| 98 | export AS_FOR_TARGET = "${TARGET_PREFIX}as" |
| 99 | export LD_FOR_TARGET = "${TARGET_PREFIX}ld" |
| 100 | export NM_FOR_TARGET = "${TARGET_PREFIX}nm" |
| 101 | export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" |
| 102 | |
| 103 | export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" |
| 104 | export 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. |
| 108 | export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}" |
| 109 | |
| 110 | MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}" |
| 111 | do_configure[vardeps] += "MULTIARCH" |
| 112 | do_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 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 124 | do_compile_append_class-target() { |
| 125 | chrpath -d ${B}/binutils/elfedit |
| 126 | chrpath -d ${B}/binutils/readelf |
| 127 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | do_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 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 134 | bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')} |
| 135 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 136 | # Fix the /usr/${TARGET_SYS}/bin/* links |
| 137 | for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do |
| 138 | rm -f $l |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 139 | ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
| 161 | inherit update-alternatives |
| 162 | |
| 163 | ALTERNATIVE_PRIORITY = "100" |
| 164 | |
| 165 | ALTERNATIVE_${PN}_class-target = "${USE_ALTERNATIVES_FOR}" |