Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "GNU cc and gcc C compilers" |
| 2 | HOMEPAGE = "http://www.gnu.org/software/gcc/" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | DESCRIPTION = "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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | SECTION = "devel" |
| 5 | LICENSE = "GPL" |
| 6 | |
| 7 | NATIVEDEPS = "" |
| 8 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | CVE_PRODUCT = "gcc" |
| 10 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | inherit autotools gettext texinfo |
| 12 | |
| 13 | BPN = "gcc" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 15 | COMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | |
| 17 | python extract_stashed_builddir () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 18 | src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | dest = d.getVar("B") |
| 20 | oe.path.copyhardlinktree(src, dest) |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 21 | staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | |
| 24 | def get_gcc_float_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm": |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | return "--with-float=hard" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 27 | if d.getVar('TARGET_FPU') in [ 'soft' ]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | return "--with-float=soft" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 29 | if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | return "--enable-e500_double" |
| 31 | return "" |
| 32 | |
| 33 | get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" |
| 34 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 35 | def 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 | |
| 43 | get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}" |
| 44 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | def get_gcc_mips_plt_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | return "--with-mips-plt" |
| 48 | return "" |
| 49 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 50 | def get_gcc_ppc_plt_settings(bb, d): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 51 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 52 | return "--enable-secureplt" |
| 53 | return "" |
| 54 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | def get_gcc_multiarch_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 56 | target_arch = d.getVar('TRANSLATED_TARGET_ARCH') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | multiarch_options = { |
| 58 | "i586": "--enable-targets=all", |
| 59 | "i686": "--enable-targets=all", |
| 60 | "powerpc": "--enable-targets=powerpc64", |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | "powerpc64le": "--enable-targets=powerpcle", |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | "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 |
| 72 | def get_tune_parameters(tune, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 73 | availtunes = d.getVar('AVAILTUNES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | if tune not in availtunes.split(): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 75 | bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | |
| 77 | localdata = bb.data.createCopy(d) |
| 78 | override = ':tune-' + tune |
| 79 | localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 80 | |
| 81 | retdict = {} |
| 82 | retdict['tune'] = tune |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 83 | retdict['ccargs'] = localdata.getVar('TUNE_CCARGS') |
| 84 | retdict['features'] = localdata.getVar('TUNE_FEATURES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 85 | # BASELIB is used by the multilib code to change library paths |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 86 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | return retdict |
| 93 | |
| 94 | get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS" |
| 95 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 96 | DEBIANNAME:${MLPREFIX}libgcc = "libgcc1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | |
| 98 | MIRRORS =+ "\ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 99 | ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 100 | " |
| 101 | # |
| 102 | # Set some default values |
| 103 | # |
| 104 | gcclibdir = "${libdir}/gcc" |
| 105 | BINV = "${PV}" |
| 106 | #S = "${WORKDIR}/gcc-${PV}" |
| 107 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 108 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 109 | B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
| 111 | target_includedir ?= "${includedir}" |
| 112 | target_libdir ?= "${libdir}" |
| 113 | target_base_libdir ?= "${base_libdir}" |
| 114 | target_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. |
| 118 | src_patches[vardepsexclude] = "WORKDIR" |
| 119 | should_apply[vardepsexclude] += "PN" |