| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 98f254c commit fa969df
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,9 +24,9 @@ if [ "$1" == "--lz4" ]; then LZ4="--lz4"; shift; fi | |||
| 24 | 24 | rm -rf $PACKAGEDIR/ | |
| 25 | 25 | mkdir -p $PACKAGEDIR | |
| 26 | 26 | ||
| 27 | - # Hard-coded modules: for 'print "hello, world."' | ||
| 27 | + # Hard-coded modules: for 'print("hello, world.")' | ||
| 28 | 28 | # $@: additional, app-specific modules | |
| 29 | - for i in site.py os.py posixpath.py stat.py genericpath.py warnings.py linecache.py types.py UserDict.py _abcoll.py abc.py _weakrefset.py copy_reg.py traceback.py sysconfig.py re.py sre_compile.py sre_parse.py sre_constants.py _sysconfigdata.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py __future__.py ast.py copy.py weakref.py platform.py string.py io.py tempfile.py random.py hashlib.py struct.py dummy_thread.py collections.py keyword.py heapq.py argparse.py textwrap.py gettext.py locale.py functools.py importlib/__init__.py glob.py fnmatch.py pickle.py colorsys.py contextlib.py zipfile.py shutil.py json/__init__.py json/decoder.py json/scanner.py encodings/hex_codec.py json/encoder.py difflib.py inspect.py dis.py opcode.py tokenize.py token.py xml/__init__.py xml/etree/__init__.py xml/etree/ElementTree.py xml/etree/ElementPath.py encodings/zlib_codec.py tarfile.py urlparse.py StringIO.py encodings/latin_1.py \ | ||
| 29 | + for i in site.py os.py posixpath.py stat.py genericpath.py warnings.py linecache.py types.py UserDict.py _abcoll.py abc.py _weakrefset.py copy_reg.py traceback.py sysconfig.py re.py sre_compile.py sre_parse.py sre_constants.py _sysconfigdata.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py __future__.py ast.py copy.py weakref.py platform.py string.py io.py tempfile.py random.py hashlib.py struct.py dummy_thread.py collections.py keyword.py heapq.py argparse.py textwrap.py gettext.py locale.py functools.py importlib/__init__.py glob.py fnmatch.py pickle.py colorsys.py contextlib.py zipfile.py shutil.py json/__init__.py json/decoder.py json/scanner.py encodings/hex_codec.py json/encoder.py difflib.py inspect.py dis.py opcode.py tokenize.py token.py xml/__init__.py xml/etree/__init__.py xml/etree/ElementTree.py xml/etree/ElementPath.py encodings/zlib_codec.py tarfile.py urlparse.py StringIO.py encodings/latin_1.py encodings/ascii.py \ | ||
| 30 | 30 | "$@"; do | |
| 31 | 31 | if [ $PREFIX/lib/python2.7/$i -nt $PREFIX/lib/python2.7/${i%.py}.pyo ]; then | |
| 32 | 32 | (cd $PREFIX && python -OO -m py_compile lib/python2.7/$i) | |
@@ -35,6 +35,7 @@ for i in site.py os.py posixpath.py stat.py genericpath.py warnings.py linecache | |||
| 35 | 35 | cp -au $PREFIX/lib/python2.7/${i%.py}.pyo $PACKAGEDIR/lib/python2.7/${i%.py}.pyo | |
| 36 | 36 | done | |
| 37 | 37 | ||
| 38 | + # --no-heap-copy: suited for ALLOW_MEMORY_GROWTH=1 | ||
| 38 | 39 | PACKAGEDIR_FULLPATH=$(readlink -f $PACKAGEDIR) | |
| 39 | 40 | ( | |
| 40 | 41 | cd $OUTDIR; # use relative path in xxx-data.js | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | # notice and this notice are preserved. This file is offered as-is, | |
| 10 | 10 | # without any warranty. | |
| 11 | 11 | ||
| 12 | + VERSION=2.7.10 # for end-of-life Python2, support Ren'Py's version only | ||
| 12 | 13 | DESTDIR=${DESTDIR:-$(dirname $(readlink -f $0))/destdir} | |
| 13 | 14 | SETUPLOCAL=${SETUPLOCAL:-'/dev/null'} | |
| 14 | 15 | ||
@@ -19,23 +20,23 @@ export QUILT_PATCHES=$(dirname $(readlink -f $0))/patches | |||
| 19 | 20 | WGET=${WGET:-wget} | |
| 20 | 21 | ||
| 21 | 22 | unpack () { | |
| 22 | - $WGET -c https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz -P $CACHEROOT/ | ||
| 23 | + $WGET -c https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz -P $CACHEROOT/ | ||
| 23 | 24 | mkdir -p $BUILD | |
| 24 | 25 | cd $BUILD/ | |
| 25 | - rm -rf Python-2.7.10/ | ||
| 26 | - tar xf $CACHEROOT/Python-2.7.10.tgz | ||
| 27 | - cd Python-2.7.10/ | ||
| 26 | + rm -rf Python-$VERSION/ | ||
| 27 | + tar xf $CACHEROOT/Python-$VERSION.tgz | ||
| 28 | + cd Python-$VERSION/ | ||
| 28 | 29 | quilt push -a | |
| 29 | 30 | } | |
| 30 | 31 | ||
| 31 | 32 | # TODO: multiple partially supported use cases: | |
| 32 | - # - emscripten() below | ||
| 33 | - # - mock-ing emscripten (but with signal module) | ||
| 33 | + # - python and pgen for emscripten() below | ||
| 34 | + # - mock-ing emscripten environment through static desktop python (but with signal module) | ||
| 34 | 35 | # - building static/dynamic wasm modules (but lacks setuptools and its | |
| 35 | 36 | # threads dependency) | |
| 36 | 37 | # Make several builds? | |
| 37 | 38 | native () { | |
| 38 | - cd $BUILD/Python-2.7.10/ | ||
| 39 | + cd $BUILD/Python-$VERSION/ | ||
| 39 | 40 | mkdir -p native | |
| 40 | 41 | ( | |
| 41 | 42 | cd native/ | |
@@ -48,27 +49,31 @@ native () { | |||
| 48 | 49 | echo '*static*' > Modules/Setup.local | |
| 49 | 50 | cat $SETUPLOCAL >> Modules/Setup.local | |
| 50 | 51 | ||
| 52 | + # used by a Python script in 'make install' - or not | ||
| 53 | + #echo '_struct _struct.c' >> Modules/Setup.local | ||
| 54 | + #echo 'unicodedata unicodedata.c' >> Modules/Setup.local | ||
| 55 | + | ||
| 51 | 56 | make -j$(nproc) Parser/pgen python | |
| 52 | 57 | ||
| 53 | 58 | make -j$(nproc) | |
| 54 | 59 | DESTDIR= make install | |
| 55 | 60 | ||
| 56 | - # emcc should disregard '-fPIC' during non-SIDE_MODULE builds, | ||
| 57 | - # otherwise _sysconfigdata.build_time_vars['CCSHARED'] is the culprit: | ||
| 58 | - # sed -i -e 's/-fPIC//' $BUILD/hostpython/lib/python2.7/_sysconfigdata.py | ||
| 61 | + # emcc should disregard '-fPIC' during non-SIDE_MODULE builds, | ||
| 62 | + # otherwise _sysconfigdata.build_time_vars['CCSHARED'] is the culprit: | ||
| 63 | + # sed -i -e 's/-fPIC//' $BUILD/hostpython/lib/python2.7/_sysconfigdata.py | ||
| 59 | 64 | ) | |
| 60 | 65 | } | |
| 61 | 66 | ||
| 62 | 67 | emscripten () { | |
| 63 | - cd $BUILD/Python-2.7.10/ | ||
| 68 | + cd $BUILD/Python-$VERSION/ | ||
| 64 | 69 | mkdir -p emscripten | |
| 65 | 70 | ( | |
| 66 | 71 | cd emscripten/ | |
| 67 | 72 | # OPT=-Oz: TODO | |
| 68 | 73 | # CONFIG_SITE: deals with cross-compilation https://bugs.python.org/msg136962 | |
| 69 | 74 | # not needed as emcc has a single arch: BASECFLAGS=-m32 LDFLAGS=-m32 | |
| 70 | - # --without-threads: pthreads currently not yet usable in emscripten as of 2018-12 | ||
| 71 | - # cf. https://kripken.github.io/emscripten-site/docs/porting/pthreads.html | ||
| 75 | + # --without-threads: pthreads experimental as of 2019-11 | ||
| 76 | + # cf. https://emscripten.org/docs/porting/pthreads.html | ||
| 72 | 77 | ||
| 73 | 78 | if [ ! -e config.status ]; then | |
| 74 | 79 | CONFIG_SITE=../config.site BASECFLAGS='-s USE_ZLIB=1' \ | |
@@ -79,22 +84,26 @@ emscripten () { | |||
| 79 | 84 | --disable-shared | |
| 80 | 85 | fi | |
| 81 | 86 | sed -i -e 's,^#define HAVE_GCC_ASM_FOR_X87.*,/* & */,' pyconfig.h | |
| 82 | - # Work-around network functions detection | ||
| 83 | - # https://github.com/emscripten-core/emscripten/issues/9154 | ||
| 84 | - sed -i -e 's,^/\* #undef HAVE_GETPEERNAME \*/,#define HAVE_GETPEERNAME 1,' pyconfig.h | ||
| 85 | - sed -i -e 's,^/\* #undef HAVE_GETNAMEINFO \*/,#define HAVE_GETNAMEINFO 1,' pyconfig.h | ||
| 86 | - # Modules/Setup.local | ||
| 87 | - emmake make Parser/pgen # need to build it once before overwriting it with the native one | ||
| 87 | + | ||
| 88 | + # pgen native setup | ||
| 89 | + # note: need to build 'pgen' once before overwriting it with the native one | ||
| 90 | + # note: PGEN=../native/Parser/pgen doesn't work, make overwrites it | ||
| 91 | + emmake make Parser/pgen | ||
| 88 | 92 | \cp --preserve=mode ../native/Parser/pgen Parser/ | |
| 89 | - # note: PGEN=../native/Parser/pgen doesn't work, make just overwrites it | ||
| 90 | - # note: PYTHON_FOR_BUILD=../native/python, PATH=... doesn't work, it breaks emcc's Python | ||
| 93 | + # python native setup | ||
| 94 | + # note: PATH=... doesn't work, it breaks emcc's /usr/bin/env python | ||
| 95 | + # note: PYTHON_FOR_BUILD=../native/python neither, it's a more complex call | ||
| 96 | + #emmake env PATH=../../hostpython/bin:$PATH make -j$(nproc) | ||
| 91 | 97 | sed -i -e 's,\(PYTHON_FOR_BUILD=.*\) python2.7,\1 $(abs_srcdir)/native/python,' Makefile | |
| 98 | + | ||
| 99 | + # Modules/Setup.local | ||
| 92 | 100 | echo '*static*' > Modules/Setup.local | |
| 93 | 101 | cat $SETUPLOCAL >> Modules/Setup.local | |
| 94 | - # drop -lz, we USE_ZLIB=1: | ||
| 102 | + # drop -I/-L/-lz, we USE_ZLIB=1 (keep it in SETUPLOCAL for mock) | ||
| 95 | 103 | sed -i -e 's/^\(zlib zlibmodule.c\).*/\1/' Modules/Setup.local | |
| 96 | 104 | ||
| 97 | 105 | emmake make -j$(nproc) | |
| 106 | + | ||
| 98 | 107 | # setup.py install_lib doesn't respect DESTDIR | |
| 99 | 108 | echo -e 'sharedinstall:\n\ttrue' >> Makefile | |
| 100 | 109 | # decrease .pyo size by dropping docstrings | |
| Back | FazBrowse Home | New Git URL |
0 commit comments