Last active
April 12, 2018 15:31
-
-
Save pmdevita/066ab25aa7885efb8f6a69b40d844412 to your computer and use it in GitHub Desktop.
Compile portable(ish) Python with custom OpenSSL on Mac OSX
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 | |
# where to do the building | |
build_dir="/Users/pmdevita/Downloads" | |
# links to python and openssl to use | |
python_link="https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz" | |
openssl_link="https://www.openssl.org/source/openssl-1.1.0g.tar.gz" | |
# needs to be same file type as download | |
python_name="Python.tar.xz" | |
openssl_name="openssl.tar.gz" | |
python_src="python_src" | |
openssl_src="openssl_src" | |
python_dir="python" | |
openssl_dir="openssl" | |
cd $build_dir | |
curl -o $python_name $python_link | |
curl -o $openssl_name $openssl_link | |
mkdir $python_src | |
mkdir $openssl_src | |
mkdir $openssl_dir | |
mkdir $python_dir | |
tar xf $python_name -C $python_src --strip-components 1 | |
tar xf $openssl_name -C $openssl_src --strip-components 1 | |
cd $openssl_src | |
./Configure darwin64-x86_64-cc --prefix="$build_dir/$openssl_dir" --openssldir="$build_dir/$openssl_dir" | |
make clean | |
make | |
make install | |
cd .. | |
cd $python_src | |
./configure CPPFLAGS="-I$build_dir/$openssl_dir/include" LDFLAGS="-L$build_dir/$openssl_dir/lib" --prefix="$build_dir/$python_dir" | |
make clean | |
make | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to https://stackoverflow.com/a/20740964
Haven't tested moving the files to another Mac and running it