binutils.mk 3.5 KB

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