Skip to content

Commit 955e1e4

Browse files
committed
Turn back to .cargo/config.toml
because of rust-lang/cargo#9554
1 parent 9b31449 commit 955e1e4

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

.cargo/config.toml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[target.x86_64-apple-darwin]
2+
rustflags = [ "-Clink-args=-rdynamic" ]
3+
4+
[target.aarch64-apple-darwin]
5+
rustflags = [ "-Clink-args=-rdynamic" ]
6+
7+
[target.x86_64-unknown-linux-gnu]
8+
rustflags = [ "-Clink-args=-rdynamic" ]
9+
10+
[target.i686-unknown-linux-gnu]
11+
rustflags = [ "-Clink-args=-rdynamic" ]
12+
13+
[target.x86_64-pc-windows-msvc]
14+
rustflags = [ "-Ctarget-feature=+crt-static" ]
15+
16+
[target.i686-pc-windows-msvc]
17+
rustflags = [ "-Clink-args=/SAFESEH:NO", "-Ctarget-feature=+crt-static" ]

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.3.1-alpha.0"
44
authors = ["patr0nus <dk4rest@gmail.com>"]
55
license = "MIT"
66
description = "Embedding Node.js in Rust"
7-
edition = "2021"
7+
edition = "2018"
88
keywords = [ "node", "nodejs", "js", "javascript", "embedding" ]
99
homepage = "https://github.com/patr0nus/rust-nodejs"
1010
repository = "https://github.com/patr0nus/rust-nodejs"
@@ -34,6 +34,6 @@ once_cell = "1"
3434
strum = { version = "0.20", features = [ "derive" ] }
3535

3636
[build-dependencies.attohttpc]
37-
version = "0.17"
37+
version = "0.18"
3838
default-features = false # No need for the compress feature
39-
features = [ "tls-rustls" ]
39+
features = [ "rustls" ]

build.rs

+3-15
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ fn main() -> anyhow::Result<()> {
109109
let arch = match env::var("CARGO_CFG_TARGET_ARCH")?.as_str() {
110110
"x86" => Ok(TargetArch::X86),
111111
"x86_64" => Ok(TargetArch::X64),
112-
other => Err(other.to_string())
112+
other => Err(other.to_string()),
113113
};
114114
if let Ok(TargetOS::Win32) = os {
115115
let target_env = env::var("CARGO_CFG_TARGET_ENV")?;
116-
if target_env != "msvc" { // Can't link to Nodejs under windows-gnu
116+
if target_env != "msvc" {
117+
// Can't link to Nodejs under windows-gnu
117118
anyhow::bail!("Unsupported Environment ABI: {}", target_env)
118119
}
119120
}
@@ -180,18 +181,5 @@ fn main() -> anyhow::Result<()> {
180181
println!("cargo:rustc-link-lib={}", lib_name);
181182
}
182183

183-
let link_args = match os {
184-
Ok(TargetOS::Darwin | TargetOS::Linux) => vec!["-rdynamic"],
185-
Ok(TargetOS::Win32) => match arch {
186-
Ok(TargetArch::X86) => vec!["/SAFESEH:NO"],
187-
_ => vec![]
188-
},
189-
_ => vec![]
190-
};
191-
192-
for link_arg in link_args {
193-
println!("cargo:rustc-link-arg={}", link_arg);
194-
}
195-
196184
Ok(())
197185
}

0 commit comments

Comments
 (0)