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