| Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago | 1 | load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain") |
| 2 | load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain") |
| 3 | load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain") |
| 4 | load("@prelude//toolchains:rust.bzl", "system_rust_toolchain") |
| 5 | |
| 6 | # Tools come from the DotSlash files in scripts/, so the build depends on |
| 7 | # pinned upstream releases rather than whatever the host happens to have. The |
| 8 | # prelude's system toolchains resolve their tools through PATH, so buck2 must |
| 9 | # be invoked with scripts/ prepended — see the `buck` recipe in justfile. |
| 10 | # |
| 11 | # This is the same arrangement .cargo/config.toml used to describe: zig cc |
| 12 | # carries its own glibc sysroot, which is why this repo builds on a machine |
| 13 | # with no `cc` at all. Unlike vidya there is no Android row here — both shared |
| 14 | # objects this repo ships are desktop, and the APK takes its libvidya from |
| 15 | # vidya's own buck2 build. |
| 16 | system_cxx_toolchain( |
| 17 | name = "cxx", |
| 18 | compiler = "scripts/zcc", |
| 19 | compiler_type = "clang", |
| 20 | cxx_compiler = "scripts/zxx", |
| 21 | linker = "scripts/zcc", |
| 22 | visibility = ["PUBLIC"], |
| 23 | ) |
| 24 | |
| 25 | system_genrule_toolchain( |
| 26 | name = "genrule", |
| 27 | visibility = ["PUBLIC"], |
| 28 | ) |
| 29 | |
| 30 | system_python_bootstrap_toolchain( |
| 31 | name = "python_bootstrap", |
| 32 | visibility = ["PUBLIC"], |
| 33 | ) |
| 34 | |
| 35 | system_rust_toolchain( |
| 36 | name = "rust", |
| 37 | default_edition = "2021", |
| 38 | rustc_flags = ["-Clinker=scripts/zcc"], |
| 39 | rustc_target_triple = select({ |
| 40 | "prelude//os:linux": select({ |
| 41 | "prelude//cpu:arm64": "aarch64-unknown-linux-gnu", |
| 42 | "prelude//cpu:x86_64": "x86_64-unknown-linux-gnu", |
| 43 | }), |
| 44 | "prelude//os:macos": select({ |
| 45 | "prelude//cpu:arm64": "aarch64-apple-darwin", |
| 46 | "prelude//cpu:x86_64": "x86_64-apple-darwin", |
| 47 | }), |
| 48 | }), |
| 49 | visibility = ["PUBLIC"], |
| 50 | ) |