crosstool-ng: add support for building a no-python gdb version
Add the ability if python support in GDB is enabled to also build a version of GDB w/o python. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
a0502aae70
commit
293872862c
|
@ -0,0 +1,173 @@
|
||||||
|
From 323b296e0087c079aa36115a678e0aa89cd34587 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kumar Gala <kumar.gala@linaro.org>
|
||||||
|
Date: Wed, 13 May 2020 12:13:48 -0500
|
||||||
|
Subject: [PATCH 1/2] gdb: make gdb cross build its own function
|
||||||
|
|
||||||
|
Make a function out of the cross build so we can call it more than once.
|
||||||
|
|
||||||
|
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
|
||||||
|
---
|
||||||
|
scripts/build/debug/300-gdb.sh | 137 +++++++++++++++++----------------
|
||||||
|
1 file changed, 71 insertions(+), 66 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
|
||||||
|
index 91393317..98d415cb 100644
|
||||||
|
--- a/scripts/build/debug/300-gdb.sh
|
||||||
|
+++ b/scripts/build/debug/300-gdb.sh
|
||||||
|
@@ -15,82 +15,87 @@ do_debug_gdb_extract()
|
||||||
|
chmod a+x "${CT_SRC_DIR}/gdb/gdb/gdbserver/configure"
|
||||||
|
}
|
||||||
|
|
||||||
|
-do_debug_gdb_build()
|
||||||
|
+do_debug_gdb_build_cross()
|
||||||
|
{
|
||||||
|
- if [ "${CT_GDB_CROSS}" = "y" ]; then
|
||||||
|
- local gcc_version p _p
|
||||||
|
- local -a cross_extra_config
|
||||||
|
-
|
||||||
|
- CT_DoStep INFO "Installing cross-gdb"
|
||||||
|
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-cross"
|
||||||
|
-
|
||||||
|
- cross_extra_config=( "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}" )
|
||||||
|
- if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
|
||||||
|
- if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then
|
||||||
|
- if [ "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" ]; then
|
||||||
|
- CT_Abort "For canadian build, Python wrapper runnable on the build machine must be provided. Set CT_GDB_CROSS_PYTHON_BINARY."
|
||||||
|
- elif [ "${CT_CONFIGURE_has_python}" = "y" ]; then
|
||||||
|
- cross_extra_config+=("--with-python=${python}")
|
||||||
|
- else
|
||||||
|
- CT_Abort "Python support requested in GDB, but Python not found. Set CT_GDB_CROSS_PYTHON_BINARY."
|
||||||
|
- fi
|
||||||
|
+ local gcc_version p _p
|
||||||
|
+ local -a cross_extra_config
|
||||||
|
+
|
||||||
|
+ CT_DoStep INFO "Installing cross-gdb"
|
||||||
|
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-cross"
|
||||||
|
+
|
||||||
|
+ cross_extra_config=( "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}" )
|
||||||
|
+ if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
|
||||||
|
+ if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then
|
||||||
|
+ if [ "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" ]; then
|
||||||
|
+ CT_Abort "For canadian build, Python wrapper runnable on the build machine must be provided. Set CT_GDB_CROSS_PYTHON_BINARY."
|
||||||
|
+ elif [ "${CT_CONFIGURE_has_python}" = "y" ]; then
|
||||||
|
+ cross_extra_config+=("--with-python=${python}")
|
||||||
|
else
|
||||||
|
- cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_BINARY}")
|
||||||
|
+ CT_Abort "Python support requested in GDB, but Python not found. Set CT_GDB_CROSS_PYTHON_BINARY."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
- cross_extra_config+=("--with-python=no")
|
||||||
|
+ cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_BINARY}")
|
||||||
|
fi
|
||||||
|
+ else
|
||||||
|
+ cross_extra_config+=("--with-python=no")
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then
|
||||||
|
- cross_extra_config+=("--enable-sim")
|
||||||
|
- else
|
||||||
|
- cross_extra_config+=("--disable-sim")
|
||||||
|
- fi
|
||||||
|
+ if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then
|
||||||
|
+ cross_extra_config+=("--enable-sim")
|
||||||
|
+ else
|
||||||
|
+ cross_extra_config+=("--disable-sim")
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- if ${CT_HOST}-gcc --version 2>&1 | grep clang; then
|
||||||
|
- # clang detects the line from gettext's _ macro as format string
|
||||||
|
- # not being a string literal and produces a lot of warnings - which
|
||||||
|
- # ct-ng's logger faithfully relays to user if this happens in the
|
||||||
|
- # error() function. Suppress them.
|
||||||
|
- cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security")
|
||||||
|
- fi
|
||||||
|
+ if ${CT_HOST}-gcc --version 2>&1 | grep clang; then
|
||||||
|
+ # clang detects the line from gettext's _ macro as format string
|
||||||
|
+ # not being a string literal and produces a lot of warnings - which
|
||||||
|
+ # ct-ng's logger faithfully relays to user if this happens in the
|
||||||
|
+ # error() function. Suppress them.
|
||||||
|
+ cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security")
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- do_gdb_backend \
|
||||||
|
- buildtype=cross \
|
||||||
|
- host="${CT_HOST}" \
|
||||||
|
- cflags="${CT_CFLAGS_FOR_HOST}" \
|
||||||
|
- ldflags="${CT_LDFLAGS_FOR_HOST}" \
|
||||||
|
- prefix="${CT_PREFIX_DIR}" \
|
||||||
|
- static="${CT_GDB_CROSS_STATIC}" \
|
||||||
|
- --with-sysroot="${CT_SYSROOT_DIR}" \
|
||||||
|
- "${cross_extra_config[@]}"
|
||||||
|
-
|
||||||
|
- if [ "${CT_BUILD_MANUALS}" = "y" ]; then
|
||||||
|
- CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
|
||||||
|
- CT_DoExecLog ALL make ${CT_JOBSFLAGS} pdf html
|
||||||
|
- CT_DoExecLog ALL make install-{pdf,html}-gdb
|
||||||
|
- fi
|
||||||
|
+ do_gdb_backend \
|
||||||
|
+ buildtype=cross \
|
||||||
|
+ host="${CT_HOST}" \
|
||||||
|
+ cflags="${CT_CFLAGS_FOR_HOST}" \
|
||||||
|
+ ldflags="${CT_LDFLAGS_FOR_HOST}" \
|
||||||
|
+ prefix="${CT_PREFIX_DIR}" \
|
||||||
|
+ static="${CT_GDB_CROSS_STATIC}" \
|
||||||
|
+ --with-sysroot="${CT_SYSROOT_DIR}" \
|
||||||
|
+ "${cross_extra_config[@]}"
|
||||||
|
+
|
||||||
|
+ if [ "${CT_BUILD_MANUALS}" = "y" ]; then
|
||||||
|
+ CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
|
||||||
|
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS} pdf html
|
||||||
|
+ CT_DoExecLog ALL make install-{pdf,html}-gdb
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
|
||||||
|
- CT_DoLog EXTRA "Installing '.gdbinit' template"
|
||||||
|
- # See in scripts/build/internals.sh for why we do this
|
||||||
|
- # TBD GCC 3.x and older not supported
|
||||||
|
- if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
|
||||||
|
- gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER")
|
||||||
|
- else
|
||||||
|
- gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
|
||||||
|
- "${CT_SRC_DIR}/gcc/gcc/version.c" \
|
||||||
|
- )
|
||||||
|
- fi
|
||||||
|
- sed -r \
|
||||||
|
- -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
|
||||||
|
- -e "s:@@VERSION@@:${gcc_version}:;" \
|
||||||
|
- "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
|
||||||
|
- >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
|
||||||
|
- fi # Install gdbinit sample
|
||||||
|
+ if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
|
||||||
|
+ CT_DoLog EXTRA "Installing '.gdbinit' template"
|
||||||
|
+ # See in scripts/build/internals.sh for why we do this
|
||||||
|
+ # TBD GCC 3.x and older not supported
|
||||||
|
+ if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
|
||||||
|
+ gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER")
|
||||||
|
+ else
|
||||||
|
+ gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
|
||||||
|
+ "${CT_SRC_DIR}/gcc/gcc/version.c" \
|
||||||
|
+ )
|
||||||
|
+ fi
|
||||||
|
+ sed -r \
|
||||||
|
+ -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
|
||||||
|
+ -e "s:@@VERSION@@:${gcc_version}:;" \
|
||||||
|
+ "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
|
||||||
|
+ >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
|
||||||
|
+ fi # Install gdbinit sample
|
||||||
|
+
|
||||||
|
+ CT_Popd
|
||||||
|
+ CT_EndStep
|
||||||
|
+}
|
||||||
|
|
||||||
|
- CT_Popd
|
||||||
|
- CT_EndStep
|
||||||
|
+do_debug_gdb_build()
|
||||||
|
+{
|
||||||
|
+ if [ "${CT_GDB_CROSS}" = "y" ]; then
|
||||||
|
+ do_debug_gdb_build_cross
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CT_GDB_NATIVE}" = "y" -o "${CT_GDB_GDBSERVER}" = "y" ]; then
|
||||||
|
--
|
||||||
|
2.25.4
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
From c4452bb536f124140832650906a07bea99924617 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kumar Gala <kumar.gala@linaro.org>
|
||||||
|
Date: Wed, 13 May 2020 12:36:52 -0500
|
||||||
|
Subject: [PATCH 2/2] gdb: add option to build a non-python version
|
||||||
|
|
||||||
|
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
|
||||||
|
---
|
||||||
|
config/debug/gdb.in.cross | 8 ++++++++
|
||||||
|
scripts/build/debug/300-gdb.sh | 9 +++++++++
|
||||||
|
2 files changed, 17 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config/debug/gdb.in.cross b/config/debug/gdb.in.cross
|
||||||
|
index 2ddb343a..1eea06f9 100644
|
||||||
|
--- a/config/debug/gdb.in.cross
|
||||||
|
+++ b/config/debug/gdb.in.cross
|
||||||
|
@@ -65,6 +65,14 @@ config GDB_CROSS_PYTHON_BINARY
|
||||||
|
help message in gdb's configure script for the --with-python option
|
||||||
|
for further guidance.
|
||||||
|
|
||||||
|
+config GDB_CROSS_BUILD_NO_PYTHON
|
||||||
|
+ bool
|
||||||
|
+ prompt "Build GDB w/o python"
|
||||||
|
+ depends on GDB_HAS_PYTHON
|
||||||
|
+ help
|
||||||
|
+ Build a version of GDB that doesn't support python (in addition to a
|
||||||
|
+ version that does). This version will be suffix with "no-py".
|
||||||
|
+
|
||||||
|
config GDB_CROSS_EXTRA_CONFIG_ARRAY
|
||||||
|
string
|
||||||
|
prompt "Cross-gdb extra config"
|
||||||
|
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
|
||||||
|
index 98d415cb..9b27f654 100644
|
||||||
|
--- a/scripts/build/debug/300-gdb.sh
|
||||||
|
+++ b/scripts/build/debug/300-gdb.sh
|
||||||
|
@@ -98,6 +98,15 @@ do_debug_gdb_build()
|
||||||
|
do_debug_gdb_build_cross
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ if [ "${CT_GDB_CROSS_BUILD_NO_PYTHON}" = "y" ]; then
|
||||||
|
+ CT_DoStep INFO "Build gdb (w/o python) ${CT_TARGET}"
|
||||||
|
+ CT_GDB_CROSS_PYTHON="n"
|
||||||
|
+ CT_GDB_CROSS_EXTRA_CONFIG_ARRAY+=("--program-prefix=${CT_TARGET}-")
|
||||||
|
+ CT_GDB_CROSS_EXTRA_CONFIG_ARRAY+=("--program-suffix=-no-py")
|
||||||
|
+ do_debug_gdb_build_cross
|
||||||
|
+ CT_GDB_CROSS_PYTHON="y"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
if [ "${CT_GDB_NATIVE}" = "y" -o "${CT_GDB_GDBSERVER}" = "y" ]; then
|
||||||
|
local -a native_extra_config
|
||||||
|
local subdir
|
||||||
|
--
|
||||||
|
2.25.4
|
||||||
|
|
Loading…
Reference in New Issue