Document how to build libgit2 from source

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2020-12-09 16:49:28 +01:00
parent 2dd77724fc
commit 88c76c50a3
1 changed files with 19 additions and 0 deletions

View File

@ -43,6 +43,25 @@ brew install libgit2
pacman -S libgit2
```
**Building from source**
1. Ensure [`cmake`](https://cmake.org) is available on your system.
1. Download and unarchive [the right `libgit2` version](https://github.com/libgit2/git2go#which-go-version-to-use)
for our current `git2go` dependency:
```console
$ LIBGIT2_VER=1.1.0
$ curl -L https://github.com/libgit2/libgit2/releases/download/v$LIBGIT2_VER/libgit2-$LIBGIT2_VER.tar.gz -o /tmp/libgit2.tar.gz
$ tar -xvf /tmp/libgit2.tar.gz -C /tmp/libgit2-$LIBGIT2_VER
```
1. Build and install the library on your system:
```console
$ mkdir /tmp/libgit2-$LIBGIT2_VER/build && cd /tmp/libgit2-$LIBGIT2_VER/build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ sudo cmake --build . --target install
```
### How to run the test suite
You can run the unit tests by simply doing