| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4bd62b0 commit 737ffc3
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + Ignore OpenSSL detection: Python 2.7.10 uses openssl 1.0.2 but tries | ||
| 2 | + to compile with 1.1 if present, and compilation fails. | ||
| 3 | + | ||
| 4 | + Taken from | ||
| 5 | + https://github.com/renpy/renpy-deps/blob/master/source/python-minimize-openssl.diff | ||
| 6 | + | ||
| 7 | + --- a/setup.py 2015-05-23 12:09:25.000000000 -0400 | ||
| 8 | + +++ b/setup.py 2017-11-02 23:20:09.131537016 -0400 | ||
| 9 | + @@ -842,7 +842,7 @@ | ||
| 10 | + have_usable_openssl = (have_any_openssl and | ||
| 11 | + openssl_ver >= min_openssl_ver) | ||
| 12 | + | ||
| 13 | + - if have_any_openssl: | ||
| 14 | + + if False and have_any_openssl: | ||
| 15 | + if have_usable_openssl: | ||
| 16 | + # The _hashlib module wraps optimized implementations | ||
| 17 | + # of hash functions from the OpenSSL library. | ||
| 18 | + @@ -854,7 +854,7 @@ | ||
| 19 | + print ("warning: openssl 0x%08x is too old for _hashlib" % | ||
| 20 | + openssl_ver) | ||
| 21 | + missing.append('_hashlib') | ||
| 22 | + - if COMPILED_WITH_PYDEBUG or not have_usable_openssl: | ||
| 23 | + + if True or COMPILED_WITH_PYDEBUG or not have_usable_openssl: | ||
| 24 | + # The _sha module implements the SHA1 hash algorithm. | ||
| 25 | + exts.append( Extension('_sha', ['shamodule.c']) ) | ||
| 26 | + # The _md5 module implements the RSA Data Security, Inc. MD5 | ||
| 27 | + @@ -865,7 +865,7 @@ | ||
| 28 | + depends = ['md5.h']) ) | ||
| 29 | + | ||
| 30 | + min_sha2_openssl_ver = 0x00908000 | ||
| 31 | + - if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver: | ||
| 32 | + + if True or COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver: | ||
| 33 | + # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash | ||
| 34 | + exts.append( Extension('_sha256', ['sha256module.c']) ) | ||
| 35 | + exts.append( Extension('_sha512', ['sha512module.c']) ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,3 +2,4 @@ python2-cross_compile.patch | |||
| 2 | 2 | python2-no_popen.patch | |
| 3 | 3 | python2-static_submodules.patch | |
| 4 | 4 | python2-webbrowser.patch | |
| 5 | + python2-no-openssl.patch | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,40 +29,36 @@ unpack () { | |||
| 29 | 29 | quilt push -a | |
| 30 | 30 | } | |
| 31 | 31 | ||
| 32 | - # TODO: multiple partially supported use cases: | ||
| 33 | - # - python and pgen for emscripten() below | ||
| 34 | - # - compiling .pyo files, in emscripten() and package-xxx.sh | ||
| 35 | - # - building static/dynamic wasm modules (but lacks setuptools and its | ||
| 36 | - # threads dependency) | ||
| 37 | - # - mock-ing emscripten environment through static desktop python (but with signal module) | ||
| 38 | - # Make several builds? | ||
| 39 | - native () { | ||
| 32 | + # use cases: | ||
| 33 | + # - python/pgen/.pyo for emscripten() below | ||
| 34 | + # - common basis for crosspython below | ||
| 35 | + hostpython () { | ||
| 40 | 36 | cd $BUILD/Python-$VERSION/ | |
| 41 | 37 | mkdir -p native | |
| 42 | 38 | ( | |
| 43 | 39 | cd native/ | |
| 44 | - # --without-signal-module: not disabled because needed by setup.py | ||
| 45 | 40 | if [ ! -e config.status ]; then | |
| 41 | + # --without-pymalloc: prevents segfault during 'make' (sysconfigdata) | ||
| 46 | 42 | ../configure \ | |
| 47 | - --prefix=$BUILD/hostpython/ \ | ||
| 48 | - --without-threads --without-pymalloc --disable-shared --disable-ipv6 | ||
| 43 | + --prefix='' \ | ||
| 44 | + --without-pymalloc | ||
| 49 | 45 | fi | |
| 50 | - echo '*static*' > Modules/Setup.local | ||
| 51 | - cat $SETUPLOCAL >> Modules/Setup.local | ||
| 52 | 46 | ||
| 53 | - # used by a Python script in 'make install' - or not | ||
| 54 | - #echo '_struct _struct.c' >> Modules/Setup.local | ||
| 55 | - #echo 'unicodedata unicodedata.c' >> Modules/Setup.local | ||
| 56 | - | ||
| 57 | - make -j$(nproc) Parser/pgen python | ||
| 58 | - | ||
| 59 | 47 | make -j$(nproc) | |
| 60 | - DESTDIR= make install | ||
| 48 | + make install DESTDIR=$BUILD/hostpython | ||
| 61 | 49 | ||
| 62 | 50 | # emcc should disregard '-fPIC' during non-SIDE_MODULE builds, | |
| 63 | 51 | # otherwise _sysconfigdata.build_time_vars['CCSHARED'] is the culprit: | |
| 64 | 52 | # sed -i -e 's/-fPIC//' $BUILD/hostpython/lib/python2.7/_sysconfigdata.py | |
| 65 | 53 | ) | |
| 54 | + | ||
| 55 | + # setuptools for 3rd-party module installers | ||
| 56 | + wget -c https://files.pythonhosted.org/packages/11/0a/7f13ef5cd932a107cd4c0f3ebc9d831d9b78e1a0e8c98a098ca17b1d7d97/setuptools-41.6.0.zip -P $CACHEROOT/ | ||
| 57 | + cd $BUILD/hostpython/ | ||
| 58 | + rm -rf setuptools-41.6.0/ | ||
| 59 | + unzip $CACHEROOT/setuptools-41.6.0.zip | ||
| 60 | + cd setuptools-41.6.0/ | ||
| 61 | + ../bin/python setup.py install | ||
| 66 | 62 | } | |
| 67 | 63 | ||
| 68 | 64 | emscripten () { | |
@@ -129,14 +125,81 @@ emscripten () { | |||
| 129 | 125 | ) | |
| 130 | 126 | } | |
| 131 | 127 | ||
| 128 | + # For mock-ing emscripten environment through static desktop python | ||
| 129 | + mock () { | ||
| 130 | + cd $BUILD/Python-$VERSION/ | ||
| 131 | + mkdir -p native | ||
| 132 | + ( | ||
| 133 | + cd native/ | ||
| 134 | + if [ ! -e config.status ]; then | ||
| 135 | + ../configure \ | ||
| 136 | + --prefix=$BUILD/hostpython/ \ | ||
| 137 | + --without-threads --without-pymalloc --without-signal-module --disable-ipv6 \ | ||
| 138 | + --disable-shared | ||
| 139 | + fi | ||
| 140 | + echo '*static*' > Modules/Setup.local | ||
| 141 | + cat $SETUPLOCAL >> Modules/Setup.local | ||
| 142 | + | ||
| 143 | + make -j$(nproc) Parser/pgen python | ||
| 144 | + | ||
| 145 | + make -j$(nproc) | ||
| 146 | + DESTDIR= make install | ||
| 147 | + ) | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + # python aimed at compiling third-party Python modules to WASM | ||
| 151 | + # - building static/dynamic wasm modules | ||
| 152 | + # - compiling .pyo files, in emscripten() and package-xxx.sh | ||
| 153 | + # Uses hostpython; detects its PYTHONHOME through ../lib AFAICS, no need to recompile | ||
| 154 | + # Usage: | ||
| 155 | + # .../crosspython-static/bin/python setup.py xxx --root=.../destdir/ --prefix='' | ||
| 156 | + # .../crosspython-dynamic/bin/python setup.py xxx --root=.../destdir/ --prefix='' | ||
| 157 | + # .../crosspython-static/bin/python -OO -m py_compile xxx.py | ||
| 158 | + crosspython () { | ||
| 159 | + cd $(dirname $(readlink -f $0)) | ||
| 160 | + # Copy-link hostpython except for include/ and | ||
| 161 | + # lib/python2.7/_sysconfigdata.py | ||
| 162 | + for variant in static dynamic; do | ||
| 163 | + rm -rf crosspython-$variant | ||
| 164 | + mkdir crosspython-$variant | ||
| 165 | + ( | ||
| 166 | + cd crosspython-$variant | ||
| 167 | + for i in $(cd ../build/hostpython && ls -A); do | ||
| 168 | + ln -s ../build/hostpython/$i $i | ||
| 169 | + done | ||
| 170 | + rm include lib | ||
| 171 | + mkdir lib | ||
| 172 | + for i in $(cd ../build/hostpython/lib && ls -A); do | ||
| 173 | + ln -s ../../build/hostpython/lib/$i lib/$i | ||
| 174 | + done | ||
| 175 | + rm lib/python2.7 | ||
| 176 | + mkdir lib/python2.7 | ||
| 177 | + for i in $(cd ../build/hostpython/lib/python2.7 && ls -A); do | ||
| 178 | + ln -s ../../../build/hostpython/lib/python2.7/$i lib/python2.7/$i | ||
| 179 | + done | ||
| 180 | + | ||
| 181 | + # Use Python.h configured for WASM | ||
| 182 | + ln -s $DESTDIR/include include | ||
| 183 | + | ||
| 184 | + # Use compiler settings configured for WASM | ||
| 185 | + rm lib/python2.7/_sysconfigdata.* | ||
| 186 | + cp -a $DESTDIR/lib/python2.7/_sysconfigdata.* lib/python2.7/ | ||
| 187 | + ) | ||
| 188 | + done | ||
| 189 | + # 'CCSHARED': 'xxx', | ||
| 190 | + sed -i -e "s/'CCSHARED': .*/'CCSHARED': '-fPIC -s SIDE_MODULE=1',/" \ | ||
| 191 | + crosspython-dynamic/lib/python2.7/_sysconfigdata.py | ||
| 192 | + } | ||
| 193 | + | ||
| 132 | 194 | case "$1" in | |
| 133 | - unpack|native|emscripten) | ||
| 195 | + unpack|hostpython|emscripten|mock|crosspython) | ||
| 134 | 196 | "$1" | |
| 135 | 197 | ;; | |
| 136 | 198 | '') | |
| 137 | 199 | unpack | |
| 138 | - native | ||
| 200 | + hostpython | ||
| 139 | 201 | emscripten | |
| 202 | + crosspython | ||
| 140 | 203 | ;; | |
| 141 | 204 | *) | |
| 142 | 205 | echo "Usage: $0 unpack|native|emscripten" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments