Go back to compiling OpenSSL/Python on Mac

This commit is contained in:
Jay Lee
2020-03-25 11:16:01 -04:00
parent 65bbe9ffe4
commit ee92a56ba9

View File

@@ -10,71 +10,114 @@ export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
cd ~ cd ~
if [ ! -f python-$BUILD_PYTHON_VERSION-macosx10.9.pkg ]; then #if [ ! -f python-$MIN_PYTHON_VERSION-macosx10.9.pkg ]; then
wget --quiet https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/python-$BUILD_PYTHON_VERSION-macosx10.9.pkg # wget --quiet https://www.python.org/ftp/python/$MIN_PYTHON_VERSION/python-$MIN_PYTHON_VERSION-macosx10.9.pkg
fi #fi
sudo installer -pkg python-$BUILD_PYTHON_VERSION-macosx10.9.pkg -target / #sudo installer -pkg python-$MIN_PYTHON_VERSION-macosx10.9.pkg -target /
brew install openssl@1.1 #brew install openssl@1.1
#brew upgrade python #brew upgrade python
export python=python3 #export python=python3
export pip=pip3 #export pip=pip3
echo "Python location:" #echo "Python location:"
which $python #which $python
# Compile latest OpenSSL # Compile latest OpenSSL
#if [ ! -d openssl-$BUILD_OPENSSL_VERSION ]; then if [ ! -d openssl-$BUILD_OPENSSL_VERSION ]; then
# wget --quiet https://www.openssl.org/source/openssl-$BUILD_OPENSSL_VERSION.tar.gz wget --quiet https://www.openssl.org/source/openssl-$BUILD_OPENSSL_VERSION.tar.gz
# echo "Extracting OpenSSL..." echo "Extracting OpenSSL..."
# tar xf openssl-$BUILD_OPENSSL_VERSION.tar.gz tar xf openssl-$BUILD_OPENSSL_VERSION.tar.gz
#fi fi
#cd openssl-$BUILD_OPENSSL_VERSION cd openssl-$BUILD_OPENSSL_VERSION
#echo "Compiling OpenSSL $BUILD_OPENSSL_VERSION..." echo "Compiling OpenSSL $BUILD_OPENSSL_VERSION..."
#./config shared --prefix=$mypath/ssl ./config shared --prefix=$mypath/ssl
#echo "Running make for OpenSSL..." echo "Running make for OpenSSL..."
#make -j$cpucount -s make -j$cpucount -s
#echo "Running make install for OpenSSL..." echo "Running make install for OpenSSL..."
#make install > /dev/null make install > /dev/null
#export LD_LIBRARY_PATH=~/ssl/lib export LD_LIBRARY_PATH=~/ssl/lib
#cd ~ cd ~
# Compile latest Python export LD_LIBRARY_PATH=~/ssl/lib:~/python/lib
#if [ ! -d Python-$BUILD_PYTHON_VERSION ]; then export openssl=~/ssl/bin/openssl
# wget --quiet https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/Python-$BUILD_PYTHON_VERSION.tar.xz export python=~/python/bin/python3
# echo "Extracting Python..." export pip=~/python/bin/pip3
# tar xf Python-$BUILD_PYTHON_VERSION.tar.xz cpucount=$(nproc --all)
#fi echo "This device has $cpucount CPUs for compiling..."
#cd Python-$BUILD_PYTHON_VERSION SSLVER=$($openssl version)
#echo "Compiling Python $BUILD_PYTHON_VERSION..." SSLRESULT=$?
#safe_flags="--with-openssl=$mypath/ssl --enable-shared --prefix=$mypath/python --with-ensurepip=upgrade" PYVER=$($python -V)
#unsafe_flags="--enable-optimizations --with-lto" PYRESULT=$?
#if [ ! -e Makefile ]; then if [ $SSLRESULT -ne 0 ] || [[ "$SSLVER" != "OpenSSL $BUILD_OPENSSL_VERSION "* ]] || [ $PYRESULT -ne 0 ] || [[ "$PYVER" != "Python $BUILD_PYTHON_VERSION"* ]]; then
# ./configure $safe_flags $unsafe_flags > /dev/null echo "SSL Result: $SSLRESULT - SSL Ver: $SSLVER - Py Result: $PYRESULT - Py Ver: $PYVER"
#fi if [ $SSLRESULT -ne 0 ]; then
#make -j$cpucount -s echo "sslresult -ne 0"
#RESULT=$? fi
#echo "Make Python exited with $RESULT" if [[ "$SSLVER" != "OpenSSL $BUILD_OPENSSL_VERSION "* ]]; then
#if [ $RESULT != 0 ]; then echo "sslver not equal to..."
# echo "Trying Python make again without unsafe flags..." fi
# make clean if [ $PYRESULT -ne 0 ]; then
# ./configure $safe_flags > /dev/null echo "pyresult -ne 0"
# make -j$cpucount -s fi
#fi if [[ "$PYVER" != "Python $BUILD_PYTHON_VERSION" ]]; then
#echo "Installing Python..." echo "pyver not equal to..."
#make install > /dev/null fi
#cd ~
#export LD_LIBRARY_PATH=~/ssl/lib:~/python/lib # Start clean
#python=~/python/bin/python3 cd ~
#pip=~/python/bin/pip3 rm -rf python
rm -rf ssl
mkdir python
mkdir ssl
# Compile latest OpenSSL
wget --quiet https://www.openssl.org/source/openssl-$BUILD_OPENSSL_VERSION.tar.gz
echo "Extracting OpenSSL..."
tar xf openssl-$BUILD_OPENSSL_VERSION.tar.gz
cd openssl-$BUILD_OPENSSL_VERSION
echo "Compiling OpenSSL $BUILD_OPENSSL_VERSION..."
./config shared --prefix=$HOME/ssl
echo "Running make for OpenSSL..."
make -j$cpucount -s
echo "Running make install for OpenSSL..."
make install > /dev/null
cd ~
# Compile latest Python
echo "Downloading Python $BUILD_PYTHON_VERSION..."
curl -O https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/Python-$BUILD_PYTHON_VERSION.tar.xz
echo "Extracting Python..."
tar xf Python-$BUILD_PYTHON_VERSION.tar.xz
cd Python-$BUILD_PYTHON_VERSION
echo "Compiling Python $BUILD_PYTHON_VERSION..."
safe_flags="--with-openssl=$HOME/ssl --enable-shared --prefix=$HOME/python --with-ensurepip=upgrade"
unsafe_flags="--enable-optimizations --with-lto"
if [ ! -e Makefile ]; then
echo "running configure with safe and unsafe"
./configure $safe_flags $unsafe_flags > /dev/null
fi
make -j$cpucount PROFILE_TASK="-m test.regrtest --pgo -j$(( $cpucount * 2 ))" -s
RESULT=$?
echo "First make exited with $RESULT"
if [ $RESULT != 0 ]; then
echo "Trying Python compile again without unsafe flags..."
make clean
./configure $safe_flags > /dev/null
make -j$cpucount -s
echo "Sticking with safe Python for now..."
fi
echo "Installing Python..."
make install > /dev/null
cd ~
fi
$python -V $python -V
cd $whereibelong cd $whereibelong
export PATH=/usr/local/opt/python/libexec/bin:$PATH #export PATH=/usr/local/opt/python/libexec/bin:$PATH
$pip install --upgrade pip $pip install --upgrade pip
$pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U $pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U
$pip install --upgrade -r src/requirements.txt $pip install --upgrade -r src/requirements.txt