binutils.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ################################################################################
  2. #
  3. # binutils
  4. #
  5. ################################################################################
  6. # Version is set when using buildroot toolchain.
  7. # If not, we do like other packages
  8. BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
  9. ifeq ($(BINUTILS_VERSION),)
  10. BINUTILS_VERSION = 2.22
  11. endif
  12. ifeq ($(BR2_arc),y)
  13. BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(BINUTILS_VERSION))
  14. BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
  15. BINUTILS_FROM_GIT = y
  16. endif
  17. BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
  18. BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.bz2
  19. BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
  20. BINUTILS_INSTALL_STAGING = YES
  21. BINUTILS_DEPENDENCIES = $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
  22. HOST_BINUTILS_DEPENDENCIES =
  23. BINUTILS_LICENSE = GPLv3+, libiberty LGPLv2.1+
  24. BINUTILS_LICENSE_FILES = COPYING3 COPYING.LIB
  25. ifeq ($(BINUTILS_FROM_GIT),y)
  26. BINUTILS_DEPENDENCIES += host-texinfo host-flex host-bison
  27. HOST_BINUTILS_DEPENDENCIES += host-texinfo host-flex host-bison
  28. endif
  29. # When binutils sources are fetched from the binutils-gdb repository,
  30. # they also contain the gdb sources, but gdb shouldn't be built, so we
  31. # disable it.
  32. BINUTILS_DISABLE_GDB_CONF_OPTS = \
  33. --disable-sim \
  34. --disable-gdb
  35. # We need to specify host & target to avoid breaking ARM EABI
  36. BINUTILS_CONF_OPTS = \
  37. --disable-multilib \
  38. --disable-werror \
  39. --host=$(GNU_TARGET_NAME) \
  40. --target=$(GNU_TARGET_NAME) \
  41. --enable-install-libiberty \
  42. $(BINUTILS_DISABLE_GDB_CONF_OPTS) \
  43. $(BINUTILS_EXTRA_CONFIG_OPTIONS)
  44. # Don't build documentation. It takes up extra space / build time,
  45. # and sometimes needs specific makeinfo versions to work
  46. BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
  47. HOST_BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
  48. # Install binutils after busybox to prefer full-blown utilities
  49. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  50. BINUTILS_DEPENDENCIES += busybox
  51. endif
  52. # "host" binutils should actually be "cross"
  53. # We just keep the convention of "host utility" for now
  54. HOST_BINUTILS_CONF_OPTS = \
  55. --disable-multilib \
  56. --disable-werror \
  57. --target=$(GNU_TARGET_NAME) \
  58. --disable-shared \
  59. --enable-static \
  60. --with-sysroot=$(STAGING_DIR) \
  61. --enable-poison-system-directories \
  62. $(BINUTILS_DISABLE_GDB_CONF_OPTS) \
  63. $(BINUTILS_EXTRA_CONFIG_OPTIONS)
  64. # We just want libbfd, libiberty and libopcodes,
  65. # not the full-blown binutils in staging
  66. define BINUTILS_INSTALL_STAGING_CMDS
  67. $(MAKE) -C $(@D)/bfd DESTDIR=$(STAGING_DIR) install
  68. $(MAKE) -C $(@D)/opcodes DESTDIR=$(STAGING_DIR) install
  69. $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
  70. endef
  71. # If we don't want full binutils on target
  72. ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y)
  73. define BINUTILS_INSTALL_TARGET_CMDS
  74. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install
  75. $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
  76. endef
  77. endif
  78. XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
  79. ifneq ($(XTENSA_CORE_NAME),)
  80. define BINUTILS_XTENSA_PRE_PATCH
  81. tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
  82. -C $(@D) --strip-components=1 binutils
  83. endef
  84. BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
  85. HOST_BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
  86. endif
  87. $(eval $(autotools-package))
  88. $(eval $(host-autotools-package))