$ cd ~/.local/src/
$ git clone git://github.com/libgit2/libgit2.git
$ cd libgit2
$ mkdir build && cd build
$ cmake ..
$ cmake --build .
If debugging, use the following cmake commands instead:
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ cmake --build .
$ sudo cmake --build . --target install
This will install libgit2 in /usr/local. In my case, libgit2's install command did not call ldconfig, so I had to do it manually:
$ sudo ldconfig
Confirm that libgit2 can be found:
$ ldconfig -p | grep libgit
This should output the paths to libgit2.so.0 and libgit2.so.
The pypi distribution of pygit2 should now work. So you can use easy_install or pip.
Some may prefer to use software such as GNU
stow
to allow for a relatively litter-free installation. In this case (assuming that you are stowing the install under/usr/local
):Change the line
to
and, after you've run the
--target install
command, doThis will create symlinks in
/usr/local/{include,lib}
linking into/usr/local/stow/libgit2
.I also had to run
sudo ldconfig
afterwards.