Copied from #7911. There are a few other fixes needed for out-of-tree builds.
- RCC is particularly unhappy with separate paths, so we have a hackish copy in there right now. I'm sure there's a better way.
- We do some leveldb copying at the top-level make that should no longer be necessary.
- Travis and Gitian descriptors should be switched to out-of-tree rather than copying to subtree as they are now