aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/ConfigHeader.zig
AgeCommit message (Collapse)Author
2025-08-30rework std.Io.Writer.Allocating to support runtime-known alignmentAndrew Kelley
Also, breaking API changes to: * std.fs.Dir.readFileAlloc * std.fs.Dir.readFileAllocOptions
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-13std.io.Writer.Allocating: rename getWritten() to written()Isaac Freund
This "get" is useless noise and was copied from FixedBufferWriter. Since this API has not yet landed in a release, now is a good time to make the breaking change to fix this.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-07-17std.Build.Step.ConfigHeader: add the lazy file styled input as a dependencyTristan Ross
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-07std.io.Writer.Allocating: rename interface to writerAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-06-17std.Build: introduce `ConfigHeader.getOutputDir`, small refactormlugg
`std.Build.Step.ConfigHeader` emits a *directory* containing a config header under a given sub path, but there's no good way to actually access that directory as a `LazyPath` in the configure phase. This is silly; it's perfectly valid to refer to that directory, perhaps to explicitly pass as a "-I" flag to a different toolchain invoked via a `Step.Run`. So now, instead of the `GeneratedFile` being the actual *file*, it should be that *directory*, i.e. `cache/o/<digest>`. We can then easily get the *file* if needed just by using `LazyPath.path` to go "deeper", which there is a helper function for. The legacy `getOutput` function is now a deprecated alias for `getOutputFile`, and `getOutputDir` is introduced. `std.Build.Module.IncludeDir.appendZigProcessFlags` needed a fix after this change, so I took the opportunity to refactor it a little. I was looking at this function while working on ziglang/translate-c yesterday and realised it could be expressed much more simply -- particularly after the `ConfigHeader` change here. I had to update the test `standalone/cmakedefine/` -- it turns out this test was well and truly reaching into build system internals, and doing horrible not-really-allowed stuff like overriding the `makeFn` of a `TopLevelStep`. To top it all off, the test forgot to set `b.default_step` to its "test" step, so the test never even ran. I've refactored it to follow accepted practices and to actually, like, work.
2025-02-23std.Build.Step.ConfigHeader: follow deprecation policyAndrew Kelley
2025-02-23Merge pull request #22794 from cbilz/autoconf_atAndrew Kelley
std.Build.Step.ConfigHeader: Add support for Autoconf-style `@FOO@` variables
2025-02-22std.Build: Allow ConfigHeader values to be added at build.zig runtimeConstantin Bilz
2025-02-21std.Build.Step.ConfigHeader: Add tests for Autoconf `@FOO@` variablesConstantin Bilz
2025-02-21std.Build.Step.ConfigHeader: Add support for Autoconf `@FOO@` variablesConstantin Bilz
Add the new style `Style.autoconf_at`. Rename the existing `Style.autoconf` (which uses `#undef` directives) to `Style.autoconf_undef`.
2025-02-19std.Build.Step.ConfigHeader: permit inserting enum valuesTechatrix
2025-02-19std.Build.Step.ConfigHeader: skip trailing whitespace in autoconf headerTechatrix
2025-02-19std.Build.Step.ConfigHeader: allow using autoconf values multiple timesTechatrix
2025-02-10std.ArrayList: popOrNull() -> pop() [v2] (#22720)Meghan Denny
2025-01-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-14make zig compiler processes live across rebuildsAndrew Kelley
Changes the `make` function signature to take an options struct, which additionally includes `watch: bool`. I intentionally am not exposing this information to configure phase logic. Also adds global zig cache to the compiler cache prefixes. Closes #20600
2024-07-12make more build steps integrate with the watch systemAndrew Kelley
2024-06-08Report error on missing values for addConfigHeaderMrDmitry
2024-05-27update the codebase for the new std.Progress APIAndrew Kelley
2024-05-05Run: add output directory argumentsJacob Young
This allows running commands that take an output directory argument. The main thing that was needed for this feature was generated file subpaths, to allow access to the files in a generated directory. Additionally, a minor change was required to so that the correct directory is created for output directory args.
2024-05-05Build: cleanupJacob Young
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
2024-05-03Rename Dir.writeFile2 -> Dir.writeFile and update all callsitesRyan Liptak
writeFile was deprecated in favor of writeFile2 in f645022d16361865e24582d28f1e62312fbc73bb. This commit renames writeFile2 to writeFile and makes writeFile2 a compile error.
2024-04-15std.Build.Step.ConfigHeader: better error messagejd
2024-04-13std.Build.Step.ConfigHeader: better error messageAndrew Kelley
2024-04-10introduce std.Build.path; deprecate LazyPath.relativeAndrew Kelley
This adds the *std.Build owner to LazyPath so that lazy paths returned from a dependency can be used in the application without friction or footguns. closes #19313
2024-03-30Update uses of `@fieldParentPtr` to use RLSJacob Young
2024-03-30Update uses of `@fieldParentPtr` to pass a pointer typeJacob Young
2024-02-02std.Build: implement --host-target, --host-cpu, --host-dynamic-linkerAndrew Kelley
This also makes a long-overdue change of extracting common state from Build into a shared Graph object. Getting the semantics right for these flags turned out to be quite tricky. In the end it works like this: * The override only happens when the target is fully native, with no additional query parameters, such as versions or CPU features added. * The override affects the resolved Target but leaves the original Query unmodified. * The "is native?" detection logic operates on the original, unmodified query. This makes it possible to provide invalid host target information, causing confusing errors to occur. Don't do that. There are some minor breaking changes to std.Build API such as the fact that `b.zig_exe` is now moved to `b.graph.zig_exe`, as well as a handful of other similar flags.
2024-01-26Get rid of direct dependency on std.fmtMrDmitry
Replace unnecessary panic with step error
2024-01-26Minor formatting, removed duplicate test caseMrDmitry
2024-01-26Add escaped character processingMrDmitry
2024-01-26Rewrite replace_variables with CMake-specific versionMrDmitry
Behavior matches CMake's CMP0053 policy that is the current standard for variable expansion for `configure_file()`
2024-01-21Fix last_index after variable substitutionMrDmitry
Iterative passes should start at the end of the previous substitution
2024-01-04build/LazyPath: Add dirname (#18371)Abhinav Gupta
Adds a variant to the LazyPath union representing a parent directory of a generated path. ```zig const LazyPath = union(enum) { generated_dirname: struct { generated: *const GeneratedFile, up: usize, }, // ... } ``` These can be constructed with the new method: ```zig pub fn dirname(self: LazyPath) LazyPath ``` For the cases where the LazyPath is already known (`.path`, `.cwd_relative`, and `dependency`) this is evaluated right away. For dirnames of generated files and their dirnames, this is evaluated at getPath time. dirname calls can be chained, but for safety, they are not allowed to escape outside a root defined for each case: - path: This is relative to the build root, so dirname can't escape outside the build root. - generated: Can't escape the zig-cache. - cwd_relative: This can be a relative or absolute path. If relative, can't escape the current directory, and if absolute, can't go beyond root (/). - dependency: Can't escape the dependency's root directory. Testing: I've included a standalone case for many of the happy cases. I couldn't find an easy way to test the negatives, though, because tests cannot yet expect panics.
2024-01-01zig build system: change target, compilation, and module APIsAndrew Kelley
Introduce the concept of "target query" and "resolved target". A target query is what the user specifies, with some things left to default. A resolved target has the default things discovered and populated. In the future, std.zig.CrossTarget will be rename to std.Target.Query. Introduces `std.Build.resolveTargetQuery` to get from one to the other. The concept of `main_mod_path` is gone, no longer supported. You have to put the root source file at the module root now. * remove deprecated API * update build.zig for the breaking API changes in this branch * move std.Build.Step.Compile.BuildId to std.zig.BuildId * add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions, std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and std.Build.TestOptions. * remove `std.Build.constructCMacro`. There is no use for this API. * deprecate `std.Build.Step.Compile.defineCMacro`. Instead, `std.Build.Module.addCMacro` is provided. - remove `std.Build.Step.Compile.defineCMacroRaw`. * deprecate `std.Build.Step.Compile.linkFrameworkNeeded` - use `std.Build.Module.linkFramework` * deprecate `std.Build.Step.Compile.linkFrameworkWeak` - use `std.Build.Module.linkFramework` * move more logic into `std.Build.Module` * allow `target` and `optimize` to be `null` when creating a Module. Along with other fields, those unspecified options will be inherited from parent `Module` when inserted into an import table. * the `target` field of `addExecutable` is now required. pass `b.host` to get the host target.
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-10-16Build: fix some issues with ConfigHeader stepJacob Young
* include path was using bad default for dependency lazy paths * unhashed config options caused changes to not trigger a rebuild
2023-09-28std.Build.ConfigHeader: override include guard option for blank style (#17310)Luis Cáceres
This commit adds an option to allow for overriding the default header guard that is generated from the output file path.
2023-09-27Remove `@fabs`, fabs and absCast/Int from std libantlilja
Replaces occurences of @fabs absCast and absInt with new @abs builtin. Also removes the std.math.fabs alias from math.zig.
2023-08-20AstGen: add result location analysis passmlugg
The main motivation for this change is eliminating the `block_ptr` result location and corresponding `store_to_block_ptr` ZIR instruction. This is achieved through a simple pass over the AST before AstGen which determines, for AST nodes which have a choice on whether to provide a result location, which choice to make, based on whether the result pointer is consumed non-trivially. This eliminates so much logic from AstGen that we almost break even on line count! AstGen no longer has to worry about instruction rewriting based on whether or not a result location was consumed: it always knows what to do ahead of time, which simplifies a *lot* of logic. This also incidentally fixes a few random AstGen bugs related to result location handling, leading to the changes in `test/` and `lib/std/`. This opens the door to future RLS improvements by making them much easier to implement correctly, and fixes many bugs. Most ZIR is made more compact after this commit, mainly due to not having redundant `store_to_block_ptr` instructions lying around, but also due to a few bugs in the old system which are implicitly fixed here.
2023-08-10Build.ConfigHeader: render identifiersAli Chraghi
2023-07-30build system: follow-up enhancements regarding LazyPathAndrew Kelley
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685 * move overrideZigLibDir and setMainPkgPath to options fields set once and then never mutated. * avoid introducing Build/util.zig * use doc comments for deprecation notices so that they show up in generated documentation. * introduce InstallArtifact.Options, accept it as a parameter to addInstallArtifact, and move override_dest_dir into it. Instead of configuring the installation via Compile step, configure the installation via the InstallArtifact step. In retrospect this is obvious. * remove calls to pushInstalledFile in InstallArtifact. See #14943 * rewrite InstallArtifact to not incorrectly observe whether a Compile step has any generated outputs. InstallArtifact is meant to trigger output generation. * fix child process evaluation code handling of `-fno-emit-bin`. * don't store out_h_filename, out_ll_filename, etc., pointlessly. these are all just simple extensions appended to the root name. * make emit_directory optional. It's possible to have nothing outputted, for example, if you're just type-checking. * avoid passing -femit-foo/-fno-emit-foo when it is the default * rename ConfigHeader.getTemplate to getOutput * deprecate addOptionArtifact * update the random number seed of Options step caching. * avoid using `inline for` pointlessly * avoid using `override_Dest_dir` pointlessly * avoid emitting an executable pointlessly in test cases Removes forceBuild and forceEmit. Let's consider these additions separately. Nearly all of the usage sites were suspicious.
2023-07-30Build.zig rename orgy (aka: #16353). Renames FileSource to LazyPath and ↵Felix (xq) Queißner
removes functions that take literal paths instead of LazyPath.
2023-06-26std.Build: omit newline from last lineJan200101
2023-06-21std.Build: implement variable substitutionJan200101