Support out-of-tree builds

It has to be ugly because of https://github.com/mozilla/rust/issues/6746