From 5ca02f2d165201de790c680e5a9cad11497704b2 Mon Sep 17 00:00:00 2001 From: Paul Colomiets Date: Thu, 6 Aug 2015 00:55:34 +0300 Subject: [PATCH] Add build script and LIBC_PATH environ variable This helps building binaries with alternate libc, in particular musl --- Cargo.toml | 3 +++ build.rs | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index e3ae0e8c16b2b..9c19649c851cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ A library for types and bindings to native C functions often found in libc or other common platform libraries. """ include = ["Cargo.toml", "rust/src/liblibc/*"] +build = "build.rs" [features] default = ["cargo-build"] @@ -21,3 +22,5 @@ cargo-build = [] [lib] name = "libc" path = "rust/src/liblibc/lib.rs" + + diff --git a/build.rs b/build.rs new file mode 100644 index 0000000000000..30eae27437528 --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +use std::env; + +fn main() { + if let Ok(path) = env::var("LIBC_PATH") { + println!("cargo:rustc-link-search={}", path); + } +}