Created
June 24, 2013 14:31
-
-
Save dcolish/5850461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::prelude::*; | |
use std::run; | |
use std::os; | |
fn main() { | |
compile(os::args()[0]) | |
} | |
fn compile(s : &str) -> () { | |
let path = PosixPath(s).dir_path().normalize(); | |
debug!("%s", path.to_str()); | |
os::change_dir(&path); | |
println(os::getcwd().to_str()); | |
let srcPath = os::make_absolute(&PosixPath("../../src/rust-http-client")); | |
println(srcPath.to_str()); | |
run::process_status(srcPath.push("configure").to_str(), []); | |
let lib = PosixPath("libhttp_parser.a"); | |
run::process_status("make", [lib.to_str()]); | |
let dest = &os::make_absolute(&lib); | |
let src = &srcPath.push(lib.to_str()); | |
println(src.to_str()); | |
println(dest.to_str()); | |
println("here"); | |
if os::copy_file(src, dest) { | |
run::process_status("rustc", [srcPath.push("lib.rs").to_str(), | |
~"--lib", ~"-o", | |
os::getcwd().to_str()]); | |
} else { | |
println("Could not copy libhttp_parser.a") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment