blob: 5ac82b1b577175f4f24382080193398a359d748c [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"
Andrew Geissler028142b2023-05-05 11:29:21 -050014COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015
16python extract_stashed_builddir () {
Brad Bishop19323692019-04-05 15:28:33 -040017 src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 dest = d.getVar("B")
19 oe.path.copyhardlinktree(src, dest)
Brad Bishop79641f22019-09-10 07:20:22 -040020 staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022
23def get_gcc_float_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050024 if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025 return "--with-float=hard"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026 if d.getVar('TARGET_FPU') in [ 'soft' ]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 return "--with-float=soft"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 return "--enable-e500_double"
30 return ""
31
32get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
33
Andrew Geissler87f5cff2022-09-30 13:13:31 -050034def get_gcc_x86_64_arch_setting(bb, d):
35 import re
36 march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
37 if march:
38 return "--with-arch=%s " % march.group(1)
39 # The earliest supported x86-64 CPU
40 return "--with-arch=core2"
41
42get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
43
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044def get_gcc_mips_plt_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050045 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 -050046 return "--with-mips-plt"
47 return ""
48
Patrick Williamsf1e5d692016-03-30 15:21:19 -050049def get_gcc_ppc_plt_settings(bb, d):
Brad Bishop19323692019-04-05 15:28:33 -040050 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 -050051 return "--enable-secureplt"
52 return ""
53
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054def get_gcc_multiarch_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056 multiarch_options = {
57 "i586": "--enable-targets=all",
58 "i686": "--enable-targets=all",
59 "powerpc": "--enable-targets=powerpc64",
Andrew Geissler82c905d2020-04-13 13:39:40 -050060 "powerpc64le": "--enable-targets=powerpcle",
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 "mips": "--enable-targets=all",
62 "sparc": "--enable-targets=all",
63 }
64
65 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
66 if target_arch in multiarch_options :
67 return multiarch_options[target_arch]
68 return ""
69
70# this is used by the multilib setup of gcc
71def get_tune_parameters(tune, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072 availtunes = d.getVar('AVAILTUNES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073 if tune not in availtunes.split():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050074 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075
76 localdata = bb.data.createCopy(d)
77 override = ':tune-' + tune
78 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
80 retdict = {}
81 retdict['tune'] = tune
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
83 retdict['features'] = localdata.getVar('TUNE_FEATURES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084 # BASELIB is used by the multilib code to change library paths
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
86 retdict['arch'] = localdata.getVar('TUNE_ARCH')
87 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
88 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
89 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
90 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 return retdict
92
93get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
94
Patrick Williams213cb262021-08-07 19:21:33 -050095DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096
97MIRRORS =+ "\
Andrew Geissler595f6302022-01-24 19:11:47 +000098 ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099"
100#
101# Set some default values
102#
103gcclibdir = "${libdir}/gcc"
104BINV = "${PV}"
105#S = "${WORKDIR}/gcc-${PV}"
106S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500107
Andrew Geissler615f2f12022-07-15 14:00:58 -0500108B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109
110target_includedir ?= "${includedir}"
111target_libdir ?= "${libdir}"
112target_base_libdir ?= "${base_libdir}"
113target_prefix ?= "${prefix}"
114
115# We need to ensure that for the shared work directory, the do_patch signatures match
116# The real WORKDIR location isn't a dependency for the shared workdir.
117src_patches[vardepsexclude] = "WORKDIR"
118should_apply[vardepsexclude] += "PN"