blob: d3b36937bf49ee9ab539422e5c71c7e4321ab361 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06003DESCRIPTION = "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."
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004SECTION = "devel"
5LICENSE = "GPL"
6
7NATIVEDEPS = ""
8
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009CVE_PRODUCT = "gcc"
10
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011inherit autotools gettext texinfo
12
13BPN = "gcc"
Brad Bishop19323692019-04-05 15:28:33 -040014COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
Patrick Williams213cb262021-08-07 19:21:33 -050015COMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050016
17python extract_stashed_builddir () {
Brad Bishop19323692019-04-05 15:28:33 -040018 src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019 dest = d.getVar("B")
20 oe.path.copyhardlinktree(src, dest)
Brad Bishop79641f22019-09-10 07:20:22 -040021 staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022}
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
Andrew Geissler87f5cff2022-09-30 13:13:31 -050035def get_gcc_x86_64_arch_setting(bb, d):
36 import re
37 march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
38 if march:
39 return "--with-arch=%s " % march.group(1)
40 # The earliest supported x86-64 CPU
41 return "--with-arch=core2"
42
43get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
44
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045def get_gcc_mips_plt_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 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 -050047 return "--with-mips-plt"
48 return ""
49
Patrick Williamsf1e5d692016-03-30 15:21:19 -050050def get_gcc_ppc_plt_settings(bb, d):
Brad Bishop19323692019-04-05 15:28:33 -040051 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
Patrick Williamsf1e5d692016-03-30 15:21:19 -050052 return "--enable-secureplt"
53 return ""
54
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055def get_gcc_multiarch_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057 multiarch_options = {
58 "i586": "--enable-targets=all",
59 "i686": "--enable-targets=all",
60 "powerpc": "--enable-targets=powerpc64",
Andrew Geissler82c905d2020-04-13 13:39:40 -050061 "powerpc64le": "--enable-targets=powerpcle",
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062 "mips": "--enable-targets=all",
63 "sparc": "--enable-targets=all",
64 }
65
66 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
67 if target_arch in multiarch_options :
68 return multiarch_options[target_arch]
69 return ""
70
71# this is used by the multilib setup of gcc
72def get_tune_parameters(tune, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 availtunes = d.getVar('AVAILTUNES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050074 if tune not in availtunes.split():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050075 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076
77 localdata = bb.data.createCopy(d)
78 override = ':tune-' + tune
79 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080
81 retdict = {}
82 retdict['tune'] = tune
Brad Bishop6e60e8b2018-02-01 10:27:11 -050083 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
84 retdict['features'] = localdata.getVar('TUNE_FEATURES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 # BASELIB is used by the multilib code to change library paths
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
87 retdict['arch'] = localdata.getVar('TUNE_ARCH')
88 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
89 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
90 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
91 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 return retdict
93
94get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
95
Patrick Williams213cb262021-08-07 19:21:33 -050096DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097
98MIRRORS =+ "\
Andrew Geissler595f6302022-01-24 19:11:47 +000099 ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100"
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
Andrew Geissler615f2f12022-07-15 14:00:58 -0500109B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110
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"