From ae55cad0b0ad67533fb40378607144fc09c9f161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Thu, 13 Aug 2020 22:44:56 +0200 Subject: [PATCH] Allow linking to system ntdll (#4) * Allow linking to system ntdll * Use imported `var` --- build.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index ecc3726..bbd46f5 100644 --- a/build.rs +++ b/build.rs @@ -1,9 +1,15 @@ +use std::env::var; + fn main() { #[cfg(feature = "user")] { - if std::env::var("TARGET").map( + if var("TARGET").map( |t| t == "x86_64-pc-windows-gnu" || t == "i686-pc-windows-gnu" ).unwrap_or(false) { - println!("cargo:rustc-link-lib=winapi_ntdll"); + if var("WINAPI_NO_BUNDLED_LIBRARIES").is_ok() { + println!("cargo:rustc-link-lib=ntdll"); + } else { + println!("cargo:rustc-link-lib=winapi_ntdll"); + } } } }