Skip to content

Instantly share code, notes, and snippets.

@dcolish
Created June 24, 2013 14:31
Show Gist options
  • Save dcolish/5850461 to your computer and use it in GitHub Desktop.
Save dcolish/5850461 to your computer and use it in GitHub Desktop.
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