1*4882a593SmuzhiyunSUMMARY = "GNU cc and gcc C compilers" 2*4882a593SmuzhiyunHOMEPAGE = "http://www.gnu.org/software/gcc/" 3*4882a593SmuzhiyunDESCRIPTION = "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." 4*4882a593SmuzhiyunSECTION = "devel" 5*4882a593SmuzhiyunLICENSE = "GPL" 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunNATIVEDEPS = "" 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunCVE_PRODUCT = "gcc" 10*4882a593Smuzhiyun 11*4882a593Smuzhiyuninherit autotools gettext texinfo 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunBPN = "gcc" 14*4882a593SmuzhiyunCOMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir" 15*4882a593SmuzhiyunCOMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir" 16*4882a593Smuzhiyun 17*4882a593Smuzhiyunpython extract_stashed_builddir () { 18*4882a593Smuzhiyun src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}") 19*4882a593Smuzhiyun dest = d.getVar("B") 20*4882a593Smuzhiyun oe.path.copyhardlinktree(src, dest) 21*4882a593Smuzhiyun staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d) 22*4882a593Smuzhiyun} 23*4882a593Smuzhiyun 24*4882a593Smuzhiyundef get_gcc_float_setting(bb, d): 25*4882a593Smuzhiyun if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm": 26*4882a593Smuzhiyun return "--with-float=hard" 27*4882a593Smuzhiyun if d.getVar('TARGET_FPU') in [ 'soft' ]: 28*4882a593Smuzhiyun return "--with-float=soft" 29*4882a593Smuzhiyun if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]: 30*4882a593Smuzhiyun return "--enable-e500_double" 31*4882a593Smuzhiyun return "" 32*4882a593Smuzhiyun 33*4882a593Smuzhiyunget_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" 34*4882a593Smuzhiyun 35*4882a593Smuzhiyundef get_gcc_mips_plt_setting(bb, d): 36*4882a593Smuzhiyun if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): 37*4882a593Smuzhiyun return "--with-mips-plt" 38*4882a593Smuzhiyun return "" 39*4882a593Smuzhiyun 40*4882a593Smuzhiyundef get_gcc_ppc_plt_settings(bb, d): 41*4882a593Smuzhiyun if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d): 42*4882a593Smuzhiyun return "--enable-secureplt" 43*4882a593Smuzhiyun return "" 44*4882a593Smuzhiyun 45*4882a593Smuzhiyundef get_gcc_multiarch_setting(bb, d): 46*4882a593Smuzhiyun target_arch = d.getVar('TRANSLATED_TARGET_ARCH') 47*4882a593Smuzhiyun multiarch_options = { 48*4882a593Smuzhiyun "i586": "--enable-targets=all", 49*4882a593Smuzhiyun "i686": "--enable-targets=all", 50*4882a593Smuzhiyun "powerpc": "--enable-targets=powerpc64", 51*4882a593Smuzhiyun "powerpc64le": "--enable-targets=powerpcle", 52*4882a593Smuzhiyun "mips": "--enable-targets=all", 53*4882a593Smuzhiyun "sparc": "--enable-targets=all", 54*4882a593Smuzhiyun } 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d): 57*4882a593Smuzhiyun if target_arch in multiarch_options : 58*4882a593Smuzhiyun return multiarch_options[target_arch] 59*4882a593Smuzhiyun return "" 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun# this is used by the multilib setup of gcc 62*4882a593Smuzhiyundef get_tune_parameters(tune, d): 63*4882a593Smuzhiyun availtunes = d.getVar('AVAILTUNES') 64*4882a593Smuzhiyun if tune not in availtunes.split(): 65*4882a593Smuzhiyun bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes)) 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun localdata = bb.data.createCopy(d) 68*4882a593Smuzhiyun override = ':tune-' + tune 69*4882a593Smuzhiyun localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun retdict = {} 72*4882a593Smuzhiyun retdict['tune'] = tune 73*4882a593Smuzhiyun retdict['ccargs'] = localdata.getVar('TUNE_CCARGS') 74*4882a593Smuzhiyun retdict['features'] = localdata.getVar('TUNE_FEATURES') 75*4882a593Smuzhiyun # BASELIB is used by the multilib code to change library paths 76*4882a593Smuzhiyun retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB') 77*4882a593Smuzhiyun retdict['arch'] = localdata.getVar('TUNE_ARCH') 78*4882a593Smuzhiyun retdict['abiextension'] = localdata.getVar('ABIEXTENSION') 79*4882a593Smuzhiyun retdict['target_fpu'] = localdata.getVar('TARGET_FPU') 80*4882a593Smuzhiyun retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH') 81*4882a593Smuzhiyun retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS') 82*4882a593Smuzhiyun return retdict 83*4882a593Smuzhiyun 84*4882a593Smuzhiyunget_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS" 85*4882a593Smuzhiyun 86*4882a593SmuzhiyunDEBIANNAME:${MLPREFIX}libgcc = "libgcc1" 87*4882a593Smuzhiyun 88*4882a593SmuzhiyunMIRRORS =+ "\ 89*4882a593Smuzhiyun ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \ 90*4882a593Smuzhiyun" 91*4882a593Smuzhiyun# 92*4882a593Smuzhiyun# Set some default values 93*4882a593Smuzhiyun# 94*4882a593Smuzhiyungcclibdir = "${libdir}/gcc" 95*4882a593SmuzhiyunBINV = "${PV}" 96*4882a593Smuzhiyun#S = "${WORKDIR}/gcc-${PV}" 97*4882a593SmuzhiyunS = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" 98*4882a593Smuzhiyun 99*4882a593SmuzhiyunB ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" 100*4882a593Smuzhiyun 101*4882a593Smuzhiyuntarget_includedir ?= "${includedir}" 102*4882a593Smuzhiyuntarget_libdir ?= "${libdir}" 103*4882a593Smuzhiyuntarget_base_libdir ?= "${base_libdir}" 104*4882a593Smuzhiyuntarget_prefix ?= "${prefix}" 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun# We need to ensure that for the shared work directory, the do_patch signatures match 107*4882a593Smuzhiyun# The real WORKDIR location isn't a dependency for the shared workdir. 108*4882a593Smuzhiyunsrc_patches[vardepsexclude] = "WORKDIR" 109*4882a593Smuzhiyunshould_apply[vardepsexclude] += "PN" 110