@@ -50,12 +50,25 @@ http_archive(
50
50
],
51
51
)
52
52
53
- load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
53
+ load("@hermetic_cc_toolchain//toolchain:defs.bzl", host_zig_toolchain, zig_toolchains = "toolchains")
54
+
55
+ _COMMON_EXEC_PLATFORMS = [
56
+ ("linux", "amd64"),
57
+ ("linux", "arm64"),
58
+ ("windows", "amd64"),
59
+ ("macos", "arm64"),
60
+ ("macos", "amd64"),
61
+ ]
54
62
55
63
# Plain zig_toolchains() will pick reasonable defaults. See
56
64
# toolchain/defs.bzl:toolchains on how to change the Zig SDK version and
57
65
# download URL.
58
- zig_toolchains()
66
+ [zig_toolchains(
67
+ exec_arch = arch,
68
+ exec_os = os,
69
+ ) for os, arch in _COMMON_EXEC_PLATFORMS]
70
+
71
+ host_zig_toolchain()
59
72
```
60
73
61
74
And this to ` .bazelrc ` on a Unix-y systems:
@@ -256,7 +269,7 @@ To the list of libc aware toolchains and platforms:
256
269
```
257
270
$ bazel query @zig_sdk//libc_aware/toolchain/...
258
271
$ bazel query @zig_sdk//libc_aware/platform/...
259
- ```
272
+ ```
260
273
261
274
Libc-aware toolchains are especially useful when relying on
262
275
[ transitions] [ transitions ] , as transitioning ` extra_platforms ` will cause the
@@ -288,13 +301,13 @@ This is a guardrail.
288
301
Both Go and Bazel naming schemes are accepted. For convenience with
289
302
Go, the following Go-style toolchain aliases are created:
290
303
291
- | Bazel (zig) name | Go name |
292
- | ---------------- | -------- |
293
- | ` x86_64 ` | ` amd64 ` |
294
- | ` aarch64 ` | ` arm64 ` |
295
- | ` wasm32 ` | ` wasm ` |
296
- | ` macos ` | ` darwin ` |
297
- | ` wasi ` | ` wasip1 ` |
304
+ | Bazel (zig) name | Go name |
305
+ | ---------------- | -------- |
306
+ | ` x86_64 ` | ` amd64 ` |
307
+ | ` aarch64 ` | ` arm64 ` |
308
+ | ` wasm32 ` | ` wasm ` |
309
+ | ` macos ` | ` darwin ` |
310
+ | ` wasi ` | ` wasip1 ` |
298
311
299
312
For example, the toolchain ` linux_amd64_gnu.2.28 ` is aliased to
300
313
` x86_64-linux-gnu.2.28 ` . To find out which toolchains can be registered or
@@ -306,7 +319,7 @@ $ bazel query @zig_sdk//toolchain/...
306
319
307
320
## Incompatibilities with clang and gcc
308
321
309
- ` zig cc ` is * almost * a drop-in replacement for clang/gcc. This section lists
322
+ ` zig cc ` is _ almost _ a drop-in replacement for clang/gcc. This section lists
310
323
some of the discovered differences and ways to live with them.
311
324
312
325
### UBSAN and "SIGILL: Illegal Instruction"
@@ -379,9 +392,11 @@ $ docker run -e CC=/usr/bin/false -ti --rm -v "$PWD:/x" -w /x debian:bookworm-sl
379
392
# ./ci/release
380
393
# ./ci/zig-wrapper
381
394
```
395
+
382
396
## Communication
383
397
384
398
We maintain two channels for comms:
399
+
385
400
- Github issues and pull requests.
386
401
- Slack: ` #zig ` in bazelbuild.slack.com.
387
402
@@ -404,19 +419,19 @@ accessed like this:
404
419
405
420
Guidelines for maintainers[ ^ 2 ] :
406
421
407
- * Communicate intent precisely.
408
- * Edge cases matter.
409
- * Favor reading code over writing code.
410
- * Only one obvious way to do things.
411
- * Runtime crashes are better than bugs.
412
- * Compile errors are better than runtime crashes.
413
- * Incremental improvements.
414
- * Avoid local maximums.
415
- * Reduce the amount one must remember.
416
- * Focus on code rather than style.
417
- * Resource allocation may fail; resource deallocation must succeed.
418
- * Memory is a resource.
419
- * Together we serve the users.
422
+ - Communicate intent precisely.
423
+ - Edge cases matter.
424
+ - Favor reading code over writing code.
425
+ - Only one obvious way to do things.
426
+ - Runtime crashes are better than bugs.
427
+ - Compile errors are better than runtime crashes.
428
+ - Incremental improvements.
429
+ - Avoid local maximums.
430
+ - Reduce the amount one must remember.
431
+ - Focus on code rather than style.
432
+ - Resource allocation may fail; resource deallocation must succeed.
433
+ - Memory is a resource.
434
+ - Together we serve the users.
420
435
421
436
On a more practical note:
422
437
0 commit comments