Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing custom environment variables, build deps and data deps to build scripts #287

Open
sitaktif opened this issue Nov 9, 2020 · 2 comments

Comments

@sitaktif
Copy link
Contributor

sitaktif commented Nov 9, 2020

Sometimes, crate build scripts need additional environment variables or addition build/data dependencies to run correctly in a given bazel repository.

For example, to use a custom-built openssl, one might want to pass the following to the cargo_build_script rule of a crate:

build_script_env = {
        "OPENSSL_DIR": "../openssl/openssl",
    },
    data = [...] + [
        "@openssl",  # Custom openssl.
    ],

We would need a way for the user to express these build script requirements, probably in the Cargo.toml file.

@palfrey
Copy link

palfrey commented Feb 28, 2021

actix_web needs this to exclude the tests/test space.binary from the default glob for data

@jgao54
Copy link

jgao54 commented Mar 23, 2022

Encountered a similar issue where jemalloc-sys 0.3.2's build script expect cargo's NUM_JOBS.

Ended up working around the issue by setting the env var in bazelrc
build --action_env=NUM_JOBS=<num_jobs>

It would be preferable to be able to set build_script_env for specified crates, similar to additional_env.

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

No branches or pull requests

3 participants