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.inc123
1 files changed, 123 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..75fd206d32
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,123 @@
1DESCRIPTION = "The 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 'mplt' in d.getVar('DISTRO_FEATURES',1).split() :
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 "sparc": "--enable-targets=all",
32 }
33
34 if 'multiarch' in d.getVar('DISTRO_FEATURES', True).split() :
35 if target_arch in multiarch_options :
36 return multiarch_options[target_arch]
37 return ""
38
39# this is used by the multilib setup of gcc
40def get_tune_parameters(tune, d):
41 availtunes = d.getVar('AVAILTUNES', True)
42 if tune not in availtunes.split():
43 bb.error('The tune: %s is not one of the available tunes: %s', tune or None, availtunes)
44
45 localdata = bb.data.createCopy(d)
46 override = ':tune-' + tune
47 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
48 bb.data.update_data(localdata)
49
50 retdict = {}
51 retdict['tune'] = tune
52 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True)
53 retdict['features'] = localdata.getVar('TUNE_FEATURES', True)
54 # BASELIB is used by the multilib code to change library paths
55 retdict['baselib'] = localdata.getVar('BASE_LIB', True) or localdata.getVar('BASELIB', True)
56 retdict['arch'] = localdata.getVar('TUNE_ARCH', True)
57 retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True)
58 retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True)
59 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True)
60 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True)
61 return retdict
62
63get_tune_parameters[vardepsexclude] = "AVAILTUNES"
64
65DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
66
67MIRRORS =+ "\
68${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \
69${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
70${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
71${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
72${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
73"
74
75#
76# Set some default values
77#
78gcclibdir = "${libdir}/gcc"
79BINV = "${PV}"
80#S = "${WORKDIR}/gcc-${PV}"
81S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
82B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
83
84# SS means Shared Stamps directory
85SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
86do_fetch[stamp-base] = "${SS}"
87do_unpack[stamp-base] = "${SS}"
88do_patch[stamp-base] = "${SS}"
89SSCLEAN = "${TMPDIR}/stamps/work-shared/gcc-[0-9]*-*"
90do_fetch[stamp-base-clean] = "${SSCLEAN}"
91do_unpack[stamp-base-clean] = "${SSCLEAN}"
92do_patch[stamp-base-clean] = "${SSCLEAN}"
93
94# SW means Shared Work directory
95SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
96WORKDIR_task-unpack = "${SW}"
97WORKDIR_task-patch = "${SW}"
98
99target_includedir ?= "${includedir}"
100target_libdir ?= "${libdir}"
101target_base_libdir ?= "${base_libdir}"
102target_prefix ?= "${prefix}"
103
104CLEANFUNCS += "workshared_clean"
105# The do_clean should be exclusive since share ${S}
106do_clean[lockfiles] = "${SW}.clean.lock"
107
108python workshared_clean () {
109 """clear the source directory"""
110 dir = d.expand("${SW}")
111 bb.note("Removing " + dir)
112 oe.path.remove(dir)
113
114 """clear the the stamps in work-shared"""
115 dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
116 bb.note("Removing " + dir)
117 oe.path.remove(dir)
118}
119
120# We need to ensure that for the shared work directory, the do_patch singatures match
121# The real WORKDIR location isn't a dependency for the shared workdir.
122src_patches[vardepsexclude] = "WORKDIR"
123should_apply[vardepsexclude] += "PN"