summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-common.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-common.inc126
1 files changed, 126 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
new file mode 100644
index 0000000000..d5155fea02
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,126 @@
1SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5
6NATIVEDEPS = ""
7
8inherit autotools gettext ptest
9
10def get_gcc_fpu_setting(bb, d):
11 if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
12 return "--with-float=hard"
13 if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
14 return "--with-float=soft"
15 if d.getVar('TARGET_FPU', True) in [ 'ppc-efd' ]:
16 return "--enable-e500_double"
17 return ""
18
19get_gcc_fpu_setting[vardepvalue] = "${@get_gcc_fpu_setting(bb, d)}"
20
21def get_gcc_mips_plt_setting(bb, d):
22 if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and oe.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
23 return "--with-mips-plt"
24 return ""
25
26def get_gcc_multiarch_setting(bb, d):
27 target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
28 multiarch_options = {
29 "i586": "--enable-targets=all",
30 "powerpc": "--enable-targets=powerpc64",
31 "mips": "--enable-targets=all",
32 "sparc": "--enable-targets=all",
33 }
34
35 if oe.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
36 if target_arch in multiarch_options :
37 return multiarch_options[target_arch]
38 return ""
39
40# this is used by the multilib setup of gcc
41def get_tune_parameters(tune, d):
42 availtunes = d.getVar('AVAILTUNES', True)
43 if tune not in availtunes.split():
44 bb.error('The tune: %s is not one of the available tunes: %s', tune or None, availtunes)
45
46 localdata = bb.data.createCopy(d)
47 override = ':tune-' + tune
48 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
49 bb.data.update_data(localdata)
50
51 retdict = {}
52 retdict['tune'] = tune
53 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True)
54 retdict['features'] = localdata.getVar('TUNE_FEATURES', True)
55 # BASELIB is used by the multilib code to change library paths
56 retdict['baselib'] = localdata.getVar('BASE_LIB', True) or localdata.getVar('BASELIB', True)
57 retdict['arch'] = localdata.getVar('TUNE_ARCH', True)
58 retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True)
59 retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True)
60 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True)
61 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True)
62 return retdict
63
64get_tune_parameters[vardepsexclude] = "AVAILTUNES"
65
66DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
67
68MIRRORS =+ "\
69${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \
70${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
71${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
72${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
73${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
74"
75
76#
77# Set some default values
78#
79gcclibdir = "${libdir}/gcc"
80BINV = "${PV}"
81#S = "${WORKDIR}/gcc-${PV}"
82S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
83B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
84
85# SS means Shared Stamps directory
86SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
87do_fetch[stamp-base] = "${SS}"
88do_unpack[stamp-base] = "${SS}"
89do_patch[stamp-base] = "${SS}"
90SSCLEAN = "${TMPDIR}/stamps/work-shared/gcc-[0-9]*-*"
91do_fetch[stamp-base-clean] = "${SSCLEAN}"
92do_unpack[stamp-base-clean] = "${SSCLEAN}"
93do_unpack[umask] = "022"
94do_patch[stamp-base-clean] = "${SSCLEAN}"
95
96# SW means Shared Work directory
97SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
98SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:"
99WORKDIR_task-unpack = "${SW}"
100WORKDIR_task-patch = "${SW}"
101
102target_includedir ?= "${includedir}"
103target_libdir ?= "${libdir}"
104target_base_libdir ?= "${base_libdir}"
105target_prefix ?= "${prefix}"
106
107CLEANFUNCS += "workshared_clean"
108# The do_clean should be exclusive since share ${S}
109do_clean[lockfiles] = "${SW}.clean.lock"
110
111python workshared_clean () {
112 """clear the source directory"""
113 dir = d.expand("${SW}")
114 bb.note("Removing " + dir)
115 oe.path.remove(dir)
116
117 """clear the the stamps in work-shared"""
118 dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
119 bb.note("Removing " + dir)
120 oe.path.remove(dir)
121}
122
123# We need to ensure that for the shared work directory, the do_patch singatures match
124# The real WORKDIR location isn't a dependency for the shared workdir.
125src_patches[vardepsexclude] = "WORKDIR"
126should_apply[vardepsexclude] += "PN"