cleanup arm build

This commit is contained in:
Jay Lee
2019-10-11 13:10:04 -04:00
parent 97515ab758
commit 45e3b01b15

View File

@@ -1,79 +1,72 @@
export whereibelong=$(pwd) export whereibelong=$(pwd)
export dist=$(lsb_release --codename --short) export dist=$(lsb_release --codename --short)
echo "We are running on Ubuntu $dist" echo "We are running on Ubuntu $dist"
echo "RUNNING: apt update..." echo "RUNNING: apt update..."
sudo apt-get -qq --yes update > /dev/null sudo apt-get -qq --yes update > /dev/null
echo "RUNNING: apt dist-upgrade..." echo "RUNNING: apt dist-upgrade..."
sudo apt-get -qq --yes dist-upgrade > /dev/null sudo apt-get -qq --yes dist-upgrade > /dev/null
echo "Installing build tools..." echo "Installing build tools..."
sudo apt-get -qq --yes install build-essential sudo apt-get -qq --yes install build-essential
echo "Installing deps for python3" echo "Installing deps for python3"
cat /etc/apt/sources.list cat /etc/apt/sources.list
sudo cp -v /etc/apt/sources.list /tmp sudo cp -v /etc/apt/sources.list /tmp
sudo chmod a+rwx /tmp/sources.list sudo chmod a+rwx /tmp/sources.list
echo "deb-src http://archive.ubuntu.com/ubuntu/ $dist main" >> /tmp/sources.list echo "deb-src http://archive.ubuntu.com/ubuntu/ $dist main" >> /tmp/sources.list
sudo cp -v /tmp/sources.list /etc/apt sudo cp -v /tmp/sources.list /etc/apt
cat /etc/apt/sources.list cat /etc/apt/sources.list
sudo apt-get -qq --yes update > /dev/null sudo apt-get -qq --yes update > /dev/null
sudo apt-get -qq --yes build-dep python3 > /dev/null sudo apt-get -qq --yes build-dep python3 > /dev/null
sudo apt-get -qq --yes install zlib1g-dev > /dev/null sudo apt-get -qq --yes install zlib1g-dev > /dev/null
mypath=$HOME echo "My Path is $HOME"
echo "My Path is $mypath" cpucount=$(nproc --all)
cpucount=$(nproc --all) echo "This device has $cpucount CPUs for compiling..."
echo "This device has $cpucount CPUs for compiling..."
# Compile latest OpenSSL export LD_LIBRARY_PATH=~/ssl/lib:~/python/lib
if [ ! -d openssl-$BUILD_OPENSSL_VERSION ]; then
wget --quiet https://www.openssl.org/source/openssl-$BUILD_OPENSSL_VERSION.tar.gz # Compile latest OpenSSL
echo "Extracting OpenSSL..." SSLVER=$(~/ssl/bin/openssl version)
tar xf openssl-$BUILD_OPENSSL_VERSION.tar.gz if [ "$?" != "0" ] || [[ "$SSLVER" != *"$BUILD_OPENSSL_VERSION"* ]]; then
fi echo "Downloading 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 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=~/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
cd ~ cd ~
fi
# Compile latest Python # Compile latest Python
if [ ! -d Python-$BUILD_PYTHON_VERSION ]; then PYVER=$(~/python/bin/python -V)
echo "Downloading Python $BUILD_PYTHON_VERSION..." if [ "$?" != "0" ] || [[ "$PYVER" != *"$BUILD_PYTHON_VERSION"* ]]; then
curl -O https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/Python-$BUILD_PYTHON_VERSION.tar.xz echo "Downloading Python $BUILD_PYTHON_VERSION..."
echo "Extracting Python..." curl -O https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/Python-$BUILD_PYTHON_VERSION.tar.xz
tar xf Python-$BUILD_PYTHON_VERSION.tar.xz echo "Extracting Python..."
fi tar xf Python-$BUILD_PYTHON_VERSION.tar.xz
cd Python-$BUILD_PYTHON_VERSION cd Python-$BUILD_PYTHON_VERSION
echo "Compiling Python $BUILD_PYTHON_VERSION..." echo "Compiling Python $BUILD_PYTHON_VERSION..."
safe_flags="--with-openssl=$mypath/ssl --enable-shared --prefix=$mypath/python --with-ensurepip=upgrade" safe_flags="--with-openssl=~/ssl --enable-shared --prefix=~/python --with-ensurepip=upgrade"
unsafe_flags="--enable-optimizations --with-lto" unsafe_flags="--enable-optimizations --with-lto"
if [ ! -e Makefile ]; then echo "running configure with safe and unsafe"
echo "running configure with safe and unsafe" ./configure $safe_flags $unsafe_flags > /dev/null
./configure $safe_flags $unsafe_flags > /dev/null
fi
make -j$cpucount PROFILE_TASK="-m test.regrtest --pgo -j$(( $cpucount * 2 ))" -s 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..." echo "Installing Python..."
make install > /dev/null make install > /dev/null
cd ~ cd ~
fi
export LD_LIBRARY_PATH=~/ssl/lib:~/python/lib cd $WHEREIBELONG
python=~/python/bin/python3
pip=~/python/bin/pip3
$python -V python=~/python/bin/python3
pip=~/python/bin/pip3
$python -V
echo "Upgrading pip packages..." echo "Upgrading pip packages..."
$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