Last active
January 30, 2016 17:34
-
-
Save non7top/3a941bf07176374f0e20 to your computer and use it in GitHub Desktop.
Install local version of openssl/curl/python2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
source $HOME/local.env | |
PKGS_FILE=$LOCAL_PATH/.packages | |
install_openssl() { | |
VERSION="${1:-1.0.2d}" | |
cd $TMP | |
curl -O http://www.openssl.org/source/openssl-${VERSION}.tar.gz | |
tar xzf openssl-${VERSION}.tar.gz | |
cd openssl-${VERSION} | |
./config --prefix=$PREFIX shared | |
make -s install | |
} | |
install_curl() { | |
VERSION="${1:-7.44.0}" | |
cd $TMP | |
curl -O http://curl.haxx.se/download/curl-${VERSION}.tar.gz | |
tar xzf curl-${VERSION}.tar.gz | |
cd curl-${VERSION} | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./configure --silent --prefix=$PREFIX --with-ca-bundle=$PREFIX/ca-bundle.crt --with-ssl --with-zlib --with-libidn | |
make -s install | |
} | |
update_ca() { | |
curl -s -4 http://curl.haxx.se/ca/cacert.pem -o $PREFIX/ca-bundle.crt | |
} | |
install_python() { | |
VERSION="${1:-2.7.10}" | |
cd $TMP | |
pwd | |
curl -O https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz | |
tar xzf Python-$VERSION.tgz | |
cd Python-$VERSION | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./configure --silent --prefix=$PREFIX --enable-shared | |
make -s install | |
} | |
install_pip() { | |
cd $TMP | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python get-pip.py | |
} | |
install_libidn() { | |
VERSION="${1:-1.32}" | |
cd $TMP | |
curl -O http://ftp.gnu.org/gnu/libidn/libidn-${VERSION}.tar.gz | |
tar xzf libidn-${VERSION}.tar.gz | |
cd libidn-${VERSION} | |
./configure --silent --prefix=$PREFIX | |
make -s install | |
} | |
install_sqlite3() { | |
VERSION="${1:-3090000}" | |
cd $TMP | |
curl -O https://www.sqlite.org/2015/sqlite-autoconf-${VERSION}.tar.gz | |
tar xzf sqlite-autoconf-${VERSION}.tar.gz | |
cd sqlite-autoconf-${VERSION} | |
./configure --silent --prefix=$PREFIX | |
make -s install | |
} | |
install_swig() { | |
VERSION="${1:-3.0.4}" | |
cd $TMP | |
curl -L -O http://sourceforge.net/projects/swig/files/swig/swig-${VERSION}/swig-${VERSION}.tar.gz | |
tar xzf swig-${VERSION}.tar.gz | |
cd swig-${VERSION} | |
./configure --prefix=$PREFIX --enable-shared | |
make -s | |
make -s install | |
} | |
install_M2Crypto() { | |
VERSION="${1:-0.22.5}" | |
cd $TMP | |
curl -O https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-${VERSION}.tar.gz | |
tar xzf M2Crypto-${VERSION}.tar.gz | |
cd M2Crypto-${VERSION} | |
python setup.py build_ext --include-dirs=$LOCAL_PATH/include/ --swig=$LOCAL_PATH/bin/swig | |
python setup.py install --prefix=$PREFIX | |
} | |
install_zlib() { | |
VERSION="${1:-1.2.8}" | |
echo "$VERSION" | |
cd $TMP | |
curl -O http://zlib.net/zlib-${VERSION}.tar.gz | |
tar xzf zlib-${VERSION}.tar.gz | |
cd zlib-${VERSION} | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./configure --prefix=$PREFIX > configure.log-install_local | |
make -s install | |
} | |
install_pcre() { | |
VERSION="${1:-1.2.8}" | |
echo "$VERSION" | |
cd $TMP | |
curl -O ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${VERSION}.tar.gz | |
tar xf pcre-${VERSION}.tar.gz | |
cd pcre-${VERSION} | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./configure --prefix=$PREFIX --enable-utf | |
make -s install | |
} | |
install_notary() { | |
cd | |
git clone https://github.com/danwent/Perspectives-Server.git | |
} | |
__install() { | |
echo -n "Installing $1: " | |
if [ "$1" = "zlib" ]; then | |
install_zlib 1.2.8 | |
elif [ "$1" = "pcre" ]; then | |
install_pcre 8.38 | |
fi | |
} | |
TMP=$( mktemp -d) | |
if [ "$1" = "install_pip" ]; then | |
__install zlib | |
install_libidn 1.32 | |
install_openssl 1.0.2e | |
install_curl 7.45.0 | |
update_ca | |
install_python 2.7.10 | |
install_pip | |
elif [ "$1" = "install_misc" ]; then | |
install_sqlite3 3090000 | |
pip install sqlalchemy | |
pip install pysqlite | |
pip install cherrypy | |
__install pcre 8.38 | |
install_swig 3.0.4 | |
install_M2Crypto 0.22.3 | |
pip install --global-option=build_ext --global-option="-I$PREFIX/include" M2Crypto | |
elif [ "$1" = "install_notary" ]; then | |
install_notary | |
fi | |
echo ">> libidn version" | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig pkg-config --modversion libidn | |
echo ">> libzlib version" | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig pkg-config --modversion zlib | |
echo ">> sqlite3 version" | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig pkg-config --modversion sqlite3 | |
echo ">> OpenSSL version" | |
openssl version | |
echo ">> cURL version" | |
curl --version | |
echo ">>Python version" | |
echo "$( python --version 2>&1 | tr -d '\n\r' ) / $( python -c "import ssl;print ssl.OPENSSL_VERSION" )" | |
echo ">>> PiP version" | |
pip --version | |
echo | |
echo ">>> Python modules:" | |
echo ">>>> sqlalchemy: $( pip show sqlalchemy|grep ^Version )" | |
echo ">>>> pysqlite: $( pip show pysqlite|grep ^Version )" | |
python -c "from pysqlite2 import dbapi2 as _ ; print (_.__file__,_.sqlite_version,_.sqlite_version_info,_.version,_.version_info) " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH=$HOME/local | |
PATH=$LOCAL_PATH/bin:$PATH | |
export PATH | |
LIBDIR=$LIBDIR:$LOCAL_PATH/lib | |
export LIBDIR | |
export LDFLAGS="-L$LOCAL_PATH/lib" | |
export CFLAGS="-I$LOCAL_PATH/include" | |
export LD_LIBRARY_PATH=$LOCAL_PATH/lib | |
export PREFIX=$LOCAL_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment