buildtools: get static mlx dependencies for meson
[dpdk.git] / buildtools / options-ibverbs-static.sh
index 0f285a3..0740a71 100755 (executable)
@@ -9,6 +9,13 @@
 #
 # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed.
 
-pkg-config --libs-only-l --static libibverbs |
+lib='libibverbs'
+deps='pthread|nl'
+
+pkg-config --libs --static $lib |
        tr '[:space:]' '\n' |
-       sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,'
+       sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," |   # explicit .a
+       sed -n '/^-[Ll]/p' |   # extra link options may break with make
+       tac |
+       awk "/^-l:$lib.a/&&c++ {next} 1" | # drop first duplicates of main lib
+       tac