forked from thomasd57/django-1and1
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-python.sh
executable file
·76 lines (67 loc) · 1.81 KB
/
build-python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# This script builds Python 3.6.3 with OpenSSL and SQLite3
function print_usage {
echo 'Usage: build-python.sh [-b <build_dir>] [-i <install_dir>] [-S] [-Q] [-h]
-i <install_dir> : installation directory, default ./install
-b <build_dir> : build directory, default ./build
-S : skip building SSL (if already done)
-Q : skip building SQLITE3 (if already done)
'
exit
}
here=$PWD
build=build
install=install
while getopts :b:i:SQh opt; do
case $opt in
b) build=$OPTARG ;;
i) install=$OPTARG ;;
S) skip_ssl=1 ;;
Q) skip_sqlite=1 ;;
h) print_usage ;;
\?) echo "Invalid option: -$OPTARG" >&2 ;;
esac
done
install=$(realpath $install)
mkdir -p $install
build=$(realpath $build)
mkdir -p $build
cd $build
openssl=openssl-1.1.0e
sqlite=sqlite-autoconf-3240000
python=Python-3.6.3
# openssl
[ $skip_ssl = 1 ] || (
wget https://www.openssl.org/source/old/1.1.0/$openssl.tar.gz
rm -rf $openssl
tar -zxf $openssl.tar.gz
cd openssl-1.1.0e
./config --prefix=$install/$openssl
make
make install
) |& tee openssl.log
# sqlite3
[ $skip_sqlite = 1 ] || (
wget https://sqlite.org/2018/$sqlite.tar.gz
rm -rf $sqlite
tar -zxvf $sqlite.tar.gz
cd $sqlite
./configure --prefix=$install/python3.6.3
make
make install
) |& tee sqlite3.log
# python3.6.3
(
wget https://www.python.org/ftp/python/3.6.3/$python.tgz
rm -rf $python
tar -zxf $python.tgz
cd $python
LDFLAGS="-L $$install/python3.6.3/lib"
CPPFLAGS="-I $$install/python3.6.3/include"
export SSL_DIR=$install/$openssl
patch setup.py $here/setup.py.patch
ln -s $install/$openssl/include/openssl
./configure --prefix=$install/python3.6.3
make
make install
) |& tee python.log