Skip to content

feat(prost-build): support host specific PROTOC environment variable - #1456

Open
ChrisJr404 wants to merge 1 commit into
tokio-rs:masterfrom
ChrisJr404:host-protoc-env
Open

feat(prost-build): support host specific PROTOC environment variable#1456
ChrisJr404 wants to merge 1 commit into
tokio-rs:masterfrom
ChrisJr404:host-protoc-env

Conversation

@ChrisJr404

Copy link
Copy Markdown

Closes #1083.

When you build on more than one host you currently have to symlink the right protoc into a fixed path so that a single PROTOC in .cargo/config.toml works everywhere. This adds an optional <HOST>_PROTOC variable that takes precedence over PROTOC, where the prefix is the host target triple uppercased with - and . turned into _ (so X86_64_UNKNOWN_LINUX_GNU_PROTOC on an x86_64 linux host). That matches the naming openssl-sys uses, and the HOST value comes straight from the variable Cargo sets for build scripts.

If the host specific variable is not set, or HOST is not present, nothing changes: it falls back to PROTOC and then to looking up protoc on the PATH.

I documented it in the "Sourcing protoc" section and added a small test for the variable name derivation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support arch-os-prefixed PROTOC in prost_build (e.g: AARCH64_LINUX_PROTOC)

1 participant