Skip to content

Conversation

@cbilz
Copy link
Contributor

@cbilz cbilz commented Feb 6, 2025

The current public interface of std.Build.Step.ConfigHeader only allows configuration values to be added at comptime using addValues(). This pull request adds a new public functon addValue that enables configuration values to be added during build graph construction, i.e. while the build() function runs.

This change allows values to be determined by checks that cannot be performed at comptime, such as inspection of system features or build dependencies.

cbilz added a commit to cbilz/gnu-m4-zig that referenced this pull request Feb 9, 2025
There were a few configuration value conflicts between `config.h` and
the Gnulib headers, so it made sense to draw their values from different
pools.

The Gnulib headers use `@FOO@`-style substitution hooks. So far, we used
`ConfigHeader.Style.cmake` to configure these, but this fails for
`unistd.h`, see ziglang/zig#22794.

Further, we add a function that allows build-time configuration of
`ConfigHeader` values, see ziglang/zig#22795.
This is more convenient and should improve overall build times as
comptime is still relatively slow.

We use a modified version of `ConfigHeader` until these pull requests
are merged.
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

Good, thank you

@andrewrk andrewrk added zig build system std.Build, the build runner, `zig build` subcommand, package management release notes This PR should be mentioned in the release notes. labels Feb 23, 2025
@andrewrk andrewrk force-pushed the configheader_runtime_values branch from 87f6ddc to eae7cb1 Compare February 23, 2025 04:28
@andrewrk andrewrk merged commit 75b0538 into ziglang:master Feb 23, 2025
0 of 9 checks passed
@cbilz cbilz deleted the configheader_runtime_values branch February 23, 2025 16:06
cbilz added a commit to cbilz/gnu-m4-zig that referenced this pull request Feb 26, 2025
cbilz added a commit to cbilz/gnu-m4-zig that referenced this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes This PR should be mentioned in the release notes. zig build system std.Build, the build runner, `zig build` subcommand, package management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants