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/" |
| 3 | SECTION = "devel" |
| 4 | LICENSE = "GPL" |
| 5 | |
| 6 | NATIVEDEPS = "" |
| 7 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | CVE_PRODUCT = "gcc" |
| 9 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | inherit autotools gettext texinfo |
| 11 | |
| 12 | BPN = "gcc" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir" |
| 14 | COMPILERDEP_class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 15 | |
| 16 | python extract_stashed_builddir () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | dest = d.getVar("B") |
| 19 | oe.path.copyhardlinktree(src, dest) |
| 20 | staging_processfixme([src + "/fixmepath"], dest, dest, dest, d) |
| 21 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | |
| 23 | def get_gcc_float_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 24 | 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] | 25 | return "--with-float=hard" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | if d.getVar('TARGET_FPU') in [ 'soft' ]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | return "--with-float=soft" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | return "--enable-e500_double" |
| 30 | return "" |
| 31 | |
| 32 | get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" |
| 33 | |
| 34 | def get_gcc_mips_plt_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 35 | 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] | 36 | return "--with-mips-plt" |
| 37 | return "" |
| 38 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 39 | def get_gcc_ppc_plt_settings(bb, d): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 40 | 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] | 41 | return "--enable-secureplt" |
| 42 | return "" |
| 43 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | def get_long_double_setting(bb, d): |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 45 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and d.getVar('TCLIBC') in [ 'glibc' ]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | return "--with-long-double-128" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 47 | else: |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 48 | return "--without-long-double-128 libgcc_cv_powerpc_float128=no" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | return "" |
| 50 | |
| 51 | def get_gcc_multiarch_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 52 | target_arch = d.getVar('TRANSLATED_TARGET_ARCH') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | multiarch_options = { |
| 54 | "i586": "--enable-targets=all", |
| 55 | "i686": "--enable-targets=all", |
| 56 | "powerpc": "--enable-targets=powerpc64", |
| 57 | "mips": "--enable-targets=all", |
| 58 | "sparc": "--enable-targets=all", |
| 59 | } |
| 60 | |
| 61 | if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d): |
| 62 | if target_arch in multiarch_options : |
| 63 | return multiarch_options[target_arch] |
| 64 | return "" |
| 65 | |
| 66 | # this is used by the multilib setup of gcc |
| 67 | def get_tune_parameters(tune, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 68 | availtunes = d.getVar('AVAILTUNES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | if tune not in availtunes.split(): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 70 | 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] | 71 | |
| 72 | localdata = bb.data.createCopy(d) |
| 73 | override = ':tune-' + tune |
| 74 | localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | |
| 76 | retdict = {} |
| 77 | retdict['tune'] = tune |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 78 | retdict['ccargs'] = localdata.getVar('TUNE_CCARGS') |
| 79 | retdict['features'] = localdata.getVar('TUNE_FEATURES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 80 | # BASELIB is used by the multilib code to change library paths |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 81 | retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB') |
| 82 | retdict['arch'] = localdata.getVar('TUNE_ARCH') |
| 83 | retdict['abiextension'] = localdata.getVar('ABIEXTENSION') |
| 84 | retdict['target_fpu'] = localdata.getVar('TARGET_FPU') |
| 85 | retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH') |
| 86 | retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | return retdict |
| 88 | |
| 89 | get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS" |
| 90 | |
| 91 | DEBIANNAME_${MLPREFIX}libgcc = "libgcc1" |
| 92 | |
| 93 | MIRRORS =+ "\ |
| 94 | ${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \ |
| 95 | ${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \ |
| 96 | ${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \ |
| 97 | ${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \ |
| 98 | ${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \ |
| 99 | " |
| 100 | # |
| 101 | # Set some default values |
| 102 | # |
| 103 | gcclibdir = "${libdir}/gcc" |
| 104 | BINV = "${PV}" |
| 105 | #S = "${WORKDIR}/gcc-${PV}" |
| 106 | S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 107 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 108 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" |
| 109 | |
| 110 | target_includedir ?= "${includedir}" |
| 111 | target_libdir ?= "${libdir}" |
| 112 | target_base_libdir ?= "${base_libdir}" |
| 113 | target_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. |
| 117 | src_patches[vardepsexclude] = "WORKDIR" |
| 118 | should_apply[vardepsexclude] += "PN" |