blob: aa3b53e64cd5f7c0b129b4aae7279e8547d67c11 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5
6NATIVEDEPS = ""
7
Brad Bishop6e60e8b2018-02-01 10:27:11 -05008CVE_PRODUCT = "gcc"
9
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010inherit autotools gettext texinfo
11
12BPN = "gcc"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013COMPILERINITIAL = ""
14COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc${COMPILERINITIAL}:do_gcc_stash_builddir"
15COMPILERDEP_class-nativesdk = "virtual/${TARGET_PREFIX}gcc${COMPILERINITIAL}-crosssdk:do_gcc_stash_builddir"
16
17python extract_stashed_builddir () {
18 src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir${COMPILERINITIAL}-${TARGET_SYS}")
19 dest = d.getVar("B")
20 oe.path.copyhardlinktree(src, dest)
21 staging_processfixme([src + "/fixmepath"], dest, dest, dest, d)
22}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023
24def get_gcc_float_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 return "--with-float=hard"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 if d.getVar('TARGET_FPU') in [ 'soft' ]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 return "--with-float=soft"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 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):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037 return "--with-mips-plt"
38 return ""
39
Patrick Williamsf1e5d692016-03-30 15:21:19 -050040def get_gcc_ppc_plt_settings(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
Patrick Williamsf1e5d692016-03-30 15:21:19 -050042 return "--enable-secureplt"
43 return ""
44
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045def get_long_double_setting(bb, d):
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and d.getVar('TCLIBC') in [ 'glibc' ]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 return "--with-long-double-128"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048 else:
49 return "--without-long-double-128"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050 return ""
51
52def get_gcc_multiarch_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 multiarch_options = {
55 "i586": "--enable-targets=all",
56 "i686": "--enable-targets=all",
57 "powerpc": "--enable-targets=powerpc64",
58 "mips": "--enable-targets=all",
59 "sparc": "--enable-targets=all",
60 }
61
62 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
63 if target_arch in multiarch_options :
64 return multiarch_options[target_arch]
65 return ""
66
67# this is used by the multilib setup of gcc
68def get_tune_parameters(tune, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050069 availtunes = d.getVar('AVAILTUNES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 if tune not in availtunes.split():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050071 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072
73 localdata = bb.data.createCopy(d)
74 override = ':tune-' + tune
75 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076
77 retdict = {}
78 retdict['tune'] = tune
Brad Bishop6e60e8b2018-02-01 10:27:11 -050079 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
80 retdict['features'] = localdata.getVar('TUNE_FEATURES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 # BASELIB is used by the multilib code to change library paths
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
83 retdict['arch'] = localdata.getVar('TUNE_ARCH')
84 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
85 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
86 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
87 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088 return retdict
89
90get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
91
92DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
93
94MIRRORS =+ "\
95${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \
96${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
97${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
98${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
99${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
100"
101#
102# Set some default values
103#
104gcclibdir = "${libdir}/gcc"
105BINV = "${PV}"
106#S = "${WORKDIR}/gcc-${PV}"
107S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500108
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
110
111target_includedir ?= "${includedir}"
112target_libdir ?= "${libdir}"
113target_base_libdir ?= "${base_libdir}"
114target_prefix ?= "${prefix}"
115
116# We need to ensure that for the shared work directory, the do_patch signatures match
117# The real WORKDIR location isn't a dependency for the shared workdir.
118src_patches[vardepsexclude] = "WORKDIR"
119should_apply[vardepsexclude] += "PN"