nandi/jolt-nativepublic Fork 0
8cf1b3347ef6fa83297b6866dfd47d2728d4e339
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

BUCK · 97 lines · 4.4 KBPython Blame HistoryRaw
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago1load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
2load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
3load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain")
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago4load(":defs.bzl", "hermetic_rust_toolchain")
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago5
6# Tools come from the DotSlash files in scripts/, so the build depends on
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago7# pinned upstream releases rather than whatever the host happens to have.
8#
9# The paths are absolute, and read out of .buckconfig.local rather than written
10# here, because neither of the obvious spellings works. A build script runs in
11# a directory of its own, and the prelude re-execs the compiler from there, so
12# a project-relative `scripts/zcc` is not found; and the shim that does the
13# re-exec calls os.execl rather than os.execlp, so a bare `zcc` on PATH is not
14# found either. aws-lc-sys is where both show up. The `buck` recipe in justfile
15# writes that file, so the absolute paths are generated rather than committed.
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago16#
17# rustc does not come this way any more — see the toolchain at the bottom of
18# this file. These three are what is left to make into dependencies.
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago19_SCRIPTS = read_root_config("jolt", "scripts", "scripts")
20
21# The compiler's version, written by the `buck` recipe alongside the paths.
22#
23# It has to reach the actions somehow, because the prelude names rustc as the
24# bare string "rustc" — the binary is not an input, so its identity is not in
25# any action's cache digest. Two compilers therefore produce artifacts under
26# the same digest, and a shared cache will hand one build the other's rlibs;
27# the failure is E0514, a long way from the cause. Naming the version in a cfg
28# nothing reads is enough to keep the digests apart.
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago29# The C toolchain's version, written by the `buck` recipe alongside the paths.
30#
31# rustc no longer needs this: it is a dependency now, so its identity is in
32# every action's digest and two compilers cannot collide on one cache entry.
33# zig still does. It is named by an absolute path that does not change when the
34# binary behind it does, so a version bump would silently reuse entries built
35# by the old one — the E0514 failure, one toolchain over. Naming the version in
36# a cfg nothing reads keeps the digests apart until zig is a dependency too.
37_ZIG_VERSION = read_root_config("jolt", "zig_version", "unknown")
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago38#
39# This is the same arrangement .cargo/config.toml used to describe: zig cc
40# carries its own glibc sysroot, which is why this repo builds on a machine
41# with no `cc` at all. Unlike vidya there is no Android row here — both shared
42# objects this repo ships are desktop, and the APK takes its libvidya from
43# vidya's own buck2 build.
44system_cxx_toolchain(
45 name = "cxx",
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago46 # `ar` would otherwise come off the host, which is the one thing this
47 # toolchain is arranged not to do.
48 archiver = _SCRIPTS + "/zar",
49 compiler = _SCRIPTS + "/zcc",
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago50 compiler_type = "clang",
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago51 cxx_compiler = _SCRIPTS + "/zxx",
52 linker = _SCRIPTS + "/zcc",
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago53 visibility = ["PUBLIC"],
54)
55
56system_genrule_toolchain(
57 name = "genrule",
58 visibility = ["PUBLIC"],
59)
60
61system_python_bootstrap_toolchain(
62 name = "python_bootstrap",
63 visibility = ["PUBLIC"],
64)
65
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago66# The compiler is the dist tarball in toolchains//dist, not a name resolved
67# against the machine. See defs.bzl for why that distinction is the whole
68# point, and dist.bzl for where the tarball comes from.
69hermetic_rust_toolchain(
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago70 name = "rust",
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago71 dist = "toolchains//dist:rust",
72 wrapper = "toolchains//:rustc.sh",
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago73 default_edition = "2021",
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago74 rustc_flags = [
75 "-Clinker=" + _SCRIPTS + "/zcc",
76 # What [profile.release] in Cargo.toml says, and for the reason given
77 # there: the tree walk and the texture uploads are hot every frame, and
78 # the media plane decodes H.264. buck2 optimises nothing by default, so
79 # without this the two objects are debug builds wearing release names.
80 # OPT_LEVEL=2 in the buildscript fixups is the same setting for the C.
81 "-Copt-level=2",
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago82 "--cfg=jolt_cc=\"" + _ZIG_VERSION + "\"",
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago83 ],
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago84 # A plain string rather than a select: the sysroot path inside the dist
85 # tarball is built from this, and only the triples dist.bzl fetches an
86 # archive for can be named here.
87 rustc_target_triple = "x86_64-unknown-linux-gnu",
88 visibility = ["PUBLIC"],
89)
90
91# The wrapper the Rust toolchain runs rustc through, as an artifact so it is an
92# input to every action that compiles anything.
93export_file(
94 name = "rustc.sh",
95 mode = "reference",
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago96 visibility = ["PUBLIC"],
97)