1SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3DESCRIPTION = "The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system."
4SECTION = "devel"
5LICENSE = "GPL"
6
7NATIVEDEPS = ""
8
9CVE_PRODUCT = "gcc"
10
11inherit autotools gettext texinfo
12
13BPN = "gcc"
14COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
15COMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir"
16
17python extract_stashed_builddir () {
18    src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
19    dest = d.getVar("B")
20    oe.path.copyhardlinktree(src, dest)
21    staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
22}
23
24def get_gcc_float_setting(bb, d):
25    if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
26        return "--with-float=hard"
27    if d.getVar('TARGET_FPU') in [ 'soft' ]:
28        return "--with-float=soft"
29    if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
30        return "--enable-e500_double"
31    return ""
32
33get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
34
35def get_gcc_mips_plt_setting(bb, d):
36    if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
37        return "--with-mips-plt"
38    return ""
39
40def get_gcc_ppc_plt_settings(bb, d):
41    if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
42        return "--enable-secureplt"
43    return ""
44
45def get_gcc_multiarch_setting(bb, d):
46    target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
47    multiarch_options = {
48        "i586":    "--enable-targets=all",
49        "i686":    "--enable-targets=all",
50        "powerpc": "--enable-targets=powerpc64",
51        "powerpc64le": "--enable-targets=powerpcle",
52        "mips":    "--enable-targets=all",
53        "sparc":   "--enable-targets=all",
54    }
55
56    if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
57        if target_arch in multiarch_options :
58            return multiarch_options[target_arch]
59    return ""
60
61# this is used by the multilib setup of gcc
62def get_tune_parameters(tune, d):
63    availtunes = d.getVar('AVAILTUNES')
64    if tune not in availtunes.split():
65        bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
66
67    localdata = bb.data.createCopy(d)
68    override = ':tune-' + tune
69    localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
70
71    retdict = {}
72    retdict['tune'] = tune
73    retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
74    retdict['features'] = localdata.getVar('TUNE_FEATURES')
75    # BASELIB is used by the multilib code to change library paths
76    retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
77    retdict['arch'] = localdata.getVar('TUNE_ARCH')
78    retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
79    retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
80    retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
81    retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
82    return retdict
83
84get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
85
86DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
87
88MIRRORS =+ "\
89    ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
90"
91#
92# Set some default values
93#
94gcclibdir = "${libdir}/gcc"
95BINV = "${PV}"
96#S = "${WORKDIR}/gcc-${PV}"
97S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
98
99B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
100
101target_includedir ?= "${includedir}"
102target_libdir ?= "${libdir}"
103target_base_libdir ?= "${base_libdir}"
104target_prefix ?= "${prefix}"
105
106# We need to ensure that for the shared work directory, the do_patch signatures match
107# The real WORKDIR location isn't a dependency for the shared workdir.
108src_patches[vardepsexclude] = "WORKDIR"
109should_apply[vardepsexclude] += "PN"
110