rustpkg: Change this example to show how to do a custom build

This commit is contained in:
Tim Chevalier 2013-04-17 18:58:41 -07:00
parent 35f3b6324f
commit a2761ac7b5

View File

@ -8,10 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::run;
pub fn main() {
let cwd = os::getcwd();
debug!("cwd = %s", cwd.to_str());
let file = io::file_writer(&Path(~"fancy-lib/build/generated.rs"),
[io::Create]).get();
file.write_str("pub fn wheeeee() { for [1, 2, 3].each() |_| { assert!(true); } }");
// now compile the crate itself
run::run_program("rustc", ~[~"fancy-lib/fancy-lib.rs", ~"--lib",
~"-o", ~"fancy-lib/build/fancy_lib"]);
}