gdb: Split python's version into major/minor and check for embed option

Closes #4631
This commit is contained in:
Chris Johns 2022-04-26 10:13:41 +10:00
parent 4c3708f127
commit 70f302e08c

View File

@ -81,6 +81,8 @@
%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-major %(echo "%{gdb-python-ver-mm}" | sed -e 's/\..*//')
%define gdb-python-ver-minor %(echo "%{gdb-python-ver-mm}" | sed -e 's/.*\.//')
%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}.*
@ -109,7 +111,8 @@
%endif
%if %{gdb-python-config} != %{nil}
%define gdb-python-lib-filter awk 'BEGIN{FS=" "}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print "lib"substr($i,3)"*";}'
%if %{gdb-python-ver-mm} < 3.8
%if %{gdb-python-ver-major} < 3 || \
%{gdb-python-ver-major} == 3 && %{gdb-python-ver-minor} < 8
%define gdb-python-config-lib-check-flags --ldflags
%else
%define gdb-python-config-lib-check-flags --ldflags --embed