WIP: andrioni's Libgit2 work

I'm making this into a pull request for easier discussion and so that I can check it out more easily.

Edit: Hijacking to make a task list.

## Todo list
- [x] Check why Travis is failing to build, even though `libgit2.so` apparently is generated (lines 1303 and 1304).
- [x] Fix the Makefile to handle both sonames.
- [ ] Refactor to use immutable types
- [x] Ensure it builds on Windows with MinGW
- [ ] Update jakebolewski/LibGit2.jl#9 with the latest changes to LibGit2.jl
- [ ] Fix `Base.add!` undefined variable error
- [x] Fix `-stdlib=libc++ -mmacosx-version-min=10.7` flags getting added to `CC` on Mac, which Cmake doesn't like
- [ ] Make sure moving flags from `CC` to `JCFLAGS` works everywhere it needs to