summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/libgcc-common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/libgcc-common.inc')
-rw-r--r--meta/recipes-devtools/gcc/libgcc-common.inc135
1 files changed, 135 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
new file mode 100644
index 0000000000..c4ab885cc3
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc-common.inc
@@ -0,0 +1,135 @@
1BPN = "libgcc"
2
3INHIBIT_DEFAULT_DEPS = "1"
4
5do_configure () {
6 target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
7 install -d ${D}${base_libdir} ${D}${libdir}
8 hardlinkdir ${STAGING_INCDIR_NATIVE}/${LIBGCCBUILDTREENAME}$target/ ${B}
9 mkdir -p ${B}/${BPN}
10 cd ${B}/${BPN}
11 chmod a+x ${S}/${BPN}/configure
12 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
13}
14
15do_compile () {
16 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
17 cd ${B}/${BPN}
18 oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
19}
20
21do_install () {
22 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
23 cd ${B}/${BPN}
24 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
25
26 # Move libgcc_s into /lib
27 mkdir -p ${D}${base_libdir}
28 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
29 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
30 else
31 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
32 fi
33
34 # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
35 # so that cross-gcc can find it in the sysroot
36
37 mv ${D}${libdir}/gcc/* ${D}${libdir}
38 rm -rf ${D}${libdir}/gcc/
39 # unwind.h is installed here which is shipped in gcc-cross
40 # as well as target gcc and they are identical so we dont
41 # ship one with libgcc here
42 rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
43}
44
45BBCLASSEXTEND = "nativesdk"
46
47addtask multilib_install after do_install before do_package do_populate_sysroot
48# this makes multilib gcc files findable for target gcc
49# e.g.
50# /usr/lib/i586-pokymllib32-linux/4.7/
51# by creating this symlink to it
52# /usr/lib64/x86_64-poky-linux/4.7/32
53
54python do_multilib_install() {
55 import re
56
57 multilibs = d.getVar('MULTILIB_VARIANTS', True)
58 if not multilibs or bb.data.inherits_class('nativesdk', d):
59 return
60
61 binv = d.getVar('BINV', True)
62
63 mlprefix = d.getVar('MLPREFIX', True)
64 if ('%slibgcc' % mlprefix) != d.getVar('PN', True):
65 return
66
67 if mlprefix:
68 orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True)
69 orig_tune_params = get_tune_parameters(orig_tune, d)
70 orig_tune_baselib = orig_tune_params['baselib']
71 orig_tune_bitness = orig_tune_baselib.replace('lib', '')
72 if not orig_tune_bitness:
73 orig_tune_bitness = '32'
74
75 src = '../../../' + orig_tune_baselib + '/' + \
76 d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/'
77
78 dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
79 d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness
80
81 if os.path.lexists(dest):
82 os.unlink(dest)
83 os.symlink(src, dest)
84 return
85
86
87 for ml in multilibs.split():
88 tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True)
89 if not tune:
90 bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml)
91 continue
92
93 tune_parameters = get_tune_parameters(tune, d)
94 tune_baselib = tune_parameters['baselib']
95 if not tune_baselib:
96 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
97 continue
98
99 tune_arch = tune_parameters['arch']
100 tune_bitness = tune_baselib.replace('lib', '')
101 if not tune_bitness:
102 tune_bitness = '32' # /lib => 32bit lib
103
104 src = '../../../' + tune_baselib + '/' + \
105 tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
106 '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
107
108 dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
109 d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
110
111 if os.path.lexists(dest):
112 os.unlink(dest)
113 os.symlink(src, dest)
114}
115
116addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
117python do_extra_symlinks() {
118 targetsysnoext = d.getVar('TARGET_SYS_NO_EXTENSION', True)
119
120 if targetsysnoext != d.getVar('TARGET_SYS', True):
121 dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + targetsysnoext
122 src = d.getVar('TARGET_SYS', True)
123 if not os.path.lexists(dest) and os.path.lexists(d.getVar('D', True) + d.getVar('libdir', True)):
124 os.symlink(src, dest)
125}
126
127python () {
128 targetsysnoext = d.getVar('TARGET_SYS', True)
129
130 for suffix in [d.getVar('ABIEXTENSION', True), d.getVar('LIBCEXTENSION', True)]:
131 if suffix and targetsysnoext.endswith(suffix):
132 targetsysnoext = targetsysnoext[:-len(suffix)]
133
134 d.setVar('TARGET_SYS_NO_EXTENSION', targetsysnoext)
135}