Skip to content

Commit a76b3f6

Browse files
committed
3.1.30pre
1 parent 9ea301e commit a76b3f6

File tree

3 files changed

+129
-97
lines changed

3 files changed

+129
-97
lines changed

scripts/cpython-build-emsdk-deps.sh

Lines changed: 6 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,17 @@
22

33
. ${CONFIG:-config}
44

5-
# =============== ncurses ===========================
6-
# --disable-database --enable-termcap
7-
NCOPTS="--enable-ext-colors --enable-ext-mouse --prefix=$PREFIX --disable-echo --without-pthread \
8-
--without-tests --without-tack --without-progs --without-manpages \
9-
--disable-db-install --without-cxx --without-cxx-binding --enable-pc-files \
10-
--with-pkg-config-libdir=$PREFIX/lib/pkgconfig \
11-
--with-termlib --enable-termcap --disable-database"
125

13-
cd $ROOT/src
14-
15-
if true
16-
then
17-
18-
wget -q -c https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz && tar xfz ncurses-6.1.tar.gz
196

20-
pushd ncurses-6.1
21-
[ -f patch.done ] || patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten.patch
22-
touch patch.done
7+
for pkg in $ROOT/sources.wasm/*.sh
8+
do
9+
pushd $ROOT/src
10+
$pkg
2311
popd
12+
done
2413

25-
cd $ROOT
26-
27-
if [ -f devices/emsdk/usr/lib/libncursesw.a ]
28-
then
29-
echo "
30-
* ncursesw already built
31-
" 1>&2
32-
else
33-
mkdir -p build/ncurses/
3414

35-
# build wide char
36-
rm -rf build/ncurses/*
37-
38-
pushd build/ncurses
39-
make clean
40-
CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
41-
$NCOPTS --enable-widec && make && make install
42-
43-
popd
44-
fi
45-
46-
fi
15+
cd $ROOT/src
4716

4817
cd $ROOT
4918

@@ -142,60 +111,6 @@ else
142111
fi
143112

144113

145-
if true
146-
then
147-
148-
if true #[ -f ../devices/emsdk/usr/lib/libncurses.a ]
149-
then
150-
echo "
151-
* skiping [ncurses] or already built
152-
" 1>&2
153-
else
154-
rm -rf ../build/ncurses/*
155-
pushd ../build/ncurses
156-
157-
CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
158-
$NCOPTS && make && make install
159-
160-
CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
161-
$ROOT/src/ncurses-6.1/configure \
162-
$NCOPTS
163-
164-
if patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_make.patch
165-
then
166-
emmake make clean
167-
if emmake make
168-
then
169-
emmake make install
170-
fi
171-
fi
172-
popd
173-
fi
174-
175-
if [ -f ../devices/emsdk/usr/lib/libncursesw.a ]
176-
then
177-
echo "
178-
* ncursesw already built
179-
" 1>&2
180-
else
181-
# build wide char
182-
pushd ../build/ncurses
183-
184-
CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
185-
$ROOT/src/ncurses-6.1/configure $NCOPTS --enable-widec
186-
187-
if patch -p1 < $SDKROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_makew.patch
188-
then
189-
emmake make clean
190-
if emmake make
191-
then
192-
emmake make install
193-
fi
194-
fi
195-
popd
196-
fi
197-
fi
198-
199114
# TODO https://github.com/onelivesleft/PrettyErrors
200115

201116

scripts/cpython-build-emsdk.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@ export PYMINOR=\$(echo -n \$PYBUILD|cut -d. -f2)
290290
291291
export CARGO_HOME=\${CARGO_HOME:-/opt/python-rust-sdk}
292292
export RUSTUP_HOME=\${RUSTUP_HOME:-/opt/python-rust-sdk}
293-
export PATH=\${CARGO_HOME}/bin:$PATH
293+
export PATH=\${CARGO_HOME}/bin:\$PATH
294294
295+
export EMSDK_QUIET=1
295296
296297
if [[ ! -z \${EMSDK+z} ]]
297298
then
@@ -300,16 +301,17 @@ then
300301
else
301302
. ${SDKROOT}/config
302303
. ${SDKROOT}/emsdk/emsdk_env.sh
303-
export PATH=$SDKROOT/emsdk/upstream/emscripten/system/bin:\$PATH
304+
export PATH=$SDKROOT/emsdk/upstream/emscripten:$SDKROOT/emsdk/upstream/emscripten/system/bin:\$PATH
304305
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
306+
export NODE=\$(find \$EMSDK|grep /bin/node\$)
305307
fi
306308
307309
export SYS_PYTHON=${SYS_PYTHON}
308310
export EMSDK_PYTHON=${SYS_PYTHON}
309311
310-
export PATH=${HOST_PREFIX}/bin:\$PATH:${SDKROOT}/devices/emsdk/usr/bin
312+
export PATH=${HOST_PREFIX}/bin:\$PATH:\${SDKROOT}/devices/emsdk/usr/bin
311313
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
312-
export HOME=${SDKROOT}
314+
313315
export PLATFORM_TRIPLET=${PYDK_PYTHON_HOST_PLATFORM}
314316
export PREFIX=$PREFIX
315317
export PYTHONPYCACHEPREFIX=${PYTHONPYCACHEPREFIX:-$PYTHONPYCACHEPREFIX}

scripts/emsdk-fetch.sh

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,59 @@ then
2525
wget https://patch-diff.githubusercontent.com/raw/emscripten-core/emscripten/pull/17956.diff
2626
patch -p1 < 17956.diff
2727
popd
28+
29+
wget https://raw.githubusercontent.com/paradust7/minetest-wasm/main/emsdk_emcc.patch
30+
patch -p1 < emsdk_emcc.patch
31+
32+
# https://github.com/paradust7/minetest-wasm/blob/main/emsdk_dirperms.patch
33+
patch -p1 <<END
34+
--- emsdk-orig/upstream/emscripten/system/lib/wasmfs/wasmfs.cpp 2022-07-29 17:22:28.000000000 +0000
35+
+++ emsdk/upstream/emscripten/system/lib/wasmfs/wasmfs.cpp 2022-08-06 02:07:24.098196400 +0000
36+
@@ -141,7 +141,7 @@
37+
}
38+
39+
auto inserted =
40+
- lockedParentDir.insertDirectory(childName, S_IRUGO | S_IXUGO);
41+
+ lockedParentDir.insertDirectory(childName, S_IRUGO | S_IWUGO | S_IXUGO);
42+
assert(inserted && "TODO: handle preload insertion errors");
43+
}
44+
END
45+
# https://raw.githubusercontent.com/paradust7/minetest-wasm/main/emsdk_file_packager.patch
46+
patch -p1 << END
47+
--- emsdk1/upstream/emscripten/tools/file_packager.py 2022-03-24 19:45:39.000000000 +0000
48+
+++ emsdk2/upstream/emscripten/tools/file_packager.py 2022-03-22 10:13:11.332849695 +0000
49+
@@ -686,8 +686,12 @@
50+
use_data = '''// Reuse the bytearray from the XHR as the source for file reads.
51+
DataRequest.prototype.byteArray = byteArray;
52+
var files = metadata['files'];
53+
+ function make_callback(i) {
54+
+ var req = DataRequest.prototype.requests[files[i].filename];
55+
+ return () => {req.onload()};
56+
+ }
57+
for (var i = 0; i < files.length; ++i) {
58+
- DataRequest.prototype.requests[files[i].filename].onload();
59+
+ setTimeout(make_callback(i));
60+
}'''
61+
use_data += (" Module['removeRunDependency']('datafile_%s');\n"
62+
% js_manipulation.escape_for_js_string(data_target))
63+
END
64+
# https://raw.githubusercontent.com/paradust7/minetest-wasm/main/emsdk_setlk.patch
65+
patch -p1 << END
66+
--- emsdk-orig/upstream/emscripten/system/lib/wasmfs/syscalls.cpp 2022-07-29 17:22:28.000000000 +0000
67+
+++ emsdk/upstream/emscripten/system/lib/wasmfs/syscalls.cpp 2022-08-06 05:05:17.014502697 +0000
68+
@@ -1419,7 +1419,7 @@
69+
static_assert(F_SETLK == F_SETLK64);
70+
static_assert(F_SETLKW == F_SETLKW64);
71+
// Always error for now, until we implement byte-range locks.
72+
- return -EACCES;
73+
+ return 0; //-EACCES;
74+
}
75+
case F_GETOWN_EX:
76+
case F_SETOWN:
77+
END
78+
79+
80+
2881
popd
2982
fi
3083
fi
@@ -84,6 +137,14 @@ then
84137
cat > emsdk/upstream/emscripten/emcc <<END
85138
#!/bin/bash
86139
140+
EMCC_TRACE=\${EMCC_TRACE:-false}
141+
if \$EMCC_TRACE
142+
then
143+
echo "
144+
$@" >> $SDKROOT/emcc.log
145+
146+
fi
147+
87148
unset _EMCC_CCACHE
88149
89150
#if [ -z "\$_EMCC_CCACHE" ]
@@ -100,7 +161,16 @@ COMMON="-Wno-unsupported-floating-point-opt -Wno-unused-command-line-argument -W
100161
SHARED=""
101162
IS_SHARED=false
102163
PY_MODULE=false
103-
MVP=true
164+
MVP=\${MVP:true}
165+
LINKING=\${LINKING:-false}
166+
167+
if echo "\$@ "|grep -q "\\.so "
168+
then
169+
LINKING=true
170+
fi
171+
172+
173+
declare -A seen=( )
104174
105175
for arg do
106176
shift
@@ -117,23 +187,68 @@ for arg do
117187
exit 0
118188
fi
119189
190+
if \$LINKING
191+
then
192+
# prevent duplicates objects/archives files on cmdline when linking shared
193+
if echo \$arg|grep -q \\\\.o\$
194+
then
195+
[[ \${seen[\$arg]} ]] && continue
196+
fi
197+
if echo \$arg|grep -q \\\\.a\$
198+
then
199+
[[ \${seen[\$arg]} ]] && continue
200+
fi
201+
if echo \$arg|grep -q ^-l
202+
then
203+
[[ \${seen[\$arg]} ]] && continue
204+
fi
205+
seen[\$arg]=1
206+
fi
207+
208+
arg_is_bad=false
209+
210+
for badarg in "-Wl,--as-needed" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-Wl,-znow" "-Wl,-zrelro" "-Wl,-zrelro,-znow"
211+
do
212+
if [ "\$arg" = "\$badarg" ]
213+
then
214+
arg_is_bad=true
215+
break
216+
fi
217+
done
218+
219+
if \$arg_is_bad
220+
then
221+
continue
222+
fi
223+
120224
if [ "\$arg" = "-fallow-argument-mismatch" ]
121225
then
122226
continue
123227
fi
124228
229+
if [ "\$arg" = "-lutil" ]
230+
then
231+
continue
232+
fi
233+
125234
if [ "\$arg" = "-lgcc" ]
126235
then
127236
continue
128237
fi
129238
239+
if [ "\$arg" = "-lgcc_s" ]
240+
then
241+
continue
242+
fi
243+
130244
if [ "\$arg" = "-nomvp" ]
131245
then
132246
MVP=false
133247
continue
134248
fi
135249
136-
# that is for some very bad setup.py behaviour regarding cross compiling. should not be needed ..
250+
# that is for some very bad setup.py behaviour regarding cross compiling.
251+
# should not be needed ..
137252
[ "\$arg" = "-I/usr/include" ] && continue
138253
[ "\$arg" = "-I/usr/include/SDL2" ] && continue
139254
[ "\$arg" = "-L/usr/lib64" ] && continue

0 commit comments

Comments
 (0)