From 25abe03267ccafbab8f13c5240effc1db1aee431 Mon Sep 17 00:00:00 2001 From: Cary Haynie Date: Fri, 2 Jan 2015 12:50:47 -0500 Subject: [PATCH] move building via pkg-config to behind a feature. --- sdl2-sys/Cargo.toml | 6 ++++++ sdl2-sys/build.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sdl2-sys/Cargo.toml b/sdl2-sys/Cargo.toml index 918b806b..dc5d30a0 100644 --- a/sdl2-sys/Cargo.toml +++ b/sdl2-sys/Cargo.toml @@ -8,6 +8,12 @@ build = "build.rs" [lib] name = "sdl2-sys" +path = "src/lib.rs" [build-dependencies] pkg-config = "*" + +[features] + +default = [] +use-pkgconfig = [] diff --git a/sdl2-sys/build.rs b/sdl2-sys/build.rs index 14ee66ab..e521f5b0 100644 --- a/sdl2-sys/build.rs +++ b/sdl2-sys/build.rs @@ -1,8 +1,12 @@ extern crate "pkg-config" as pkg_config; fn main() { - if build_pkgconfig() { return; } - panic!("Could not find SDL2 via pkgconfig"); + if std::os::getenv("CARGO_FEATURE_USE_PKGCONFIG").is_some() { + if build_pkgconfig() { return; } + panic!("Could not find SDL2 via pkgconfig"); + } else { + println!("cargo:rustc-flags=-l SDL2"); + } } fn build_pkgconfig() -> bool {