iptables: bump to version 1.6.1
[buildroot-gz.git] / package / gdb / gdb.mk
blob606f1f96001b5ea3bee0047ded2c0574e87f45da
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 # Starting with gdb 7.11, the bundled gnulib tries to use
71 # rpl_gettimeofday (gettimeofday replacement) due to the code being
72 # unable to determine if the replacement function should be used or
73 # not when cross-compiling with uClibc or musl as C libraries. So use
74 # gl_cv_func_gettimeofday_clobber=no to not use rpl_gettimeofday,
75 # assuming musl and uClibc have a properly working gettimeofday
76 # implementation.
77 GDB_CONF_ENV = \
78 ac_cv_type_uintptr_t=yes \
79 gt_cv_func_gettext_libintl=yes \
80 ac_cv_func_dcgettext=yes \
81 gdb_cv_func_sigsetjmp=yes \
82 bash_cv_func_strcoll_broken=no \
83 bash_cv_must_reinstall_sighandlers=no \
84 bash_cv_func_sigsetjmp=present \
85 bash_cv_have_mbstate_t=yes \
86 gdb_cv_func_sigsetjmp=yes \
87 gl_cv_func_gettimeofday_clobber=no
89 # The shared only build is not supported by gdb, so enable static build for
90 # build-in libraries with --enable-static.
91 GDB_CONF_OPTS = \
92 --without-uiout \
93 --disable-gdbtk \
94 --without-x \
95 --disable-sim \
96 $(GDB_DISABLE_BINUTILS_CONF_OPTS) \
97 $(if $(BR2_PACKAGE_GDB_SERVER),--enable-gdbserver) \
98 --with-curses \
99 --without-included-gettext \
100 --disable-werror \
101 --enable-static
103 # When gdb is built as C++ application for ARC it segfaults at runtime
104 # So we pass --disable-build-with-cxx config option to force gdb not to
105 # be built as C++ app.
106 ifeq ($(BR2_arc),y)
107 GDB_CONF_OPTS += --disable-build-with-cxx
108 endif
110 # gdb 7.12+ by default builds with a C++ compiler, which doesn't work
111 # when we don't have C++ support in the toolchain
112 ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
113 GDB_CONF_OPTS += --disable-build-with-cxx
114 endif
116 ifeq ($(BR2_PACKAGE_GDB_TUI),y)
117 GDB_CONF_OPTS += --enable-tui
118 else
119 GDB_CONF_OPTS += --disable-tui
120 endif
122 ifeq ($(BR2_PACKAGE_GDB_PYTHON),y)
123 GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
124 GDB_DEPENDENCIES += python
125 else
126 GDB_CONF_OPTS += --without-python
127 endif
129 ifeq ($(BR2_PACKAGE_EXPAT),y)
130 GDB_CONF_OPTS += --with-expat
131 GDB_CONF_OPTS += --with-libexpat-prefix=$(STAGING_DIR)/usr
132 GDB_DEPENDENCIES += expat
133 else
134 GDB_CONF_OPTS += --without-expat
135 endif
137 ifeq ($(BR2_PACKAGE_XZ),y)
138 GDB_CONF_OPTS += --with-lzma
139 GDB_CONF_OPTS += --with-liblzma-prefix=$(STAGING_DIR)/usr
140 GDB_DEPENDENCIES += xz
141 else
142 GDB_CONF_OPTS += --without-lzma
143 endif
145 ifeq ($(BR2_PACKAGE_ZLIB),y)
146 GDB_CONF_OPTS += --with-zlib
147 GDB_DEPENDENCIES += zlib
148 else
149 GDB_CONF_OPTS += --without-zlib
150 endif
152 # This removes some unneeded Python scripts and XML target description
153 # files that are not useful for a normal usage of the debugger.
154 define GDB_REMOVE_UNNEEDED_FILES
155 $(RM) -rf $(TARGET_DIR)/usr/share/gdb
156 endef
158 GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
160 # This installs the gdbserver somewhere into the $(HOST_DIR) so that
161 # it becomes an integral part of the SDK, if the toolchain generated
162 # by Buildroot is later used as an external toolchain. We install it
163 # in debug-root/usr/bin/gdbserver so that it matches what Crosstool-NG
164 # does.
165 define GDB_SDK_INSTALL_GDBSERVER
166 $(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
167 $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
168 endef
170 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
171 GDB_POST_INSTALL_TARGET_HOOKS += GDB_SDK_INSTALL_GDBSERVER
172 endif
174 # A few notes:
175 # * --target, because we're doing a cross build rather than a real
176 # host build.
177 # * --enable-static because gdb really wants to use libbfd.a
178 HOST_GDB_CONF_OPTS = \
179 --target=$(GNU_TARGET_NAME) \
180 --enable-static \
181 --without-uiout \
182 --disable-gdbtk \
183 --without-x \
184 --enable-threads \
185 --disable-werror \
186 --without-included-gettext \
187 $(GDB_DISABLE_BINUTILS_CONF_OPTS)
189 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
190 HOST_GDB_CONF_OPTS += --enable-tui
191 else
192 HOST_GDB_CONF_OPTS += --disable-tui
193 endif
195 ifeq ($(BR2_PACKAGE_HOST_GDB_PYTHON),y)
196 HOST_GDB_CONF_OPTS += --with-python=$(HOST_DIR)/usr/bin/python2
197 HOST_GDB_DEPENDENCIES += host-python
198 else
199 HOST_GDB_CONF_OPTS += --without-python
200 endif
202 # workaround a bug if in-tree build is used for bfin sim
203 define HOST_GDB_BFIN_SIM_WORKAROUND
204 $(RM) $(@D)/sim/common/tconfig.h
205 endef
207 ifeq ($(BR2_PACKAGE_HOST_GDB_SIM),y)
208 HOST_GDB_CONF_OPTS += --enable-sim
209 ifeq ($(BR2_bfin),y)
210 HOST_GDB_PRE_CONFIGURE_HOOKS += HOST_GDB_BFIN_SIM_WORKAROUND
211 endif
212 else
213 HOST_GDB_CONF_OPTS += --disable-sim
214 endif
216 # legacy $arch-linux-gdb symlink
217 define HOST_GDB_ADD_SYMLINK
218 cd $(HOST_DIR)/usr/bin && \
219 ln -snf $(GNU_TARGET_NAME)-gdb $(ARCH)-linux-gdb
220 endef
222 HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK
224 HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file
226 $(eval $(autotools-package))
227 $(eval $(host-autotools-package))