mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
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.
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user