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.inc146
1 files changed, 146 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..7a352b5d3b
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -0,0 +1,146 @@
1DESCRIPTION = "A GNU collection of binary utilities"
2HOMEPAGE = "http://www.gnu.org/software/binutils/"
3BUGTRACKER = "http://sourceware.org/bugzilla/"
4SECTION = "devel"
5LICENSE = "GPLv2"
6
7DEPENDS = "flex-native bison-native"
8
9inherit autotools gettext
10
11PACKAGES += "${PN}-symlinks"
12
13FILES_${PN} = " \
14 ${bindir}/${TARGET_PREFIX}* \
15 ${libdir}/lib*-*.so \
16 ${prefix}/${TARGET_SYS}/bin/*"
17
18FILES_${PN}-dev = " \
19 ${includedir} \
20 ${libdir}/*.a \
21 ${libdir}/*.la \
22 ${libdir}/libbfd.so \
23 ${libdir}/libopcodes.so"
24
25FILES_${PN}-symlinks = " \
26 ${bindir}/addr2line \
27 ${bindir}/as \
28 ${bindir}/c++filt \
29 ${bindir}/gprof \
30 ${bindir}/ld \
31 ${bindir}/nm \
32 ${bindir}/objcopy \
33 ${bindir}/objdump \
34 ${bindir}/ranlib \
35 ${bindir}/readelf \
36 ${bindir}/size \
37 ${bindir}/strip"
38
39B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
40
41EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
42 --enable-install-libbfd \
43 --enable-shared"
44
45EXTRA_OECONF_virtclass-native = "--enable-target=all --enable-64-bit-bfd --enable-install-libbfd"
46
47# This is necessary due to a bug in the binutils Makefiles
48# EXTRA_OEMAKE = "configure-build-libiberty all"
49
50export AR = "${HOST_PREFIX}ar"
51export AS = "${HOST_PREFIX}as"
52export LD = "${HOST_PREFIX}ld"
53export NM = "${HOST_PREFIX}nm"
54export RANLIB = "${HOST_PREFIX}ranlib"
55export OBJCOPY = "${HOST_PREFIX}objcopy"
56export OBJDUMP = "${HOST_PREFIX}objdump"
57
58export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
59export AS_FOR_TARGET = "${TARGET_PREFIX}as"
60export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
61export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
62export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
63
64export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
65export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
66
67export CC_FOR_BUILD = "${BUILD_CC}"
68export CPP_FOR_BUILD = "${BUILD_CPP}"
69export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
70
71export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
72
73do_configure () {
74 (cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
75 oe_runconf
76#
77# must prime config.cache to ensure the build of libiberty
78#
79 mkdir -p ${B}/build-${BUILD_SYS}
80 for i in ${CONFIG_SITE}; do
81 cat $i >> ${B}/build-${BUILD_SYS}/config.cache
82 done
83}
84
85do_install () {
86 autotools_do_install
87
88 # We don't really need these, so we'll remove them...
89 rm -rf ${D}${libdir}/ldscripts
90
91 # Fix the /usr/${TARGET_SYS}/bin/* links
92 for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
93 rm -f $l
94 ln -sf `echo ${prefix}/${TARGET_SYS}/bin \
95 | tr -s / \
96 | sed -e 's,^/,,' -e 's,[^/]*,..,g'`${bindir}/${TARGET_PREFIX}`basename $l` $l
97 done
98
99 # Install the libiberty header
100 install -d ${D}${includedir}
101 install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
102 install -m 644 ${S}/include/libiberty.h ${D}${includedir}
103
104 cd ${D}${bindir}
105
106 # Symlinks for ease of running these on the native target
107 for p in ${TARGET_SYS}-* ; do
108 ln -sf $p `echo $p | sed -e s,${TARGET_SYS}-,,`
109 done
110
111 rm ${D}${bindir}/ar ${D}${bindir}/strings
112}
113
114do_install_virtclass-native () {
115 autotools_do_install
116
117 # Install the libiberty header
118 install -d ${D}${includedir}
119 install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
120 install -m 644 ${S}/include/libiberty.h ${D}${includedir}
121
122 # We only want libiberty, libbfd and libopcodes
123 rm -rf ${D}${bindir}
124 rm -rf ${D}${prefix}/${TARGET_SYS}
125 rm -rf ${D}${prefix}/lib/ldscripts
126 rm -rf ${D}${prefix}/share/info
127 rm -rf ${D}${prefix}/share/locale
128 rm -rf ${D}${prefix}/share/man
129 rmdir ${D}${prefix}/share || :
130 rmdir ${D}/${libdir}/gcc-lib || :
131 rmdir ${D}/${libdir}64/gcc-lib || :
132 rmdir ${D}/${libdir} || :
133 rmdir ${D}/${libdir}64 || :
134}
135
136pkg_postinst_${PN}-symlinks () {
137 update-alternatives --install ${bindir}/ar ar ${TARGET_SYS}-ar 100
138 update-alternatives --install ${bindir}/strings strings ${TARGET_SYS}-strings 100
139}
140
141
142pkg_prerm_${PN}-symlinks () {
143 update-alternatives --remove ar ${TARGET_SYS}-ar
144 update-alternatives --remove strings ${TARGET_SYS}-strings
145}
146