gdb.mk 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ################################################################################
  2. #
  3. # gdb
  4. #
  5. ################################################################################
  6. GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
  7. GDB_SITE = $(BR2_GNU_MIRROR)/gdb
  8. ifeq ($(BR2_arc),y)
  9. GDB_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,gdb,$(GDB_VERSION))
  10. GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
  11. GDB_FROM_GIT = y
  12. endif
  13. ifeq ($(BR2_microblaze),y)
  14. GDB_SITE = $(call github,Xilinx,gdb,$(GDB_VERSION))
  15. GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
  16. GDB_FROM_GIT = y
  17. endif
  18. ifeq ($(GDB_VERSION),6.7.1-avr32-2.1.5)
  19. GDB_SITE = ftp://www.at91.com/pub/buildroot
  20. endif
  21. GDB_SOURCE ?= gdb-$(GDB_VERSION).tar.bz2
  22. GDB_LICENSE = GPLv2+ LGPLv2+ GPLv3+ LGPLv3+
  23. GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
  24. # We only want gdbserver and not the entire debugger.
  25. ifeq ($(BR2_PACKAGE_GDB_DEBUGGER),)
  26. GDB_SUBDIR = gdb/gdbserver
  27. HOST_GDB_SUBDIR = .
  28. else
  29. GDB_DEPENDENCIES = ncurses
  30. endif
  31. # For the host variant, we really want to build with XML support,
  32. # which is needed to read XML descriptions of target architectures.
  33. HOST_GDB_DEPENDENCIES = host-expat
  34. # Apply the Xtensa specific patches
  35. XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
  36. ifneq ($(XTENSA_CORE_NAME),)
  37. define GDB_XTENSA_PRE_PATCH
  38. tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
  39. -C $(@D) --strip-components=1 gdb
  40. endef
  41. GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
  42. HOST_GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
  43. endif
  44. # When gdb sources are fetched from the binutils-gdb repository, they
  45. # also contain the binutils sources, but binutils shouldn't be built,
  46. # so we disable it.
  47. GDB_DISABLE_BINUTILS_CONF_OPT = \
  48. --disable-binutils \
  49. --disable-ld \
  50. --disable-gas
  51. GDB_CONF_ENV = \
  52. ac_cv_type_uintptr_t=yes \
  53. gt_cv_func_gettext_libintl=yes \
  54. ac_cv_func_dcgettext=yes \
  55. gdb_cv_func_sigsetjmp=yes \
  56. bash_cv_func_strcoll_broken=no \
  57. bash_cv_must_reinstall_sighandlers=no \
  58. bash_cv_func_sigsetjmp=present \
  59. bash_cv_have_mbstate_t=yes \
  60. gdb_cv_func_sigsetjmp=yes
  61. GDB_CONF_OPT = \
  62. --without-uiout \
  63. --disable-tui \
  64. --disable-gdbtk \
  65. --without-x \
  66. --disable-sim \
  67. $(GDB_DISABLE_BINUTILS_CONF_OPT) \
  68. $(if $(BR2_PACKAGE_GDB_SERVER),--enable-gdbserver) \
  69. --with-curses \
  70. --without-included-gettext \
  71. --disable-werror
  72. # This removes some unneeded Python scripts and XML target description
  73. # files that are not useful for a normal usage of the debugger.
  74. define GDB_REMOVE_UNNEEDED_FILES
  75. $(RM) -rf $(TARGET_DIR)/usr/share/gdb
  76. endef
  77. GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
  78. # This installs the gdbserver somewhere into the $(HOST_DIR) so that
  79. # it becomes an integral part of the SDK, if the toolchain generated
  80. # by Buildroot is later used as an external toolchain. We install it
  81. # in debug-root/usr/bin/gdbserver so that it matches what Crosstool-NG
  82. # does.
  83. define GDB_SDK_INSTALL_GDBSERVER
  84. $(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
  85. $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
  86. endef
  87. ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
  88. GDB_POST_INSTALL_TARGET_HOOKS += GDB_SDK_INSTALL_GDBSERVER
  89. endif
  90. # A few notes:
  91. # * --target, because we're doing a cross build rather than a real
  92. # host build.
  93. # * --enable-static because gdb really wants to use libbfd.a
  94. # * --disable-shared, otherwise the old 6.7 version specific to AVR32
  95. # doesn't build because it wants to link a shared libbfd.so against
  96. # non-PIC liberty.a.
  97. HOST_GDB_CONF_OPT = \
  98. --target=$(GNU_TARGET_NAME) \
  99. --enable-static --disable-shared \
  100. --without-uiout \
  101. --disable-tui \
  102. --disable-gdbtk \
  103. --without-x \
  104. --enable-threads \
  105. --disable-werror \
  106. --without-included-gettext \
  107. $(GDB_DISABLE_BINUTILS_CONF_OPT) \
  108. --disable-sim
  109. ifeq ($(GDB_FROM_GIT),y)
  110. HOST_GDB_DEPENDENCIES += host-texinfo
  111. else
  112. # don't generate documentation
  113. GDB_CONF_ENV += ac_cv_prog_MAKEINFO=missing
  114. HOST_GDB_CONF_ENV += ac_cv_prog_MAKEINFO=missing
  115. endif
  116. # legacy $arch-linux-gdb symlink
  117. define HOST_GDB_ADD_SYMLINK
  118. cd $(HOST_DIR)/usr/bin && \
  119. ln -snf $(GNU_TARGET_NAME)-gdb $(ARCH)-linux-gdb
  120. endef
  121. HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK
  122. HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file
  123. $(eval $(autotools-package))
  124. $(eval $(host-autotools-package))