gcc-common.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. SUMMARY = "GNU cc and gcc C compilers"
  2. HOMEPAGE = "http://www.gnu.org/software/gcc/"
  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."
  4. SECTION = "devel"
  5. LICENSE = "GPL"
  6. NATIVEDEPS = ""
  7. CVE_PRODUCT = "gcc"
  8. inherit autotools gettext texinfo
  9. BPN = "gcc"
  10. COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
  11. COMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk:do_gcc_stash_builddir"
  12. python extract_stashed_builddir () {
  13. src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
  14. dest = d.getVar("B")
  15. oe.path.copyhardlinktree(src, dest)
  16. staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
  17. }
  18. def get_gcc_float_setting(bb, d):
  19. if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
  20. return "--with-float=hard"
  21. if d.getVar('TARGET_FPU') in [ 'soft' ]:
  22. return "--with-float=soft"
  23. if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
  24. return "--enable-e500_double"
  25. return ""
  26. get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
  27. def get_gcc_x86_64_arch_setting(bb, d):
  28. import re
  29. march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
  30. if march:
  31. return "--with-arch=%s " % march.group(1)
  32. # The earliest supported x86-64 CPU
  33. return "--with-arch=core2"
  34. get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
  35. def get_gcc_mips_plt_setting(bb, d):
  36. if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
  37. return "--with-mips-plt"
  38. return ""
  39. def get_gcc_ppc_plt_settings(bb, d):
  40. if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
  41. return "--enable-secureplt"
  42. return ""
  43. def get_gcc_multiarch_setting(bb, d):
  44. target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
  45. multiarch_options = {
  46. "i586": "--enable-targets=all",
  47. "i686": "--enable-targets=all",
  48. "powerpc": "--enable-targets=powerpc64",
  49. "powerpc64le": "--enable-targets=powerpcle",
  50. "mips": "--enable-targets=all",
  51. "sparc": "--enable-targets=all",
  52. }
  53. if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
  54. if target_arch in multiarch_options :
  55. return multiarch_options[target_arch]
  56. return ""
  57. # this is used by the multilib setup of gcc
  58. def get_tune_parameters(tune, d):
  59. availtunes = d.getVar('AVAILTUNES')
  60. if tune not in availtunes.split():
  61. bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
  62. localdata = bb.data.createCopy(d)
  63. override = ':tune-' + tune
  64. localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
  65. retdict = {}
  66. retdict['tune'] = tune
  67. retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
  68. retdict['features'] = localdata.getVar('TUNE_FEATURES')
  69. # BASELIB is used by the multilib code to change library paths
  70. retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
  71. retdict['arch'] = localdata.getVar('TUNE_ARCH')
  72. retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
  73. retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
  74. retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
  75. retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
  76. return retdict
  77. get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
  78. DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
  79. MIRRORS =+ "\
  80. ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
  81. "
  82. #
  83. # Set some default values
  84. #
  85. gcclibdir = "${libdir}/gcc"
  86. BINV = "${PV}"
  87. #S = "${WORKDIR}/gcc-${PV}"
  88. S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
  89. B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
  90. target_includedir ?= "${includedir}"
  91. target_libdir ?= "${libdir}"
  92. target_base_libdir ?= "${base_libdir}"
  93. target_prefix ?= "${prefix}"
  94. # We need to ensure that for the shared work directory, the do_patch signatures match
  95. # The real WORKDIR location isn't a dependency for the shared workdir.
  96. src_patches[vardepsexclude] = "WORKDIR"
  97. should_apply[vardepsexclude] += "PN"