From 8d4f1ef345a7c6009b392da15c4ec3e41bb853a0 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Mon, 11 Apr 2016 09:10:29 +0200 Subject: [PATCH] Building and using local libsodium library automatically --- .gitignore | 1 + CHANGELOG.md | 4 ++++ build.rs | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 062b61d..0f71c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ vpncloud-oldnodes ._* .~* deb/vpncloud/vpncloud* +Stats.ods diff --git a/CHANGELOG.md b/CHANGELOG.md index b78343f..95f05db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This project follows [semantic versioning](http://semver.org). +### Unreleased + +- [changed] Building and using local libsodium library automatically + ### v0.5.0 (2016-04-05) - [added] Added license and copyright information diff --git a/build.rs b/build.rs index 4aed808..db82d96 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,15 @@ extern crate gcc; extern crate pkg_config; +use std::process::Command; +use std::path::Path; + fn main() { - pkg_config::find_library("libsodium").unwrap(); + if ! Path::new("libsodium/src/libsodium/.libs/libsodium.a").exists() { + Command::new("sh").arg("autogen.sh").current_dir("libsodium").status().unwrap(); + Command::new("sh").arg("configure").current_dir("libsodium").status().unwrap(); + Command::new("make").current_dir("libsodium").status().unwrap(); + } gcc::Config::new().file("src/c/tuntap.c").include("src").compile("libtuntap.a"); + println!("cargo:rustc-link-search={}", "libsodium/src/libsodium/.libs"); }