binutils.mk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. else
  20. BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.bz2
  21. endif
  22. BINUTILS_SITE = $(BR2_GNU_MIRROR)/binutils
  23. ifeq ($(ARCH),avr32)
  24. BINUTILS_SITE = ftp://www.at91.com/pub/buildroot
  25. endif
  26. BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
  27. BINUTILS_INSTALL_STAGING = YES
  28. BINUTILS_DEPENDENCIES = $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
  29. BINUTILS_LICENSE = GPLv3+, libiberty LGPLv2.1+
  30. BINUTILS_LICENSE_FILES = COPYING3 COPYING.LIB
  31. # We need to specify host & target to avoid breaking ARM EABI
  32. BINUTILS_CONF_OPT = --disable-multilib --disable-werror \
  33. --host=$(GNU_TARGET_NAME) \
  34. --target=$(GNU_TARGET_NAME) \
  35. --enable-shared \
  36. $(BINUTILS_EXTRA_CONFIG_OPTIONS)
  37. # Install binutils after busybox to prefer full-blown utilities
  38. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  39. BINUTILS_DEPENDENCIES += busybox
  40. endif
  41. # "host" binutils should actually be "cross"
  42. # We just keep the convention of "host utility" for now
  43. HOST_BINUTILS_CONF_OPT = --disable-multilib --disable-werror \
  44. --target=$(GNU_TARGET_NAME) \
  45. --disable-shared --enable-static \
  46. --with-sysroot=$(STAGING_DIR) \
  47. $(BINUTILS_EXTRA_CONFIG_OPTIONS)
  48. HOST_BINUTILS_DEPENDENCIES =
  49. # We just want libbfd and libiberty, not the full-blown binutils in staging
  50. define BINUTILS_INSTALL_STAGING_CMDS
  51. $(MAKE) -C $(@D)/bfd DESTDIR=$(STAGING_DIR) install
  52. $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
  53. endef
  54. # If we don't want full binutils on target
  55. ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y)
  56. define BINUTILS_INSTALL_TARGET_CMDS
  57. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install
  58. $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
  59. endef
  60. endif
  61. XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
  62. ifneq ($(XTENSA_CORE_NAME),)
  63. define BINUTILS_XTENSA_PRE_PATCH
  64. tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
  65. -C $(@D) --strip-components=1 binutils
  66. endef
  67. HOST_BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
  68. endif
  69. $(eval $(autotools-package))
  70. $(eval $(host-autotools-package))