Add custom build file

This commit is contained in:
Guillem Castro 2021-02-14 23:24:59 +01:00
parent d9a8606221
commit 7e341f7a04
2 changed files with 16 additions and 0 deletions

View file

@ -3,6 +3,7 @@ name = "spotify-dl"
version = "0.1.0"
authors = ["Guillem Castro <guillemcastro4@gmail.com>"]
edition = "2018"
links = "FLAC"
[dependencies]
librespot = { path = "./librespot" }
@ -18,3 +19,6 @@ version = "0.2.0"
[package.metadata.deb]
depends="libflac-dev"
[build-dependencies]
pkg-config = "0.3.16"

12
build.rs Normal file
View file

@ -0,0 +1,12 @@
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let library = pkg_config::Config::new().probe("flac").unwrap();
let profile = env::var_os("PROFILE").unwrap();
let from = library.link_paths.get(0).unwrap().join("libFLAC.so");
let to = Path::new("target").join(profile).join("deps").join("libflac.so");
fs::copy(from, to).unwrap();
println!("cargo:rerun-if-changed=build.rs");
}