Skip to content

Instantly share code, notes, and snippets.

@ball6847
Last active December 30, 2015 19:28
Show Gist options
  • Save ball6847/ed277120177bef695bde to your computer and use it in GitHub Desktop.
Save ball6847/ed277120177bef695bde to your computer and use it in GitHub Desktop.
#!/bin/bash
DEPS_ROOT=/root
# build tools
yum install gcc make gcc-c++ openssl-devel sqlite-devel readline-devel bzip2-devel tk-devel zlib-devel wget
# libgit2 need python2.7 to build
cd $DEPS_ROOT
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar zxvf Python-2.7.11.tgz
mkdir Python-2.7.11/build && cd Python-2.7.11/build
../configure
make && make altinstall
# pip + virtualenv
cd $DEPS_ROOT
wget -qO - https://bootstrap.pypa.io/get-pip.py --no-check-certificate | python2.7
pip2.7 install virtualenv
# install cmake
cd $DEPS_ROOT
wget https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz --no-check-certificate
tar zxvf cmake-3.4.1.tar.gz
mkdir -p /opt/cmake
mkdir cmake-3.4.1/build && cd cmake-3.4.1/build
../configure --prefix=/opt/cmake
make && make install
export PATH=/opt/cmake/bin:$PATH
# libssh2
cd $DEPS_ROOT
wget http://www.libssh2.org/download/libssh2-1.6.0.tar.gz
tar zxvf libssh2-1.6.0.tar.gz && cd libssh2-1.6.0
mkdir build && cd build
../configure --prefix=/usr --with-libssl-prefix=/usr/include --with-libz-prefix=/usr/include
make && make install
rm -f /etc/ld.so.cache && ldconfig
# libcurl
cd $DEPS_ROOT
wget http://curl.haxx.se/download/curl-7.46.0.tar.gz
tar zxvf curl-7.46.0.tar.gz && cd curl-7.46.0
mkdir build && cd build
../configure --prefix=/usr
make && make install
# libffi needed for python cffi
cd $DEPS_ROOT
wget ftp://sourceware.org/pub/libffi/libffi-3.2.tar.gz
tar zxvf libffi-3.2.tar.gz
cd libffi-3.2
mkdir build && cd build
../configure
make
make install
# by default libffi will be installed in /usr/local/lib64
# so we need to instruct LD_LIBRARY_PATH to where it installed
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
# libgit2
cd $DEPS_ROOT
wget https://github.com/libgit2/libgit2/archive/v0.23.4.tar.gz
tar zxvf v0.23.4
mkdir libgit2-0.23.4/build && cd libgit2-0.23.4/build
virtualenv .venv
source .venv/bin/activate
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
cmake .. -DBUILD_CLAR=Off
make && make install
deactivate
# test pygit2
cd $DEPS_ROOT
mkdir test_pygit2 && cd test_pygit2
virtualenv .venv && source .venv/bin/activate
pip install cffi
pip install pygit2
deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment