Skip to content

Fix meson.build, add CI job to validate it - #670

Open
kolyshkin wants to merge 3 commits into
containers:mainfrom
kolyshkin:meson-ci-653
Open

Fix meson.build, add CI job to validate it#670
kolyshkin wants to merge 3 commits into
containers:mainfrom
kolyshkin:meson-ci-653

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Carrying #653.

The meson build is not covered by CI at all -- validate runs make fmt, coverage and integration build via the Makefile, and static builds via nix. Nothing invokes meson, so meson.build can silently rot between releases. That is how the deprecated run_command and meson.source_root() usages fixed in #653 accumulated in the first place.

This PR:

  1. Carries @acsezen's commit from meson: fix deprecation warnings #653 (meson: fix deprecation warnings) unchanged.
  2. Adds a meson-build job to the validate workflow, plus a /build/ entry in .gitignore so the meson build directory does not dirty local trees.
  3. Switches -Os, -Wall and -Werror from raw c_args to the corresponding meson built-in options, which silences the last three warnings and lets the CI job run with --fatal-meson-warnings. Future deprecations now fail the build instead of accumulating unnoticed.

The compiler flags are unchanged in effect. Before:

-Wall -Winvalid-pch -std=c99 -O0 -g -Os -Wall -Werror

After:

-Wall -Winvalid-pch -Werror -std=c99 -Os -g

The duplicate -Wall collapses (warning_level=1 already emitted one), and -O0 from the default debug buildtype disappears since it was being overridden by the trailing -Os anyway.

One deliberate behavior change worth reviewer attention: because these are now default_options, they become overridable -- -Doptimization=2 and -Dwerror=false are honored, whereas add_project_arguments forced them unconditionally. This is generally desirable for distro packaging, which often needs -Werror off to survive new compiler releases, but it is a real change rather than a pure refactor.

Verified locally from a clean clone with meson 1.11.2 and gcc 16.1.1: meson setup --fatal-meson-warnings build exits 0 with no warnings or notices, ninja links conmon under -Werror, and the binary reports the correct version and commit.

@packit-as-a-service

Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@kolyshkin kolyshkin changed the title ci: add a meson build job Fix meson.build, add CI job to validate it Aug 13, 2026
@kolyshkin
kolyshkin requested a review from jnovy August 13, 2026 23:11
acsezen and others added 3 commits August 14, 2026 14:32
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The meson build was not covered by CI at all -- all workflows build via
the Makefile or nix. As a result, meson.build can silently rot between
releases, which is how the deprecated run_command and source_root usages
accumulated in the first place.

Add a meson-build job to the validate workflow that configures and
builds with meson, so breakage is caught at PR time.

Note that --fatal-meson-warnings is deliberately not used, since it also
trips on the pre-existing "consider using the built-in optimization
level" style warnings for -Os/-Wall/-Werror, which are a separate issue.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Passing these as raw c_args makes meson emit three warnings:

  WARNING: Consider using the built-in optimization level instead of using "-Os".
  WARNING: Consider using the built-in warning_level option instead of using "-Wall".
  WARNING: Consider using the built-in werror option instead of using "-Werror".

Use the corresponding built-in options instead, which silences them and
lets the meson-build CI job enable --fatal-meson-warnings, so future
deprecations fail the build rather than accumulating unnoticed.

The resulting compiler flags are equivalent. Before:

  -Wall -Winvalid-pch -std=c99 -O0 -g -Os -Wall -Werror

After:

  -Wall -Winvalid-pch -Werror -std=c99 -Os -g

The duplicate -Wall collapses, since warning_level=1 already emitted one,
and -O0 (from the default debug buildtype) disappears as it was being
overridden by the trailing -Os regardless.

Note this makes the settings overridable: -Doptimization=2 or
-Dwerror=false are now honored, whereas add_project_arguments forced
them unconditionally. This is generally desirable for distro packaging,
which often needs -Werror disabled to survive new compiler releases.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin

Copy link
Copy Markdown
Collaborator Author

Rebased on top of just-merged #669

@jnovy jnovy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. All three commits are correct - deprecation fixes, CI job, and built-in option migration are well done.

One suggestion: meson.build has src/ctr_logging.c and src/ctr_logging.h listed twice in the executable() source list (pre-existing, not introduced by this PR). Meson silently deduplicates today, but since this PR adds --fatal-meson-warnings to CI, a future meson release that warns about duplicate sources would break the new job. Might be worth adding a 4th commit to deduplicate while you are already touching this file.

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.

3 participants