Implement infrastructure for the souped-up build command

This series of commits (based on https://github.com/rust-lang/cargo/pull/763) is an implementation of the recent [Cargo RFC](https://github.com/rust-lang/rfcs/blob/master/text/0403-cargo-build-command.md). This should implement all portions of the RFC, but there's a lot so an extra set of eyes would be nice!

I haven't added documentation for it all yet, but I would like to do so before landing (starting with https://github.com/rust-lang/cargo/pull/749). Otherwise I've been migrating all of the existing cargo dependencies away from the build command to a build script, and the progress can be seen with these repositories:

* https://github.com/alexcrichton/gcc-rs
* https://github.com/alexcrichton/pkg-config-rs
* https://github.com/alexcrichton/git2-rs/tree/build-cmd
* https://github.com/alexcrichton/openssl-sys
* https://github.com/alexcrichton/flate2-rs/tree/build-cmd
* https://github.com/alexcrichton/libz-sys
* https://github.com/alexcrichton/ssh2-rs/tree/build-cmd

I haven't quite gotten around to curl just yet, but it's next on my list!
Yes. It's mostly meant to prevent lots of other silent breakage such as accidentally linking in the library twice or linking in two versions of the library (which could possibly go quite wrong).