| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + */data/ | ||
| 2 | + */build/ | ||
| 3 | + */Python-*.tgz | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,17 +9,23 @@ | |||
| 9 | 9 | # notice and this notice are preserved. This file is offered as-is, | |
| 10 | 10 | # without any warranty. | |
| 11 | 11 | ||
| 12 | - CACHEROOT=$(dirname $(readlink -f $0))/../../cache | ||
| 13 | - BUILD=$(dirname $(readlink -f $0))/../../build | ||
| 14 | - INSTALLDIR=$(dirname $(readlink -f $0))/../../install | ||
| 15 | - PATCHESDIR=$(dirname $(readlink -f $0))/patches | ||
| 12 | + PREFIX=${PREFIX:-$(dirname $(readlink -f $0))/install} | ||
| 13 | + SETUPLOCAL=${SETUPLOCAL:-'/dev/null'} | ||
| 14 | + | ||
| 15 | + CACHEROOT=$(dirname $(readlink -f $0)) | ||
| 16 | + BUILD=$(dirname $(readlink -f $0))/build | ||
| 17 | + export QUILT_PATCHES=$(dirname $(readlink -f $0))/patches | ||
| 18 | + | ||
| 19 | + WGET=${WGET:-wget} | ||
| 16 | 20 | ||
| 17 | 21 | unpack () { | |
| 22 | + $WGET -c https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz -P $CACHEROOT/ | ||
| 23 | + mkdir -p $BUILD | ||
| 18 | 24 | cd $BUILD/ | |
| 19 | 25 | rm -rf Python-2.7.10/ | |
| 20 | 26 | tar xf $CACHEROOT/Python-2.7.10.tgz | |
| 21 | 27 | cd Python-2.7.10/ | |
| 22 | - QUILT_PATCHES=$PATCHESDIR quilt push -a | ||
| 28 | + quilt push -a | ||
| 23 | 29 | } | |
| 24 | 30 | ||
| 25 | 31 | native () { | |
@@ -34,33 +40,7 @@ native () { | |||
| 34 | 40 | --without-threads --without-pymalloc --disable-shared --disable-ipv6 | |
| 35 | 41 | fi | |
| 36 | 42 | echo '*static*' > Modules/Setup.local | |
| 37 | - # pygame_sdl2 deps: | ||
| 38 | - echo 'binascii binascii.c' >> Modules/Setup.local | ||
| 39 | - echo '_struct _struct.c' >> Modules/Setup.local | ||
| 40 | - echo '_collections _collectionsmodule.c' >> Modules/Setup.local | ||
| 41 | - echo 'operator operator.c' >> Modules/Setup.local | ||
| 42 | - echo 'itertools itertoolsmodule.c' >> Modules/Setup.local | ||
| 43 | - echo 'time timemodule.c' >> Modules/Setup.local | ||
| 44 | - echo 'math mathmodule.c _math.c' >> Modules/Setup.local | ||
| 45 | - # Ren'Py deps: | ||
| 46 | - echo 'cStringIO cStringIO.c' >> Modules/Setup.local | ||
| 47 | - echo 'cPickle cPickle.c' >> Modules/Setup.local | ||
| 48 | - #echo 'signal signalmodule.c' >> Modules/Setup.local # comment out 'import subprocess' | ||
| 49 | - echo '_io -I$(srcdir)/Modules/_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c' >> Modules/Setup.local | ||
| 50 | - echo '_random _randommodule.c' >> Modules/Setup.local | ||
| 51 | - echo '_functools _functoolsmodule.c' >> Modules/Setup.local | ||
| 52 | - echo 'datetime datetimemodule.c' >> Modules/Setup.local | ||
| 53 | - echo 'zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz' >> Modules/Setup.local | ||
| 54 | - echo '_md5 md5module.c md5.c' >> Modules/Setup.local | ||
| 55 | - echo 'array arraymodule.c' >> Modules/Setup.local | ||
| 56 | - # avoid warnings from hashlib module | ||
| 57 | - echo '_sha shamodule.c' >> Modules/Setup.local | ||
| 58 | - echo '_sha256 sha256module.c' >> Modules/Setup.local | ||
| 59 | - echo '_sha512 sha512module.c' >> Modules/Setup.local | ||
| 60 | - | ||
| 61 | - # enable _struct and unicodedata, used by a Python script in 'make install' - or not | ||
| 62 | - #echo '_struct _struct.c' >> Modules/Setup.local | ||
| 63 | - #echo 'unicodedata unicodedata.c' >> Modules/Setup.local | ||
| 43 | + cat $SETUPLOCAL >> Modules/Setup.local | ||
| 64 | 44 | ||
| 65 | 45 | make -j$(nproc) Parser/pgen python | |
| 66 | 46 | ||
@@ -77,12 +57,13 @@ emscripten () { | |||
| 77 | 57 | # OPT=-Oz: TODO | |
| 78 | 58 | # CONFIG_SITE: deals with cross-compilation https://bugs.python.org/msg136962 | |
| 79 | 59 | # not needed as emcc has a single arch: BASECFLAGS=-m32 LDFLAGS=-m32 | |
| 80 | - # --without-threads: pthreads currently not usable in emscripten (tragically) | ||
| 60 | + # --without-threads: pthreads currently not yet usable in emscripten as of 2018-12 | ||
| 61 | + # cf. https://kripken.github.io/emscripten-site/docs/porting/pthreads.html | ||
| 81 | 62 | ||
| 82 | 63 | if [ ! -e config.status ]; then | |
| 83 | 64 | CONFIG_SITE=../config.site BASECFLAGS='-s USE_ZLIB=1' emconfigure ../configure \ | |
| 84 | 65 | --host=asmjs-unknown-emscripten --build=$(../config.guess) \ | |
| 85 | - --prefix=$INSTALLDIR \ | ||
| 66 | + --prefix=$PREFIX \ | ||
| 86 | 67 | --without-threads --without-pymalloc --without-signal-module --disable-ipv6 \ | |
| 87 | 68 | --disable-shared | |
| 88 | 69 | fi | |
@@ -94,37 +75,13 @@ emscripten () { | |||
| 94 | 75 | # note: PYTHON_FOR_BUILD=../native/python, PATH=... doesn't work, it breaks emcc's Python | |
| 95 | 76 | sed -i -e 's,\(PYTHON_FOR_BUILD=.*\) python2.7,\1 $(abs_srcdir)/native/python,' Makefile | |
| 96 | 77 | echo '*static*' > Modules/Setup.local | |
| 97 | - # pygame_sdl2 deps: | ||
| 98 | - echo 'binascii binascii.c' >> Modules/Setup.local | ||
| 99 | - echo '_struct _struct.c' >> Modules/Setup.local | ||
| 100 | - echo '_collections _collectionsmodule.c' >> Modules/Setup.local | ||
| 101 | - echo 'operator operator.c' >> Modules/Setup.local | ||
| 102 | - echo 'itertools itertoolsmodule.c' >> Modules/Setup.local | ||
| 103 | - echo 'time timemodule.c' >> Modules/Setup.local | ||
| 104 | - echo 'math mathmodule.c _math.c' >> Modules/Setup.local | ||
| 105 | - # Ren'Py deps: | ||
| 106 | - echo 'cStringIO cStringIO.c' >> Modules/Setup.local | ||
| 107 | - echo 'cPickle cPickle.c' >> Modules/Setup.local | ||
| 108 | - #echo 'signal signalmodule.c' >> Modules/Setup.local # comment out 'import subprocess' | ||
| 109 | - echo '_io -I$(srcdir)/Modules/_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c' >> Modules/Setup.local | ||
| 110 | - echo '_random _randommodule.c' >> Modules/Setup.local | ||
| 111 | - echo '_functools _functoolsmodule.c' >> Modules/Setup.local | ||
| 112 | - echo 'datetime datetimemodule.c' >> Modules/Setup.local | ||
| 113 | - echo 'zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz' >> Modules/Setup.local | ||
| 114 | - echo '_md5 md5module.c md5.c' >> Modules/Setup.local | ||
| 115 | - echo 'array arraymodule.c' >> Modules/Setup.local | ||
| 116 | - # avoid warnings from hashlib module | ||
| 117 | - echo '_sha shamodule.c' >> Modules/Setup.local | ||
| 118 | - echo '_sha256 sha256module.c' >> Modules/Setup.local | ||
| 119 | - echo '_sha512 sha512module.c' >> Modules/Setup.local | ||
| 120 | - | ||
| 121 | - #echo 'strop stropmodule.c' >> Modules/Setup.local # for platform module -> use sys.platform | ||
| 122 | - #echo 'zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz' >> Modules/Setup.local | ||
| 78 | + cat $SETUPLOCAL >> Modules/Setup.local | ||
| 123 | 79 | ||
| 124 | 80 | emmake make -j$(nproc) | |
| 125 | 81 | emmake make install | |
| 126 | 82 | ||
| 127 | 83 | # Basic trimming | |
| 84 | + # Disabled for now, better cherry-pick the files we need | ||
| 128 | 85 | #emmake make install DESTDIR=$(pwd)/destdir | |
| 129 | 86 | #find destdir/ -name "*.py" -print0 | xargs -r0 rm | |
| 130 | 87 | #find destdir/ -name "*.pyo" -print0 | xargs -r0 rm # only keep .pyc, .pyo apparently don't work | |
@@ -135,16 +92,23 @@ emscripten () { | |||
| 135 | 92 | #rm -rf destdir/usr/local/lib/*.a | |
| 136 | 93 | #rm -rf destdir/usr/local/lib/pkgconfig/ | |
| 137 | 94 | #rm -rf destdir/usr/local/lib/python2.7/test/ | |
| 138 | - | ||
| 139 | 95 | # Ditch .so for now, they cause an abort() with dynamic | |
| 140 | 96 | # linking unless we recompile all of them as SIDE_MODULE-s | |
| 141 | - rm -rf $INSTALLDIR/lib/python2.7/lib-dynload/ | ||
| 97 | + #rm -rf $PREFIX/lib/python2.7/lib-dynload/ | ||
| 142 | 98 | ) | |
| 143 | 99 | } | |
| 144 | 100 | ||
| 145 | - if [ "$1" = "" ]; then | ||
| 146 | - echo "Usage: $0 native|emscripten" | ||
| 147 | - exit 1 | ||
| 148 | - fi | ||
| 149 | - | ||
| 150 | - "$1" | ||
| 101 | + case "$1" in | ||
| 102 | + unpack|native|emscripten) | ||
| 103 | + "$1" | ||
| 104 | + ;; | ||
| 105 | + '') | ||
| 106 | + unpack | ||
| 107 | + native | ||
| 108 | + emscripten | ||
| 109 | + ;; | ||
| 110 | + *) | ||
| 111 | + echo "Usage: $0 unpack|native|emscripten" | ||
| 112 | + exit 1 | ||
| 113 | + ;; | ||
| 114 | + esac | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments