Skip to contentSkip to conversation

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

PATCH In review aisha 3 participants 4 messages Feb 28, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

aisha

author
#0 lore raw

PATCH 1/1 allow using standard ar from the build ini files instead of 'ar' string

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

buildtools/meson.build +11 -6
index 400b88f251..d886bfb1dc 100644
@@ -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
 
meson.build +1 -1
index 937f6110c0..35650ab20d 100644
@@ -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
#1 lore raw
Quoted 7 lines · On Mon, 28 Feb 2022 10:54:28 -0500 aisha <[email protected]> wrote:

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.

Quoted 5 lines

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

Aisha

Please resubmit this patch with proper Signed-off-by. Without Developer's Certificate of Origin there can be license claims.

#2 lore raw
In reply to aisha
Quoted 49 lines · aisha

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

buildtools/meson.build +11 -6
index 400b88f251..d886bfb1dc 100644
@@ -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
 
meson.build +0 -0
index 937f6110c0..35650ab20d 100644

meson.build project('DPDK', 'C', · line 16

Quoted 6 lines
meson.build +1 -1
@@ -12,7 +12,7 @@ project('DPDK', 'C',
             'default_library=static',
             'warning_level=2',
         ],
-        meson_version: '>= 0.49.2'
+        meson_version: '>= 0.55.0'
 )

I don't believe this should be part of this patch, as bumping the minimum meson version is not something we want to do just now.

/Bruce

#3 lore raw
In reply to aisha
Quoted 18 lines · aisha

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

buildtools/meson.build +0 -0
index 400b88f251..d886bfb1dc 100644

buildtools/meson.build binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + · line 28

Quoted 5 lines
buildtools/meson.build +2 -0
@@ -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'

This doesn't work correctly for FreeBSD, as we want to use llvm-ar by default there for clang builds. It should probably check explicitly for linux instead.

buildtools/meson.build binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + · line 36

Quoted 8 lines
buildtools/meson.build +8 -0
+    ar = 'ar'
+else
+    ar = 'llvm-ar'
+endif
+ar_bin = find_program('ar', required: false)
+if ar_bin.found()
+    ar = ar_bin.full_path()
+endif

This here looks wrong too. Even if clang is being used as a compiler and llvm-ar as a linker, this will still find the "ar" binary if present.

Quoted 26 lines
buildtools/meson.build +1 -6
+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
 
meson.build +1 -1
index 937f6110c0..35650ab20d 100644
@@ -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