This repository was archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild_python.sh
More file actions
executable file
·171 lines (126 loc) · 3.47 KB
/
build_python.sh
File metadata and controls
executable file
·171 lines (126 loc) · 3.47 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
SOURCE=`dirname "$0"`/source
PWD=`pwd`
BUILD=$PWD/build
INSTALL=$PWD/install
# The xes are required to prevent msys from interpreting these as
# paths. (We use the system python to do this normalization.)
SOURCE=`python $SOURCE/norm_source.py "x$PWD" "x$SOURCE"`
export LD_LIBRARY_PATH="$INSTALL/lib"
export DYLIB_LIBRARY_PATH="$INSTALL/lib"
export DYLD_FRAMEWORK_PATH="$INSTALL/frameworks"
PYFRAMEWORK="$DYLD_FRAMEWORK_PATH/Python.framework/Versions/2.7"
export PATH="$INSTALL/bin:$PATH"
CP='cp -pR'
echo
echo Source: $SOURCE
echo Build: $BUILD
echo Install: $INSTALL
echo
mkdir -p $BUILD
mkdir -p $INSTALL
export CC=${CC:=gcc}
export CXX=${CXX:=g++}
export LD=${LD:=gcc}
export CXXLD=${CXXLD:=g++}
export CFLAGS="$CFLAGS -O3 -I$INSTALL/include"
export CXXFLAGS="$CXXFLAGS -O3 -I$INSTALL/include"
export LDFLAGS="$LDFLAGS -O3 -L$INSTALL/lib"
if [ `arch` = "x86_64" ]; then
export CFLAGS="-fPIC $CFLAGS"
export CXXFLAGS="-fPIC $CXXFLAGS"
export LDFLAGS="-fPIC $LDFLAGS"
fi
# export CFLAGS="$CFLAGS -ggdb -I$INSTALL/include"
# export CXXFLAGS="$CXXFLAGS -ggdb -I$INSTALL/include"
# export LDFLAGS="$LDFLAGS -ggdb -L$INSTALL/lib"
# echo warning debug build; sleep 3
if [ "x$MSYSTEM" != "x" ]; then
export CFLAGS="$CFLAGS -fno-strict-aliasing"
export CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
fi
export SED=sed
export RENPY_DEPS_INSTALL=$INSTALL
if [ `uname` = 'Darwin' ]; then
MAC=yes
PATH="$PYFRAMEWORK/bin:$PATH"
else
MAC=no
fi
try () {
"$@" || exit 1
}
cd $BUILD
if [ \! -e built.zlib ]; then
try tar xvzf "$SOURCE/zlib-1.2.6.tar.gz"
try cd "$BUILD/zlib-1.2.6"
try ./configure --prefix="$INSTALL" --shared
try make
try make install
cd "$BUILD"
touch built.zlib
fi
if [ \! -e built.bz2 ]; then
try tar xvzf "$SOURCE/bzip2-1.0.6.tar.gz"
try cd "$BUILD/bzip2-1.0.6"
try make CFLAGS="$CFLAGS -Wall -Winline -D_FILE_OFFSET_BITS=64" LDFLAGS="$LDFLAGS" CC="$CC" LD="$LD" CXX="$CXX" CXXLD="$CXXLD"
try make install PREFIX="$INSTALL"
try cd "$BUILD"
try touch built.bz2
fi
if [ \! -e built.openssl ]; then
try tar xvzf "$SOURCE/openssl-1.0.2m.tar.gz"
try cd "$BUILD/openssl-1.0.2m"
if [ `arch` = "x86_64" ]; then
pic=-fPIC
fi
if [ `arch` = "armv7l" ]; then
pic=-fPIC
fi
if [ $MAC = yes ]; then
try ./Configure darwin64-x86_64-cc no-shared no-asm --prefix="$INSTALL"
else
try ./config $pic $plat --prefix="$INSTALL"
fi
try make
try make install
try cd "$BUILD"
if [ -e built.python ]; then
try rm built.python
fi
try touch built.openssl
fi
if [ \! -e built.python ]; then
try tar xzf "$SOURCE/Python-2.7.10.tgz"
try cd "$BUILD/Python-2.7.10"
try patch -p0 < "$SOURCE/python-minimize-openssl.diff"
try ./configure --prefix="$INSTALL" --enable-shared --enable-unicode=ucs4 #-with-universal-archs=x86_64 --enable-universalsdk=$SDKROOT
if [ $MAC = yes ]; then
try patch -p0 < "$SOURCE/python-no-getentropy.diff"
fi
try make
try make install
try cd "$BUILD"
try touch built.python
fi
hash -r python
set -e
pysetup() {
name="$1"
version="$2"
echo $name
if [ \! -e built.$name ]; then
tar xzf "$SOURCE/$name-$version.tar.gz"
cd "$BUILD/$name-$version"
python setup.py install
cd "$BUILD"
touch built.$name
fi
}
pysetup setuptools 7.0
pysetup pyasn1 0.1.7
pysetup rsa 3.1.4
pysetup altgraph 0.12
pysetup macholib 1.7
pysetup future 0.18.2
exit 0