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