[PATCH] gdb-common: Fix the python-config library parsing

chrisj at rtems.org chrisj at rtems.org
Tue Apr 11 06:03:12 UTC 2023


From: Chris Johns <chrisj at rtems.org>

Closes #4894
---
 source-builder/config/gdb-common-1.cfg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source-builder/config/gdb-common-1.cfg b/source-builder/config/gdb-common-1.cfg
index a52e64d..0fea334 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -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
-- 
2.37.1



More information about the devel mailing list