blob: 3dcfdf835fb50698a3714b2fed519bfdc2261d4b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5
6NATIVEDEPS = ""
7
Brad Bishop6e60e8b2018-02-01 10:27:11 -05008CVE_PRODUCT = "gcc"
9
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010inherit autotools gettext texinfo
11
12BPN = "gcc"
Brad Bishop19323692019-04-05 15:28:33 -040013COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
14COMPILERDEP_class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk: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
34def get_gcc_mips_plt_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050035 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 -050036 return "--with-mips-plt"
37 return ""
38
Patrick Williamsf1e5d692016-03-30 15:21:19 -050039def get_gcc_ppc_plt_settings(bb, d):
Brad Bishop19323692019-04-05 15:28:33 -040040 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 -050041 return "--enable-secureplt"
42 return ""
43
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044def get_gcc_multiarch_setting(bb, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050045 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046 multiarch_options = {
47 "i586": "--enable-targets=all",
48 "i686": "--enable-targets=all",
49 "powerpc": "--enable-targets=powerpc64",
Andrew Geissler82c905d2020-04-13 13:39:40 -050050 "powerpc64le": "--enable-targets=powerpcle",
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051 "mips": "--enable-targets=all",
52 "sparc": "--enable-targets=all",
53 }
54
55 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
56 if target_arch in multiarch_options :
57 return multiarch_options[target_arch]
58 return ""
59
60# this is used by the multilib setup of gcc
61def get_tune_parameters(tune, d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 availtunes = d.getVar('AVAILTUNES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063 if tune not in availtunes.split():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050064 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065
66 localdata = bb.data.createCopy(d)
67 override = ':tune-' + tune
68 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069
70 retdict = {}
71 retdict['tune'] = tune
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
73 retdict['features'] = localdata.getVar('TUNE_FEATURES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050074 # BASELIB is used by the multilib code to change library paths
Brad Bishop6e60e8b2018-02-01 10:27:11 -050075 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
76 retdict['arch'] = localdata.getVar('TUNE_ARCH')
77 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
78 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
79 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
80 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 return retdict
82
83get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
84
85DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
86
87MIRRORS =+ "\
88${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \
89${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
90${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
91${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
92${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
93"
94#
95# Set some default values
96#
97gcclibdir = "${libdir}/gcc"
98BINV = "${PV}"
99#S = "${WORKDIR}/gcc-${PV}"
100S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500101
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
103
104target_includedir ?= "${includedir}"
105target_libdir ?= "${libdir}"
106target_base_libdir ?= "${base_libdir}"
107target_prefix ?= "${prefix}"
108
109# We need to ensure that for the shared work directory, the do_patch signatures match
110# The real WORKDIR location isn't a dependency for the shared workdir.
111src_patches[vardepsexclude] = "WORKDIR"
112should_apply[vardepsexclude] += "PN"