summaryrefslogtreecommitdiffstats
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.inc153
1 files changed, 153 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
new file mode 100644
index 0000000..7f084b5
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -0,0 +1,153 @@
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
16inherit autotools gettext multilib_header
17
18FILES_${PN} = " \
19 ${bindir}/${TARGET_PREFIX}* \
20 ${libdir}/lib*-*.so \
21 ${prefix}/${TARGET_SYS}/bin/* \
22 ${bindir}/embedspu"
23
24RPROVIDES_${PN} += "${PN}-symlinks"
25
26FILES_${PN}-dev = " \
27 ${includedir} \
28 ${libdir}/*.la \
29 ${libdir}/libbfd.so \
30 ${libdir}/libopcodes.so"
31
32# Rather than duplicating multiple entries for these, make one
33# list and reuse it.
34
35USE_ALTERNATIVES_FOR = " \
36 addr2line \
37 ar \
38 as \
39 c++filt \
40 elfedit \
41 gprof \
42 ld \
43 ld.bfd \
44 ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld.gold dwp', '', d)} \
45 nm \
46 objcopy \
47 objdump \
48 ranlib \
49 readelf \
50 size \
51 strings \
52 strip \
53"
54
55python do_package_prepend() {
56 make_alts = d.getVar("USE_ALTERNATIVES_FOR", True) or ""
57 prefix = d.getVar("TARGET_PREFIX", True)
58 bindir = d.getVar("bindir", True)
59 for alt in make_alts.split():
60 d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt)
61 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt)
62}
63
64# FILES_${PN}-dbg = "${prefix}/${TARGET_SYS}/bin/.debug ${prefix}/${libdir}/.debug"
65
66B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
67
68EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
69 --disable-werror \
70 --enable-plugins \
71 ${LDGOLD} \
72 ${@base_contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
73
74LDGOLD_class-native = ""
75LDGOLD_class-crosssdk = ""
76LDGOLD ?= "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '', d)}"
77
78# This is necessary due to a bug in the binutils Makefiles
79# EXTRA_OEMAKE = "configure-build-libiberty all"
80
81export AR = "${HOST_PREFIX}ar"
82export AS = "${HOST_PREFIX}as"
83export LD = "${HOST_PREFIX}ld"
84export NM = "${HOST_PREFIX}nm"
85export RANLIB = "${HOST_PREFIX}ranlib"
86export OBJCOPY = "${HOST_PREFIX}objcopy"
87export OBJDUMP = "${HOST_PREFIX}objdump"
88
89export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
90export AS_FOR_TARGET = "${TARGET_PREFIX}as"
91export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
92export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
93export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
94
95export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
96export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
97
98# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need
99# to unset LD_LIBRARY_PATH.
100export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
101
102MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
103do_configure[vardeps] += "MULTIARCH"
104do_configure () {
105 (cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
106 oe_runconf
107#
108# must prime config.cache to ensure the build of libiberty
109#
110 mkdir -p ${B}/build-${BUILD_SYS}
111 for i in ${CONFIG_SITE}; do
112 cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true
113 done
114}
115
116do_install () {
117 autotools_do_install
118
119 # We don't really need these, so we'll remove them...
120 rm -rf ${D}${libdir}/ldscripts
121
122 # Fix the /usr/${TARGET_SYS}/bin/* links
123 for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
124 rm -f $l
125 ln -sf `echo ${prefix}/${TARGET_SYS}/bin \
126 | tr -s / \
127 | sed -e 's,^/,,' -e 's,[^/]*,..,g'`${bindir}/${TARGET_PREFIX}`basename $l` $l
128 done
129
130 # Install the libiberty header
131 install -d ${D}${includedir}
132 install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
133 install -m 644 ${S}/include/libiberty.h ${D}${includedir}
134
135 cd ${D}${bindir}
136
137 # Symlinks for ease of running these on the native target
138 for p in ${TARGET_PREFIX}* ; do
139 ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
140 done
141
142 for alt in ${USE_ALTERNATIVES_FOR}; do
143 rm -f ${D}${bindir}/$alt
144 done
145
146 oe_multilib_header bfd.h
147}
148
149inherit update-alternatives
150
151ALTERNATIVE_PRIORITY = "100"
152
153ALTERNATIVE_${PN}_class-target = "${USE_ALTERNATIVES_FOR}"