Skip to content

Instantly share code, notes, and snippets.

@jay0lee
Last active December 17, 2022 17:19
Show Gist options
  • Save jay0lee/25751787ac238acbd63607a438c532a7 to your computer and use it in GitHub Desktop.
Save jay0lee/25751787ac238acbd63607a438c532a7 to your computer and use it in GitHub Desktop.
export cpucount=$(nproc --all)
cd ~
mkdir src
cd src
export LD_LIBRARY_PATH="${HOME}/ssl/lib:${HOME}/python/lib"
git clone https://github.com/openssl/openssl.git
cd openssl
LATEST_STABLE_TAG=$(git tag --list openssl-* | grep -v alpha | grep -v beta | sort -Vr | head -n1)
echo "Checking out version ${LATEST_STABLE_TAG}"
git checkout "${LATEST_STABLE_TAG}"
./Configure --libdir=lib --prefix="${HOME}/ssl" no-fips
make "-j${cpucount}"
make install_sw
"${HOME}/ssl/bin/openssl" version
cd ~/src
git clone https://github.com/python/cpython.git
cd cpython
export LATEST_STABLE_TAG=$(git tag --list | grep -v a | grep -v rc | grep -v b | sort -Vr | head -n1)
git checkout "${LATEST_STABLE_TAG}"
./configure --with-openssl="${HOME}/ssl" \
--prefix="${HOME}/python" \
--enable-shared \
--with-ensurepip=upgrade \
--enable-optimizations \
--with-lto
make "-j${cpucount}"
make install
curl -O https://bootstrap.pypa.io/get-pip.py
"${HOME}/python/bin/python3" get-pip.py
"${HOME}/python/bin/python3" -m pip install --upgrade pip
"${HOME}/python/bin/python3" -V
"${HOME}/python/bin/python3" -c "import ssl; print(ssl.OPENSSL_VERSION)"
rm -rf ~/src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment