Skip to content

Instantly share code, notes, and snippets.

@ifduyue
Created May 28, 2014 05:28
Show Gist options
  • Save ifduyue/97c65197ebc3242f461d to your computer and use it in GitHub Desktop.
Save ifduyue/97c65197ebc3242f461d to your computer and use it in GitHub Desktop.
#!/bin/bash
# this will install everything as root, so take that into account before you run it
set -e
# need cmake, python development headers, ZLib and OpenSSL
sudo yum groupinstall "Development tools" -y
sudo yum install cmake zlib-devel openssl-devel http-parser-devel -y
root=`pwd`
git clone -b master --depth 1 git://github.com/libgit2/libgit2.git
cd libgit2
# instructions from http://libgit2.github.com/#install
mkdir build && cd build
cmake ..
cmake --build .
make
sudo make install
export LIBGIT2="/usr/local"
export LDFLAGS="-Wl,-rpath='$LIBGIT2/lib',--enable-new-dtags $LDFLAGS"
sudo -E pip install pygit2 -U
# avoid "cannot open shared object file" ImportErrors
sudo ldconfig
# clean up after ourselves
cd $root
rm -rf libgit2
# now, from the python interpreter:
# >>> from pygit2 import Repository
# if you don't get any errors, you're done!
python -c 'from pygit2 import Repository' && echo 'pygit2 installed.' || echo 'failed to install pytgit2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment