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}
|
%define gdb-enable-python %{gdb_python3}
|
||||||
%else
|
%else
|
||||||
%if %{defined gdb-python-version}
|
%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
|
%else
|
||||||
%define gdb-enable-python %(command -v python2 || true)
|
%define gdb-enable-python %(command -v python2 || true)
|
||||||
%if %{gdb-enable-python} == %{nil}
|
%if %{gdb-enable-python} == %{nil}
|
||||||
@@ -74,15 +74,27 @@
|
|||||||
#
|
#
|
||||||
# The library file name can vary across the hosts so wildcard the search.
|
# 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-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}.*
|
%define gdb-python-ver-lib libpython%{gdb-python-ver-mm}.*
|
||||||
%if %{host_includes} == %{nil}
|
%if %{host_includes} == %{nil}
|
||||||
%define gdb-host-incs %{nil}
|
%define gdb-host-incs %{nil}
|
||||||
%else
|
%else
|
||||||
%define gdb-host-incs -I '%{host_includes}'
|
%define gdb-host-incs -I '%{host_includes}'
|
||||||
%endif
|
%endif
|
||||||
|
%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})
|
%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
|
%if %{gdb-python-header-check} == not-found
|
||||||
%error "gdb: python: header file not found: %{gdb-python-ver-header}, please install"
|
%error "gdb: python: header file not found: %{gdb-python-ver-header}, please install"
|
||||||
%endif
|
%endif
|
||||||
@@ -95,7 +107,12 @@
|
|||||||
%else
|
%else
|
||||||
%define gdb-host-libs -L '%{host_ldflags}'
|
%define gdb-host-libs -L '%{host_ldflags}'
|
||||||
%endif
|
%endif
|
||||||
|
%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})
|
%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
|
%if %{gdb-python-lib-check} == not-found
|
||||||
%error "gdb: python: library file not found: %{gdb-python-ver-lib}, please install"
|
%error "gdb: python: library file not found: %{gdb-python-ver-lib}, please install"
|
||||||
%endif
|
%endif
|
||||||
|
@@ -72,7 +72,7 @@ do
|
|||||||
echo 'error: no header path (-I) provided'
|
echo 'error: no header path (-I) provided'
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
includes="$2"; shift;
|
includes="${includes} $2"; shift;
|
||||||
shift;;
|
shift;;
|
||||||
-l)
|
-l)
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
|
Reference in New Issue
Block a user