Skip to contentSkip to conversation

Minor meson build improvements

PATCH Applied Bruce Richardson 3 participants 6 messages Mar 10, 2023 – May 24, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Minor meson build improvements

While experimenting with "muon" [1] as a replacement for meson, the muon tool flagged a few issues that could do with being cleaned up in our meson.build files. While currently muon is not in a position to configure a DPDK build, it's not that far away from being able to do so, so may be worth keeping an eye on it future. (Most interestingly, it does contain a "muon fmt" tool for automatically formatting meson.build files).

Marking these as for next release as it's late in the 23.03 cycle as there is no point in taking a risk on these patches for such minor issues.

[1] https://github.com/annacrombie/muon

Bruce Richardson (2):
build: fix case of project language name
build: explicitly track fil paths in current directory

 app/test/meson.build              | 2 +-
 buildtools/pkg-config/meson.build | 2 +-
 meson.build                       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--
2.37.2

#1 lore raw

PATCH 1/2 build: fix case of project language name

According to the meson manual [1], the project language should be given as 'c', rather than 'C' in the initial "project" function call. While meson itself does not complain about this, the "muon" project, which attempts to re-implement meson in C, does complain.

/home/bruce/dpdk/meson.build:4:17: error 'C' is not a valid language
4 | project('DPDK', 'C',

                      ^

[1] https://mesonbuild.com/Reference-manual_functions.html#project

Fixes a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index f91d652bc5..992ca91e88 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-project('DPDK', 'C',
+project('DPDK', 'c',
         # Get version number from file.
         # Fallback to "more" for Windows compatibility.
         version: run_command(find_program('cat', 'more'),
Signature · 1 line
2.37.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 23.07 1/2] build: fix case of project language name

Quoted 7 lines · Bruce Richardson

According to the meson manual [1], the project language should be given as 'c', rather than 'C' in the initial "project" function call. While meson itself does not complain about this, the "muon" project, which attempts to re-implement meson in C, does complain.

/home/bruce/dpdk/meson.build:4:17: error 'C' is not a valid language
4 | project('DPDK', 'C',

Quoted 8 lines
                      ^

[1] https://mesonbuild.com/Reference-manual_functions.html#project

Fixes a25a650be5f0 ("build: add infrastructure for meson and ninja builds")

---

#3 lore raw

PATCH 2/2 build: explicitly track file paths in current directory

In reply to Bruce Richardson

To ensure proper path tracking for files being used by the build, the "files()" function should always be used. While meson currently assumes that bare filenames passed to commands refer to paths in the current directory, other reimplementations of meson, e.g. muon, require the paths to be properly tracked. Therefore, for resiliency, ensure all paths are specified using "files()".

---
 app/test/meson.build              | 2 +-
 buildtools/pkg-config/meson.build | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
app/test/meson.build +1 -1
index 2db5ccf4ff..94233fafca 100644
@@ -470,7 +470,7 @@ dpdk_test = executable('dpdk-test',
              driver_install_path),
         install: true)
 
-has_hugepage = run_command(py3, 'has_hugepage.py', check: true).stdout().strip() != '0'
+has_hugepage = run_command(py3, files('has_hugepage.py'), check: true).stdout().strip() != '0'
 message('hugepage availability: @0@'.format(has_hugepage))
 
 # some perf tests (eg: memcpy perf autotest)take very long
buildtools/pkg-config/meson.build +1 -1
index 0412883c8f..b36add17e3 100644
@@ -56,4 +56,4 @@ This is required for a number of static inline functions in the public headers.'
 
 # For static linking with dependencies as shared libraries,
 # the internal static libraries must be flagged explicitly.
-run_command(py3, 'set-static-linker-flags.py', check: true)
+run_command(py3, files('set-static-linker-flags.py'), check: true)

--
2.37.2

Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 23.07 2/2] build: explicitly track file paths in current directory

Quoted 8 lines · Bruce Richardson

To ensure proper path tracking for files being used by the build, the "files()" function should always be used. While meson currently assumes that bare filenames passed to commands refer to paths in the current directory, other reimplementations of meson, e.g. muon, require the paths to be properly tracked. Therefore, for resiliency, ensure all paths are specified using "files()".

#5 lore raw
In reply to Bruce Richardson

10/03/2023 12:11, Bruce Richardson:

Quoted 12 lines

While experimenting with "muon" [1] as a replacement for meson, the muon tool flagged a few issues that could do with being cleaned up in our meson.build files. While currently muon is not in a position to configure a DPDK build, it's not that far away from being able to do so, so may be worth keeping an eye on it future. (Most interestingly, it does contain a "muon fmt" tool for automatically formatting meson.build files).

Marking these as for next release as it's late in the 23.03 cycle as there is no point in taking a risk on these patches for such minor issues.

Quoted 5 lines

[1] https://github.com/annacrombie/muon

Bruce Richardson (2):
build: fix case of project language name
build: explicitly track fil paths in current directory

Applied, thanks.