gdb-common: Fix the python-config library parsing

Closes #4894
This commit is contained in:
Chris Johns
2023-04-11 05:59:40 +00:00
parent 024db7d143
commit 78913bcbba

View File

@@ -109,8 +109,8 @@
%define gdb-host-libs -L '%{host_ldflags}'
%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)"\\*";}'
%define gdb-python-libpath-filter awk 'BEGIN{FS=" "}/python/{for(i=1;i<NF;++i)if(match($i,".*L.*")) print substr($i,3);}'
%define gdb-python-lib-filter awk '{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print "lib"substr($i,3)"\\*";}'
%define gdb-python-libpath-filter awk '{for(i=1;i<NF;++i) if (match($i,"-L.*") == 1) l[substr($i,3)]=1;} END{for(i in l) printf("-L " i " "); printf("\n");}'
%if %{gdb-python-ver-major} < 3 || \
%{gdb-python-ver-major} == 3 && %{gdb-python-ver-minor} < 8
%define gdb-python-config-lib-check-flags --ldflags
@@ -119,7 +119,7 @@
%endif
%define gdb-python-config-libs %(%{gdb-python-config} %{gdb-python-config-lib-check-flags} | %{gdb-python-lib-filter})
%define gdb-python-config-libpath %(%{gdb-python-config} %{gdb-python-config-lib-check-flags} | %{gdb-python-libpath-filter} | uniq)
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} -L %{gdb-python-config-libpath} -l %{gdb-python-config-libs})
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} %{gdb-python-config-libpath} -l %{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