Advertisement
Guest User

Untitled

a guest
Sep 11th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 1.13 KB | None | 0 0
  1.  
  2. use std::process::Command;
  3. use std::env;
  4. use std::path::Path;
  5.  
  6. fn main() {
  7.     let out_dir = env::var("OUT_DIR").unwrap();
  8.  
  9.     println!("Extracting FFMPEG");
  10.     assert!(Command::new("tar")
  11.         .args(&["-xvjf", "./ffmpeg-2.7.2.tar.bz2"])
  12.         .current_dir("./dep")
  13.         .status()
  14.         .unwrap()
  15.         .success());
  16.  
  17.     let ffmpeg_root = Path::new("./dep/ffmpeg-2.7.2");
  18.     assert!(env::set_current_dir(&ffmpeg_root).is_ok());
  19.  
  20.     let p = env::current_dir().unwrap();
  21.     println!("The current directory is {}", p.display());
  22.  
  23.     println!("Configuring FFMPEG");
  24.     assert!(Command::new("sh")
  25.       .arg("./configure")
  26.       .arg("--prefix=../../build")
  27.       .arg("--disable-programs")
  28.       .status()
  29.       .unwrap()
  30.       .success());
  31.  
  32.     println!("Compiling FFMPEG");
  33.     assert!(Command::new("make")
  34.       .args(&["-R", &format!("-j{}", env::var("NUM_JOBS").unwrap())])
  35.       .status()
  36.       .unwrap()
  37.       .success());
  38.  
  39.     assert!(Command::new("make")
  40.       .arg("install")
  41.       .status()
  42.       .unwrap()
  43.       .success());
  44.  
  45.     println!("cargo:rustc-link-search=native={}", out_dir);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement