Commit Graph

285 Commits

Author SHA1 Message Date
Carl Åstholm e636825f01 std.Build.Step.Fmt: dupe lazy path lists 2026-06-11 16:48:13 +02:00
Andrew Kelley b28460b499 Merge pull request 'Rename usages of all deprecated ArrayHashMapUnmanaged to array_hash_map' (#35470) from kada49/zig:array_hash_map_deprecation_rename into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35470
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-11 05:59:44 +02:00
David Senoner d23e22c416 Replace usages of StringArrayHashMapUnmanaged with array_hash_map.String 2026-06-10 16:14:53 +02:00
Ryan Liptak 1042cbe010 Build: fix tryFindProgram on Windows and reintroduce ref in test block
Also reduce the amount of unnecessary allocations, since one buffer can be used for appending all supported PATHEXT extensions

Fixes #35668
2026-06-07 23:27:01 -07:00
Ryan Liptak be07f95cd7 Configuration: fix loadBits/storeBits on big endian architectures
Fixes #35669
2026-06-07 23:27:00 -07:00
Alex Rønne Petersen 23f46bcd4d Partially revert "add missing param to mem.concat call"
This partially reverts commit af27e8d06f.

This broke two platforms:

* s390x-linux: It caused the `loadBits and storeBits` test to be analyzed and
  run, and that test looks to me to be bogus on big endian.
* x86_64-windows: `tryFindProgram` is not fallible, yet the Windows code uses
  `try`, so making it get analyzed exposed another compile error.

Reverting the analysis of `findProgram` for now to unbreak master and a number
of PRs, but we should still urgently fix both of these issues.
2026-06-07 18:37:18 +02:00
Kirk Scheibelhut af27e8d06f add missing param to mem.concat call
also ensure findProgram actually gets analyzed
2026-06-06 21:28:49 -07:00
mlugg 3f1dead2fc Merge pull request 'Use struct-of-arrays style for std.lang.Type' (#35234) from Der_Teufel/zig:soa-builtin-type into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35234
2026-05-28 09:45:54 +02:00
Techatrix ea044a4b82 std.Build: do not clobber properties of a package like named modules
Repeated calls to `addModule` with the same name will override the
module that is visible to dependants which is likely unintentional.
Instead it should assert that no existing module has already been added
with the given name.

The same issue applies to `addNamedWriteFiles` and `addNamedLazyPath`.
2026-05-27 18:54:08 +02:00
Krzysztof Wolicki 9e80795623 all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
pentuppup e4512531d5 fix some missed errors from build system rework 2026-05-27 02:18:25 +02:00
Sertonix 8455563ed8 Fix build script compilation when usize is u32
On 32-bit systems usize is not u64 but it was assumed in multiple places
of the build script.

Sometimes using u64 instead of usize since available and used memory can
exceed usize on 32-bit systems (just like totalSystemMemory)

Example errors:

lib/compiler/build_runner.zig:508:26: error: expected type 'usize', found 'u64'
        .available_rss = max_rss,
                         ^~~~~~~
lib/compiler/build_runner.zig:508:26: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
referenced by:
    callMain [inlined]: lib/std/start.zig:699:88
    callMainWithArgs [inlined]: lib/std/start.zig:638:20
    posixCallMainAndExit: lib/std/start.zig:590:38
    2 reference(s) hidden; use '-freference-trace=5' to see all references
lib/std/Build/WebServer.zig:849:38: error: expected type 'usize', found 'u64'
    const buf = gpa.realloc(old_buf, new_len) catch @panic("out of memory");
                                     ^~~~~~~
lib/std/Build/WebServer.zig:849:38: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
lib/std/mem/Allocator.zig:399:58: note: parameter type declared here
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(old_mem) {
                                                         ^~~~~
build.zig:548:10: error: type 'usize' cannot represent integer value '9300000000'
        .max_rss = 9_300_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
build.zig:778:10: error: type 'usize' cannot represent integer value '8000000000'
        .max_rss = 8_000_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
2026-05-26 09:43:39 -07:00
Andrew Kelley 19c63406d4 LazyPath: store relative paths as actual strings 2026-05-25 18:54:37 -07:00
Andrew Kelley 9eb85c4e5e build system: track TODOs outside source code
related to #363
2026-05-25 18:54:36 -07:00
Andrew Kelley 9a788dccf8 std.Build.lazyImport: fix compilation errors 2026-05-25 18:54:36 -07:00
Andrew Kelley 92038675af zig build: implement findProgram (not lazy) 2026-05-25 18:54:36 -07:00
Andrew Kelley 1edc5d7d67 Maker: implement FindProgram (lazy) 2026-05-25 18:54:36 -07:00
Andrew Kelley 54bb8d2dd9 implement the concept of configure cache poisoning 2026-05-25 18:54:36 -07:00
Andrew Kelley df92898ec3 Maker: fix packagePath function
Currently, neither configurer nor Maker is aware of the standard zig
package path, and the root path is stored as a bare string rather than
relative to a known base directory. Without changing that, we must
construct a cwd relative path here rather than using knowledge of the
standard package path plus package hash.

Also fixes a bug that would have been prevented by implementing the
accepted proposal https://github.com/ziglang/zig/issues/25315
2026-05-25 18:54:36 -07:00
Andrew Kelley 58f8dcd15e std.Build: improve documentation for UpdateSourceFiles step 2026-05-25 18:54:35 -07:00
Andrew Kelley eb80aa0060 std.Build.LazyPath.basename: fix impl
* no more parameters
* don't call getPath2, that was never valid to call in the configure
  phase...
2026-05-25 18:54:35 -07:00
Andrew Kelley bb1b59ee1f Maker: implement Step.InstallDir 2026-05-25 18:54:35 -07:00
Andrew Kelley 9709efce98 std.Build.Step.Run: introduce Arg.cc_args
provides a way for the build system to append -target and -isystem/-I
flags to a Run step.

needed by translate-c package to avoid doing naughty stuff in the
configure phase.
2026-05-25 18:54:35 -07:00
Andrew Kelley bd4c1e34d2 configurer: add search_prefixes back
It is generally best practice to avoid calling this function, instead
relying on the user to provide these paths via the standard build system
interface. However, when integrating with other build systems, the user
may have already provided the information to the other build system, and
thus it is desirable to use that same information without requiring the
user to provide it again.
2026-05-25 18:54:35 -07:00
Andrew Kelley ecba6324bf configurer: update TranslateC step
and get zig's build.zig script fully compiling
2026-05-25 18:54:35 -07:00
Andrew Kelley d3ec255a1f more progress towards zig's build.zig compiling 2026-05-25 18:54:35 -07:00
Andrew Kelley 1a83b4d8fa zig build: add zig_exe back to argv
trying to eliminate this can be a followup
2026-05-25 18:54:35 -07:00
Andrew Kelley 3d78589765 std.Build: port Fmt step to new system
and integrate properly with LazyPath
2026-05-25 18:54:35 -07:00
Andrew Kelley ddabd57743 progress towards compiling zig's build script 2026-05-25 18:54:35 -07:00
Andrew Kelley fa26566867 configurer: get InstallDir and Options steps compiling 2026-05-25 18:54:35 -07:00
Andrew Kelley 364a1400ff configurer: fix compilation in the presence of dependencies 2026-05-25 18:54:35 -07:00
Andrew Kelley ac0b1bfda2 build system: implement options
options which are passed to configurer and therefore observable by the
build script are added to the cache hash. A sorted list is hashed since
they are unordered.
2026-05-25 18:54:35 -07:00
Andrew Kelley aec708ce25 build system: remove unneeded args from configurer
not needed:
* zig exe path
* zig lib dir
* build root
* local cache root
* global cache root
2026-05-25 18:54:35 -07:00
Andrew Kelley 1dc82c1328 configurer: remove Cache 2026-05-25 18:54:35 -07:00
Andrew Kelley 1e956fda90 maker: add the --listen and --seed args back to run 2026-05-25 18:54:34 -07:00
Andrew Kelley 7c718fc72e fix compilation errors from rebase conflicts 2026-05-25 18:54:34 -07:00
Andrew Kelley e436d9c4ad configurer: back out the string interning from prev commit
partial revert of 2d3fbb687fba1ed52b42998ac4dcbf2a042644ea - see its
commit message for reasoning
2026-05-25 18:54:34 -07:00
Andrew Kelley c6d37f3895 configurer: make string duplication also intern
I had this idea to make b.dupe() also intern the strings since they will
be ultimately serialized to Configuration. Unfortunately the idea does
not work, because although a process-lived arena is used for the
string_bytes ArrayList of the Configuration.Wip, when the ArrayList is
resized, Allocator.free() memsets the freed memory to undefined, even
though it still technically lives due to being in a process-scoped
arena. So this commit will need to be partially reverted. However, I
kept it for posterity, and there are some more changes which I will now
note below.

- dupePaths: don't rewrite backslashes to forward slashes. backslashes
  are valid in filenames on non-windows systems.
- always compile configurer in single-threaded mode
- use arena allocator for everything, no gpa for anything
- construct the Configuration.Wip instance earlier, so some stuff can be
  prepopulated as desired.
- don't forget to flush
2026-05-25 18:54:34 -07:00
Andrew Kelley ec2b156720 std: rename zig.Configuration to Build.Configuration 2026-05-25 18:54:34 -07:00
Andrew Kelley 71ac3f15b3 build system: implement LazyPath
Number of generated files is recorded in serialized Configuration. Maker
preallocates array of generated files so that loads and stores can be
synchronization-free (protected by the dependency tree ordering).

More progress on Compile Step Zig CLI lowering.
2026-05-25 18:54:34 -07:00
Andrew Kelley 959103c3fd Maker.Step.Compile: progress towards lowering zig args 2026-05-25 18:54:34 -07:00
Andrew Kelley 6b7ce1fa22 massage Step code into compiling 2026-05-25 18:54:34 -07:00
Andrew Kelley afd7507a19 make runner: prepare steps for execution 2026-05-25 18:54:33 -07:00
Andrew Kelley 0505318efe make runner gets compiled and run
and --print-configuration prints some deserialized stuff
2026-05-25 18:54:33 -07:00
Andrew Kelley 83a3475887 configure runner: implement serialization of InstallArtifact 2026-05-25 18:54:33 -07:00
Andrew Kelley 2e88ac8842 zig build: configure runner basics implemented 2026-05-25 18:54:33 -07:00
Andrew Kelley 67a5b6e5e8 delete @cImport from the language
closes #20630
2026-04-15 17:43:53 -07:00
Alex Rønne Petersen d6f43caadf Merge pull request 'audit: handle process.Child.Term exhaustively and give useful exit information on process exit' (#31018) from murtaza/zig:child.term-audit into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31018
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-11 00:59:11 +02:00
Andrew Kelley c3a862522b std: remove managed array hash map variants
And deprecate all the API names except for:
* `std.array_hash_map.Auto`
* `std.array_hash_map.String`
* `std.array_hash_map.Custom`
2026-04-10 17:39:45 +02:00
murtaza 4a1383d987 process.Child: use std.posix.SIG instead of u32 for Child.Term stopped field 2026-04-07 10:27:21 +02:00