@@ -36,6 +36,8 @@ This section requires a mapping of Rust
3636[ ` OS ` strings] ( https://doc.rust-lang.org/std/env/consts/constant.OS.html ) to platform settings. The
3737following settings are available:
3838
39+ - ` arch ` - A mapping of custom values for the ` {arch} ` token, scoped to this platform.
40+ [ Learn more about platform overrides] ( #platform-overrides ) .
3941- ` archs ` - A list of architectures supported for this platform. If not provided, supports all
4042 archs.
4143- ` archive-prefix ` - If the tool is distributed as an archive (zip, tar, etc), this is the name of
@@ -48,6 +50,8 @@ following settings are available:
4850 not support checksum verification, this setting can be omitted.
4951- ` download-file ` (required) - Name of the file to download.
5052 [ Learn more about downloading] ( #downloading-and-installing ) .
53+ - ` libc ` - A mapping of custom values for the ` {libc} ` token, scoped to this platform.
54+ [ Learn more about platform overrides] ( #platform-overrides ) .
5155
5256<NonWasmTabs
5357 title = " protostar"
@@ -89,11 +93,13 @@ are available:
8993 <VersionLabel version = " 0.41.4" />
9094- ` {arch} ` - The architecture of the host machine, like ` x86_64 ` . These values map to Rust's
9195 [ ` ARCH ` constant] ( https://doc.rust-lang.org/std/env/consts/constant.ARCH.html ) , but can be
92- customized with [ ` install.arch ` ] ( #downloading-and-installing ) .
96+ customized with [ ` install.arch ` ] ( #downloading-and-installing ) or
97+ [ ` platform.<os>.arch ` ] ( #platform-overrides ) .
9398- ` {os} ` - The operating system of the host machine, like ` windows ` . These values map to Rust's
9499 [ ` OS ` constant] ( https://doc.rust-lang.org/std/env/consts/constant.OS.html ) .
95100- ` {libc} ` - For Linux machines, this is the current libc implementation, either ` gnu ` or ` musl ` .
96- <VersionLabel version = " 0.31.2" />
101+ Can be customized with [ ` install.libc ` ] ( #downloading-and-installing ) or
102+ [ ` platform.<os>.libc ` ] ( #platform-overrides ) . <VersionLabel version = " 0.31.2" />
97103
98104### Downloading and installing
99105
@@ -133,6 +139,42 @@ the values from the `[platform]` section.
133139 }}
134140/>
135141
142+ #### Platform overrides
143+
144+ The ` arch ` and ` libc ` mappings can also be defined per operating system with the
145+ ` [platform.<os>.arch] ` and ` [platform.<os>.libc] ` settings, which take precedence over the global
146+ ` [install.arch] ` and ` [install.libc] ` mappings. When replacing the ` {arch} ` and ` {libc} ` tokens,
147+ values are resolved in the following order: the platform-scoped mapping, the global mapping, and
148+ lastly the raw Rust constant.
149+
150+ This is useful if the tool uses different terminology per operating system. For example, buf
151+ publishes assets named ` buf-Linux-aarch64 ` but ` buf-Darwin-arm64 ` , which can be handled by renaming
152+ the token globally, and mapping it back to the raw value for Linux.
153+
154+ <NonWasmTabs
155+ title = " buf"
156+ data = { {
157+ install: {
158+ arch: {
159+ aarch64: ' arm64' ,
160+ },
161+ },
162+ platform: {
163+ linux: {
164+ arch: {
165+ aarch64: ' aarch64' ,
166+ },
167+ },
168+ },
169+ }}
170+ />
171+
172+ > A platform-scoped mapping shadows the global mapping even when a value maps to itself, as shown
173+ > above with ` aarch64 = "aarch64" ` for Linux.
174+
175+ Do not confuse these settings with ` archs ` , which restricts the architectures that a platform
176+ supports, while ` arch ` renames the value of the ` {arch} ` token.
177+
136178#### Executables
137179
138180The available executables (bins and shims) can be customized with the ` [install.exes] ` section,
0 commit comments