python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / gdb / gdb.mk
blobd8299900ec225400297913365738e8cb53da7199
1 ################################################################################
3 # gdb
5 ################################################################################
7 GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
8 GDB_SITE = $(BR2_GNU_MIRROR)/gdb
9 GDB_SOURCE = gdb-$(GDB_VERSION).tar.xz
11 ifeq ($(BR2_arc),y)
12 GDB_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(GDB_VERSION))
13 GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
14 GDB_FROM_GIT = y
15 endif
17 ifeq ($(BR2_microblaze),y)
18 GDB_SITE = $(call github,Xilinx,gdb,$(GDB_VERSION))
19 GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
20 GDB_FROM_GIT = y
21 endif
23 GDB_LICENSE = GPLv2+, LGPLv2+, GPLv3+, LGPLv3+
24 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
26 # We only want gdbserver and not the entire debugger.
27 ifeq ($(BR2_PACKAGE_GDB_DEBUGGER),)
28 GDB_SUBDIR = gdb/gdbserver
29 HOST_GDB_SUBDIR = .
30 else
31 GDB_DEPENDENCIES = ncurses \
32 $(if $(BR2_PACKAGE_LIBICONV),libiconv)
33 endif
35 # For the host variant, we really want to build with XML support,
36 # which is needed to read XML descriptions of target architectures. We
37 # also need ncurses.
38 HOST_GDB_DEPENDENCIES = host-expat host-ncurses
40 # Disable building documentation
41 GDB_MAKE_OPTS += MAKEINFO=true
42 GDB_INSTALL_TARGET_OPTS += MAKEINFO=true DESTDIR=$(TARGET_DIR) install
43 HOST_GDB_MAKE_OPTS += MAKEINFO=true
44 HOST_GDB_INSTALL_OPTS += MAKEINFO=true install
46 # Apply the Xtensa specific patches
47 XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
48 ifneq ($(XTENSA_CORE_NAME),)
49 define GDB_XTENSA_PRE_PATCH
50 tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
51 -C $(@D) --strip-components=1 gdb
52 endef
53 GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
54 HOST_GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
55 endif
57 ifeq ($(GDB_FROM_GIT),y)
58 GDB_DEPENDENCIES += host-flex host-bison
59 HOST_GDB_DEPENDENCIES += host-flex host-bison
60 endif
62 # When gdb sources are fetched from the binutils-gdb repository, they
63 # also contain the binutils sources, but binutils shouldn't be built,
64 # so we disable it.
65 GDB_DISABLE_BINUTILS_CONF_OPTS = \
66 --disable-binutils \
67 --disable-ld \
68 --disable-gas
70 GDB_CONF_ENV = \
71 ac_cv_type_uintptr_t=yes \
72 gt_cv_func_gettext_libintl=yes \
73 ac_cv_func_dcgettext=yes \
74 gdb_cv_func_sigsetjmp=yes \
75 bash_cv_func_strcoll_broken=no \
76 bash_cv_must_reinstall_sighandlers=no \
77 bash_cv_func_sigsetjmp=present \
78 bash_cv_have_mbstate_t=yes \
79 gdb_cv_func_sigsetjmp=yes
81 # Starting with gdb 7.11, the bundled gnulib tries to use
82 # rpl_gettimeofday (gettimeofday replacement) due to the code being
83 # unable to determine if the replacement function should be used or
84 # not when cross-compiling with uClibc or musl as C libraries. So use
85 # gl_cv_func_gettimeofday_clobber=no to not use rpl_gettimeofday,
86 # assuming musl and uClibc have a properly working gettimeofday
87 # implementation. It needs to be passed to GDB_CONF_ENV to build
88 # gdbserver only but also to GDB_MAKE_ENV, because otherwise it does
89 # not get passed to the configure script of nested packages while
90 # building gdbserver with full debugger.
91 GDB_CONF_ENV += gl_cv_func_gettimeofday_clobber=no
92 GDB_MAKE_ENV = gl_cv_func_gettimeofday_clobber=no
94 # The shared only build is not supported by gdb, so enable static build for
95 # build-in libraries with --enable-static.
96 GDB_CONF_OPTS = \
97 --without-uiout \
98 --disable-gdbtk \
99 --without-x \
100 --disable-sim \
101 $(GDB_DISABLE_BINUTILS_CONF_OPTS) \
102 $(if $(BR2_PACKAGE_GDB_SERVER),--enable-gdbserver) \
103 --with-curses \
104 --without-included-gettext \
105 --disable-werror \
106 --enable-static
108 # When gdb is built as C++ application for ARC it segfaults at runtime
109 # So we pass --disable-build-with-cxx config option to force gdb not to
110 # be built as C++ app.
111 ifeq ($(BR2_arc),y)
112 GDB_CONF_OPTS += --disable-build-with-cxx
113 endif
115 # gdb 7.12+ by default builds with a C++ compiler, which doesn't work
116 # when we don't have C++ support in the toolchain
117 ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
118 GDB_CONF_OPTS += --disable-build-with-cxx
119 endif
121 ifeq ($(BR2_PACKAGE_GDB_TUI),y)
122 GDB_CONF_OPTS += --enable-tui
123 else
124 GDB_CONF_OPTS += --disable-tui
125 endif
127 ifeq ($(BR2_PACKAGE_GDB_PYTHON),y)
128 GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
129 GDB_DEPENDENCIES += python
130 else
131 GDB_CONF_OPTS += --without-python
132 endif
134 ifeq ($(BR2_PACKAGE_EXPAT),y)
135 GDB_CONF_OPTS += --with-expat
136 GDB_CONF_OPTS += --with-libexpat-prefix=$(STAGING_DIR)/usr
137 GDB_DEPENDENCIES += expat
138 else
139 GDB_CONF_OPTS += --without-expat
140 endif
142 ifeq ($(BR2_PACKAGE_XZ),y)
143 GDB_CONF_OPTS += --with-lzma
144 GDB_CONF_OPTS += --with-liblzma-prefix=$(STAGING_DIR)/usr
145 GDB_DEPENDENCIES += xz
146 else
147 GDB_CONF_OPTS += --without-lzma
148 endif
150 ifeq ($(BR2_PACKAGE_ZLIB),y)
151 GDB_CONF_OPTS += --with-zlib
152 GDB_DEPENDENCIES += zlib
153 else
154 GDB_CONF_OPTS += --without-zlib
155 endif
157 # This removes some unneeded Python scripts and XML target description
158 # files that are not useful for a normal usage of the debugger.
159 define GDB_REMOVE_UNNEEDED_FILES
160 $(RM) -rf $(TARGET_DIR)/usr/share/gdb
161 endef
163 GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
165 # This installs the gdbserver somewhere into the $(HOST_DIR) so that
166 # it becomes an integral part of the SDK, if the toolchain generated
167 # by Buildroot is later used as an external toolchain. We install it
168 # in debug-root/usr/bin/gdbserver so that it matches what Crosstool-NG
169 # does.
170 define GDB_SDK_INSTALL_GDBSERVER
171 $(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
172 $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
173 endef
175 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
176 GDB_POST_INSTALL_TARGET_HOOKS += GDB_SDK_INSTALL_GDBSERVER
177 endif
179 # A few notes:
180 # * --target, because we're doing a cross build rather than a real
181 # host build.
182 # * --enable-static because gdb really wants to use libbfd.a
183 HOST_GDB_CONF_OPTS = \
184 --target=$(GNU_TARGET_NAME) \
185 --enable-static \
186 --without-uiout \
187 --disable-gdbtk \
188 --without-x \
189 --enable-threads \
190 --disable-werror \
191 --without-included-gettext \
192 $(GDB_DISABLE_BINUTILS_CONF_OPTS)
194 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
195 HOST_GDB_CONF_OPTS += --enable-tui
196 else
197 HOST_GDB_CONF_OPTS += --disable-tui
198 endif
200 ifeq ($(BR2_PACKAGE_HOST_GDB_PYTHON),y)
201 HOST_GDB_CONF_OPTS += --with-python=$(HOST_DIR)/usr/bin/python2
202 HOST_GDB_DEPENDENCIES += host-python
203 else
204 HOST_GDB_CONF_OPTS += --without-python
205 endif
207 # workaround a bug if in-tree build is used for bfin sim
208 define HOST_GDB_BFIN_SIM_WORKAROUND
209 $(RM) $(@D)/sim/common/tconfig.h
210 endef
212 ifeq ($(BR2_PACKAGE_HOST_GDB_SIM),y)
213 HOST_GDB_CONF_OPTS += --enable-sim
214 ifeq ($(BR2_bfin),y)
215 HOST_GDB_PRE_CONFIGURE_HOOKS += HOST_GDB_BFIN_SIM_WORKAROUND
216 endif
217 else
218 HOST_GDB_CONF_OPTS += --disable-sim
219 endif
221 # legacy $arch-linux-gdb symlink
222 define HOST_GDB_ADD_SYMLINK
223 cd $(HOST_DIR)/usr/bin && \
224 ln -snf $(GNU_TARGET_NAME)-gdb $(ARCH)-linux-gdb
225 endef
227 HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK
229 HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file
231 $(eval $(autotools-package))
232 $(eval $(host-autotools-package))