Skip to content

Commit

Permalink
Get rid of cfg_aliases build dependency
Browse files Browse the repository at this point in the history
As it turns out cfg_aliases does a borderline trivial thing, in that it
basically just checks an environment variable and emits one or two lines
of 'cargo:' directives. When a build system other than Cargo is used
that does not honor build scripts we end up having to craft similar
logic ourselves. In such an instance, all cfg_aliases does is obfuscate
what is really going on.
So we might as well just include the logic ourselves and get rid of the
build dependency, given that we have to do it in one shape or form
anyway.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Oct 30, 2024
1 parent 1a4e107 commit 89c73c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ codegen-units = 1
lto = false
codegen-units = 256

[build-dependencies]
cfg_aliases = "0.2.1"

[dependencies]
cpp_demangle = {version = "0.4", optional = true}
gimli = {version = "0.31", optional = true}
Expand Down
9 changes: 6 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use cfg_aliases::cfg_aliases;
use std::env;


fn main() {
cfg_aliases! {
linux: { any(target_os = "linux", target_os = "android") },
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_os == "linux" || target_os == "android" {
println!("cargo:rustc-cfg=linux");
}
println!("cargo:rustc-check-cfg=cfg(linux)");
}

0 comments on commit 89c73c2

Please sign in to comment.