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 | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | COMPILERINITIAL = "" |
| 14 | COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc${COMPILERINITIAL}:do_gcc_stash_builddir" |
| 15 | COMPILERDEP_class-nativesdk = "virtual/${TARGET_PREFIX}gcc${COMPILERINITIAL}-crosssdk:do_gcc_stash_builddir" |
| 16 | |
| 17 | python 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 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 | |
| 35 | def get_gcc_mips_plt_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 36 | 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] | 37 | return "--with-mips-plt" |
| 38 | return "" |
| 39 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 40 | def get_gcc_ppc_plt_settings(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 41 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 42 | return "--enable-secureplt" |
| 43 | return "" |
| 44 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | def get_long_double_setting(bb, d): |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 46 | 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] | 47 | return "--with-long-double-128" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | else: |
| 49 | return "--without-long-double-128" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | return "" |
| 51 | |
| 52 | def get_gcc_multiarch_setting(bb, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 53 | target_arch = d.getVar('TRANSLATED_TARGET_ARCH') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | 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 |
| 68 | def get_tune_parameters(tune, d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 69 | availtunes = d.getVar('AVAILTUNES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 70 | if tune not in availtunes.split(): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 71 | 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] | 72 | |
| 73 | localdata = bb.data.createCopy(d) |
| 74 | override = ':tune-' + tune |
| 75 | localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | |
| 77 | retdict = {} |
| 78 | retdict['tune'] = tune |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 79 | retdict['ccargs'] = localdata.getVar('TUNE_CCARGS') |
| 80 | retdict['features'] = localdata.getVar('TUNE_FEATURES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 81 | # BASELIB is used by the multilib code to change library paths |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 82 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | return retdict |
| 89 | |
| 90 | get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS" |
| 91 | |
| 92 | DEBIANNAME_${MLPREFIX}libgcc = "libgcc1" |
| 93 | |
| 94 | MIRRORS =+ "\ |
| 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 | # |
| 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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 109 | B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" |
| 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" |