-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
config.toml support [env] with [env.<cfg>] #10273
Comments
I guess cargo maintainers here possibly have little knowledge about V8 and Deno stuff. It would be great if you can provide more contexts, such like
This would help not only maintainers but other random contributors to come up with better ideas. 😁 |
eg: [env]
RUSTY_V8_ARCHIVE = { value = "assets/rusty_v8_mirror/v0.42.0/librusty_v8_release_aarch64-apple-darwin.a", relative = true }
[env.'cfg(target_os="android")']
RUSTY_V8_ARCHIVE = { value = "assets/rusty_v8_mirror/v0.42.0/librusty_v8_release_aarch64-linux-android.a", relative = true }
|
I have the same problem but with openssl crate. We use prebuilt versions on openssl libs and different platforms/architectures have different folders. So ideally I'd need something like this: [env.'cfg(target_os = "macos")']
OPENSSL_STATIC = "1"
OPENSSL_DIR = { value = "../PrecompiledLibs/MacOS/OpenSSL/openssl-1.1.1l/release", relative = true }
[env.'cfg(target = "aarch64-linux-android")']
OPENSSL_STATIC = "1"
OPENSSL_DIR = { value = "../PrecompiledLibs/Android/OpenSSL/openssl-1.1.1l/release", relative = true }
# etc for windows and so on |
Similar issue here using BoringSSL ... I wanted to set environment variables differently for each target platform. Details here: #11385 |
IMHO it would be much much better if we could just setup all these configs (including most of the cargo.toml) from the Because currently instead of "everything is rust" it is "everything is rust hidden behind toml and shell scripts" :( |
For configuring environment variables, it's available today in build script with |
@weihanglo, correct me if I'm wrong, but does it propagate to the libraries before their |
@weihanglo Not really. This does not propagate to dependencies, so you can not just define |
THank you all. That is absolutely the limitation of build script today. Configuration is the current way to deal with that. |
@weihanglo, you can't deal with that with configuration, because configuration doesn't accept |
Sorry for not being clear. I didn't mean Cargo already support the feature described in this issue. Let me summarize:
|
@weihanglo makes sense. Do we have a path forward on this then? |
Any update on this or a suggestion of where changes would need to be made to implement this functionality? |
As a workaround, I use a Makefile that defines the needed enivironment variables with the command. In my case, I need to choose which OpenCV libraries to link against.
|
Another workaround: Set the #!/bin/zsh
target_option_idx=${@[(Ie)--target]}
if [[ ${target_option_idx} -ne 0 ]]; then
target_value_idx=$((target_option_idx + 1))
target_value=$@[target_value_idx]
if [[ "${target_value}" = "<triple>" ]]; then
exec /usr/bin/env <TARGET_ENV_VAR>=<TARGET_ENV_VALUE> "$@"
fi
fi
exec /usr/bin/env "$@" |
Another use case where this would be useful:
It'd be nice to specify a target per [env] block so I can easily replace "x64-windows-static" with the current target in OPENCV_INCLUDE_PATHS and OPENCV_LINK_PATHS. This feature would be really useful because of the limitation of |
A workaround we have today: create |
To futher shorten the command you can have a default config with alias pointing to secondary config:
|
Problem
some build need arch assotiated targe environment var. like rusty_v8 RUSTY_V8_ARCHIVE, so it's usefull for [env] supporting multi arch.
Proposed Solution
No response
Notes
No response
The text was updated successfully, but these errors were encountered: