python-emscripten  Check-in [6ca60b211b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix modules building and bump to 3.8.2
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:6ca60b211b3fd6624dac1e6d1a262f2275d39f13d3c190c7fda6d70324d72429
User & Date: Beuc 2020-05-22 11:08:29
Context
2020-05-27
17:58
3.8: size/perf-optimized python code check-in: acc37a2322 user: Beuc tags: trunk
2020-05-22
11:08
Fix modules building and bump to 3.8.2 check-in: 6ca60b211b user: Beuc tags: trunk
11:07
README: show-off Python3 check-in: 3dfbefc1c9 user: Beuc tags: trunk
Changes

Changes to 3.8/patches/python3-cross_compile.patch.

46
47
48
49
50
51
52
















+++ Python-3.8.3/config-emscripten.site
@@ -0,0 +1,5 @@
+# Required by ./configure
+ac_cv_file__dev_ptmx=no
+ac_cv_file__dev_ptc=no
+# Support dynamic linking
+ac_cv_func_dlopen=yes























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
+++ Python-3.8.3/config-emscripten.site
@@ -0,0 +1,5 @@
+# Required by ./configure
+ac_cv_file__dev_ptmx=no
+ac_cv_file__dev_ptc=no
+# Support dynamic linking
+ac_cv_func_dlopen=yes
--- Python-3.8.3/setup.py	2020-05-13 19:31:54.000000000 +0200
+++ build/Python-3.8.3/setup.py	2020-05-22 10:43:49.189946959 +0200
@@ -651,10 +651,10 @@
         if not CROSS_COMPILING:
             add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+            self.add_multiarch_paths()
         # only change this for cross builds for 3.3, issues on Mageia
-        if CROSS_COMPILING:
-            self.add_cross_compiling_paths()
-        self.add_multiarch_paths()
+        #if CROSS_COMPILING:
+        #    self.add_cross_compiling_paths()
         self.add_ldflags_cppflags()
 
     def init_inc_lib_dirs(self):

Changes to 3.8/python.sh.

40
41
42
43
44
45
46

47
48
49
50
51
52
53
..
76
77
78
79
80
81
82
83
84
85
86
87



88
89
90
91
92
93
94
        cd native/
        if [ ! -e config.status ]; then
            ../configure \
                --prefix=''
        fi

        make -j$(nproc)

        make install DESTDIR=$BUILD/hostpython
    )
}

emscripten () {
    cd $BUILD/Python-$VERSION/
    mkdir -p emscripten
................................................................................
EOF

        # Modules/Setup.local
        echo '*static*' > Modules/Setup.local
        cat $SETUPLOCAL >> Modules/Setup.local
        # drop -I/-L/-lz, we USE_ZLIB=1 (keep it in SETUPLOCAL for mock)
        sed -i -e 's/^\(zlib zlibmodule.c\).*/\1/' Modules/Setup.local
	# drop system include_dirs for cross-compilation
        sed -i -e 's/ self.add_multiarch_paths()/ #&/' ../setup.py
        # decrease .pyo size by dropping docstrings
        sed -i -e '/compileall.py/ s/ -O / -OO /' Makefile
    



        emmake make -j$(nproc)
        emmake make install DESTDIR=$DESTDIR

        # Basic trimming
        # Disabled for now, better cherry-pick the files we need
        #emmake make install DESTDIR=$(pwd)/destdir
        #find destdir/ -name "*.py" -print0 | xargs -r0 rm







>







 







<
<


|
>
>
>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
77
78
79
80
81
82
83


84
85
86
87
88
89
90
91
92
93
94
95
96
        cd native/
        if [ ! -e config.status ]; then
            ../configure \
                --prefix=''
        fi

        make -j$(nproc)
        rm -rf $BUILD/hostpython
        make install DESTDIR=$BUILD/hostpython
    )
}

emscripten () {
    cd $BUILD/Python-$VERSION/
    mkdir -p emscripten
................................................................................
EOF

        # Modules/Setup.local
        echo '*static*' > Modules/Setup.local
        cat $SETUPLOCAL >> Modules/Setup.local
        # drop -I/-L/-lz, we USE_ZLIB=1 (keep it in SETUPLOCAL for mock)
        sed -i -e 's/^\(zlib zlibmodule.c\).*/\1/' Modules/Setup.local


        # decrease .pyo size by dropping docstrings
        sed -i -e '/compileall.py/ s/ -O / -OO /' Makefile

        # Trigger setup.py:CROSS_COMPILING (introduced in 3.8)
        export _PYTHON_HOST_PLATFORM=emscripten

        emmake make -j$(nproc)
        emmake make install DESTDIR=$DESTDIR

        # Basic trimming
        # Disabled for now, better cherry-pick the files we need
        #emmake make install DESTDIR=$(pwd)/destdir
        #find destdir/ -name "*.py" -print0 | xargs -r0 rm

Changes to 3.8/webprompt.sh.

14
15
16
17
18
19
20

21
22




23
24
25
26
27
28
29

mkdir -p $BUILD

cython -3 ../emscripten.pyx -o $BUILD/emscripten.c
cython -3 ../emscripten_fetch.pyx -o $BUILD/emscripten_fetch.c
# utf_32_be: support Unicode characters e.g. u'é'
# __future__.py: for emscripten.pyx

PREFIX=$INSTALLDIR OUTDIR=$BUILD ./package-pythonhome.sh \
    encodings/utf_32_be.py __future__.py





FLAGS='-O3'
while (( $# )); do
    case "$1" in
	debug) FLAGS='-s ASSERTIONS=1 -g -s FETCH_DEBUG=1';;
	async) ASYNC='-s ASYNCIFY=1 -O3';;
    esac







>

|
>
>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

mkdir -p $BUILD

cython -3 ../emscripten.pyx -o $BUILD/emscripten.c
cython -3 ../emscripten_fetch.pyx -o $BUILD/emscripten_fetch.c
# utf_32_be: support Unicode characters e.g. u'é'
# __future__.py: for emscripten.pyx
# + some optional but common Python deps
PREFIX=$INSTALLDIR OUTDIR=$BUILD ./package-pythonhome.sh \
    encodings/utf_32_be.py __future__.py \
    struct.py operator.py datetime.py random.py functools.py types.py \
    collections/__init__.py collections/abc.py \
    pickle.py copyreg.py _compat_pickle.py keyword.py heapq.py reprlib.py \
    re.py sre_compile.py sre_parse.py sre_constants.py enum.py

FLAGS='-O3'
while (( $# )); do
    case "$1" in
	debug) FLAGS='-s ASSERTIONS=1 -g -s FETCH_DEBUG=1';;
	async) ASYNC='-s ASYNCIFY=1 -O3';;
    esac