carthage 0.3.1 (new formula)

A work-in-progress for Carthage 0.4 when it is released. 

- [x] ~~Using my fork until my Makefile changes (or something similar) end up upstream.~~ Merged!
- [x] ~~Currently the test is failing. It shouldn't be so I'll need to look at that.~~ Fixed!
- [x] ~~`xctool` support will be removed from `master`~~ Merged!

Follows on from #34677. CC @robrix @Keithbsmiley.