Skip to content

build: fail on impossible options, and modernize the meson files - #4148

Merged
igaw merged 2 commits into
linux-nvme:masterfrom
martin-belanger:meson-require
Oct 10, 2026
Merged

igaw merged 2 commits into
linux-nvme:masterfrom
martin-belanger:meson-require

Conversation

@martin-belanger

Copy link
Copy Markdown
Collaborator

This PR fixes how the build handles options that cannot be built, and is also a cleanup of the meson files: it replaces older idioms with the ones meson provides today.

Fixes:

  • An option set to enabled was dropped without an error when its condition was false. Examples: -Dnvme-discoverd=enabled -Dfabrics=disabled, or -Dfabrics=enabled on FreeBSD. The setup now fails with a message that names the missing condition.
  • -Dnvmf-autoconnect=enabled -Dfabrics=disabled installed units that run nvme connect-all, which is not built without fabrics. This combination now fails too.
  • The command-metadata test checked that json-c was allowed, not that it was found.

Cleanup:

  • Option checks use feature.require() and feature.allowed() instead of hand-written if ... enabled() ... error() blocks. require() fails the setup for an enabled option and turns an auto option off.
  • A want_ variable now means a part of nvme-cli to build, and is set once, after all its checks. A library is tested through its dependency (_dep.found()).
  • join_paths() is replaced with the / operator. The install paths do not change.

Behavior change: fabrics, mi and top now default to auto instead of enabled. On Linux they are built as before. On FreeBSD and Windows, the default build still works, and an explicit enabled now fails instead of being ignored.

Tested with meson setup in 53 option combinations, compared with master. Only the impossible combinations above now fail. All other combinations give the same configuration summary as master.

Martin Belanger added 2 commits October 9, 2026 13:25
An option set to "enabled" was dropped without an error when its
condition was false, for example -Dnvme-discoverd=enabled with
-Dfabrics=disabled, or -Dfabrics=enabled on FreeBSD. In the other
direction, -Dnvmf-autoconnect=enabled with -Dfabrics=disabled
installed units that run "nvme connect-all", which is not built
without fabrics.

Use require(): it fails the setup for an enabled option and turns an
auto option off. fabrics, mi and top now default to auto, so the
default build still works on FreeBSD and Windows. On Linux, auto
builds them as before.

A want_ variable now means a part of nvme-cli to build, and is set
once, after all its checks. A library is tested through its
dependency. The command-metadata test now checks that json-c was
found, not only that it was allowed.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
The install paths do not change.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
@igaw
igaw merged commit 60ac7f6 into linux-nvme:master Oct 10, 2026
34 checks passed
@igaw

igaw commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Nice cleanup! Thanks!

@martin-belanger
martin-belanger deleted the meson-require branch October 10, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants