summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-12-18 15:09:37 +1100
committerChris Johns <chrisj@rtems.org>2018-12-25 10:15:55 +1100
commit257c9267cfce362138a265764c6a799c12c6b181 (patch)
treee9345c4e7ad0268e1b554fcc23ce54925e3c6532
parentsb/execute: Port the rtemstoolkit performance fixes for python3 (diff)
downloadrtems-source-builder-257c9267cfce362138a265764c6a799c12c6b181.tar.bz2
gdb/python: Use python-config for the configuration if found.
- Do not assume the installed paths for the header and library. Ask python-config if found. Close #3537.
-rw-r--r--source-builder/config/gdb-common-1.cfg25
-rwxr-xr-xsource-builder/sb/rtems-build-dep2
2 files changed, 22 insertions, 5 deletions
diff --git a/source-builder/config/gdb-common-1.cfg b/source-builder/config/gdb-common-1.cfg
index 45df5e9..9018448 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -51,7 +51,7 @@
%define gdb-enable-python %{gdb_python3}
%else
%if %{defined gdb-python-version}
- %define gdb-enable-python %(command -v %{gdb-python-version || true})
+ %define gdb-enable-python %(command -v %{gdb-python-version} || true)
%else
%define gdb-enable-python %(command -v python2 || true)
%if %{gdb-enable-python} == %{nil}
@@ -74,15 +74,27 @@
#
# The library file name can vary across the hosts so wildcard the search.
#
+%if %{!defined gdb-python-config}
+ %define gdb-python-config %{nil}
+%endif
+%if %{gdb-python-config} == %{nil}
+ %define gdb-python-config %(command -v %{gdb-enable-python}-config || true)
+%endif
%define gdb-python-ver-mm %(%{gdb-enable-python} --version 2>&1 | sed -e 's/.* //g' | rev | cut -d'.' -f2- | rev)
-%define gdb-python-ver-header python%{gdb-python-ver-mm}/Python.h
+%define gdb-python-header Python.h
+%define gdb-python-ver-header python%{gdb-python-ver-mm}/%{gdb-python-header}
%define gdb-python-ver-lib libpython%{gdb-python-ver-mm}.*
%if %{host_includes} == %{nil}
%define gdb-host-incs %{nil}
%else
%define gdb-host-incs -I '%{host_includes}'
%endif
-%define gdb-python-header-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-incs} -H %{gdb-python-ver-header})
+%if %{gdb-python-config} != %{nil}
+ %define gdb-python-config-incs -I '%(%{gdb-python-config} --includes)'
+ %define gdb-python-header-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-incs} %{gdb-python-config-incs} -H %{gdb-python-header})
+%else
+ %define gdb-python-header-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-incs} -H %{gdb-python-ver-header})
+%endif
%if %{gdb-python-header-check} == not-found
%error "gdb: python: header file not found: %{gdb-python-ver-header}, please install"
%endif
@@ -95,7 +107,12 @@
%else
%define gdb-host-libs -L '%{host_ldflags}'
%endif
- %define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -l %{gdb-python-ver-lib})
+ %if %{gdb-python-config} != %{nil}
+ %define gdb-python-config-libs -l '%(%{gdb-python-config} --ldflags)'
+ %define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} %{gdb-python-config-libs})
+ %else
+ %define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -l %{gdb-python-ver-lib})
+ %endif
%if %{gdb-python-lib-check} == not-found
%error "gdb: python: library file not found: %{gdb-python-ver-lib}, please install"
%endif
diff --git a/source-builder/sb/rtems-build-dep b/source-builder/sb/rtems-build-dep
index 3a82753..7e406c5 100755
--- a/source-builder/sb/rtems-build-dep
+++ b/source-builder/sb/rtems-build-dep
@@ -72,7 +72,7 @@ do
echo 'error: no header path (-I) provided'
exit 2
fi
- includes="$2"; shift;
+ includes="${includes} $2"; shift;
shift;;
-l)
if [ $# -eq 1 ]; then