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