[patch] allow using standard ar from the build ini files instead of 'ar' string

aisha atammy.dpdk at bsd.ac
Mon Feb 28 16:54:28 CET 2022


Hi,

I've attached a patch, from Gentoo, which uses the *ar* binary passed to 
meson when available, instead of 'ar', which may not be available, for 
instance when cross compiling, or having multiple gcc versions present, 
like in Gentoo.

This should not have any regressions, as when the binary is not 
available it uses the same logic as the original.

Aisha

-------------- next part --------------
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 400b88f251..d886bfb1dc 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -24,15 +24,20 @@ binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
 # select library and object file format
 pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
 pmdinfogen = py3 + files('pmdinfogen.py')
+ar = ''
+if cc.get_id() == 'gcc' or host_machine.system() != 'windows'
+    ar = 'ar'
+else
+    ar = 'llvm-ar'
+endif
+ar_bin = find_program('ar', required: false)
+if ar_bin.found()
+    ar = ar_bin.full_path()
+endif
+pmdinfo += ar
 if host_machine.system() == 'windows'
-    if cc.get_id() == 'gcc'
-        pmdinfo += 'ar'
-    else
-        pmdinfo += 'llvm-ar'
-    endif
     pmdinfogen += 'coff'
 else
-    pmdinfo += 'ar'
     pmdinfogen += 'elf'
 endif
 
diff --git a/meson.build b/meson.build
index 937f6110c0..35650ab20d 100644
--- a/meson.build
+++ b/meson.build
@@ -12,7 +12,7 @@ project('DPDK', 'C',
             'default_library=static',
             'warning_level=2',
         ],
-        meson_version: '>= 0.49.2'
+        meson_version: '>= 0.55.0'
 )
 
 # check for developer mode


More information about the dev mailing list