4848 echo -n
4949 else
5050 pushd src 2>&1 > /dev/null
51- git clone https://github.com/pmp-p/libffi-emscripten.git libffi
51+ # git clone https://github.com/pmp-p/libffi-emscripten.git libffi
52+ git clone --no-tags --depth 1 --single-branch --branch master https://github.com/libffi/libffi
53+ pushd libffi
54+ ./autogen.sh
55+ popd
5256 popd
5357 fi
5458
5963# and no loder lib-dynload in the way.
6064
6165 EMCC_CFLAGS=" -O0 -g0 -fPIC" CFLAGS=" -O0 -g0 -fPIC" CC=${SDKROOT} /emsdk/upstream/emscripten/emcc \
62- emconfigure $ROOT /src/libffi/configure --host=wasm32-mvp -emscripten\
66+ emconfigure $ROOT /src/libffi/configure --host=wasm32-bi -emscripten\
6367 --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking\
6468 --disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs
6569
160164
161165
162166
167+ # _ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -ldl -lffi -DHAVE_FFI_PREP_CIF_VAR -DHAVE_FFI_PREP_CLOSURE_LOC -DHAVE_FFI_CLOSURE_ALLOC
168+
169+
170+ # *shared*
171+ # _ctypes_test _ctypes/_ctypes_test.c
172+ # _testcapi _testcapimodule.c
173+ # _testimportmultiple _testimportmultiple.c
174+ # _testmultiphase _testmultiphase.c
175+
176+
177+
178+
163179# OPT="$CPOPTS -DNDEBUG -fwrapv" \
164180# --with-c-locale-coercion --without-pydebug --without-pymalloc --disable-ipv6 \
165181
188204
189205 # echo "#define HAVE_NCURSES_H" >> pyconfig.h
190206
207+ # prevent an error in install when byte compiling is disabled.
208+ mkdir -p ${ROOT} /devices/emsdk/usr/lib/python${PYMAJOR} .${PYMINOR} /lib-dynload/__pycache__
191209
192210 if emmake make -j$NPROC WASM_ASSETS_DIR=$( realpath ${PYTHONPYCACHEPREFIX} /empty) @/
193211 then
217235 fi
218236
219237
238+ if pushd ${SDKROOT} /build/cpython-wasm
239+ then
240+ mkdir -p ${SDKROOT} /prebuilt/emsdk
241+ OBJS=" build/temp.emscripten-wasm32-${PYBUILD} /opt/python-wasm-sdk/src/Python-3.11.5/Modules/_ctypes/_ctypes.o \
242+ build/temp.emscripten-wasm32-${PYBUILD} /opt/python-wasm-sdk/src/Python-3.11.5/Modules/_ctypes/callbacks.o \
243+ build/temp.emscripten-wasm32-${PYBUILD} /opt/python-wasm-sdk/src/Python-3.11.5/Modules/_ctypes/callproc.o \
244+ build/temp.emscripten-wasm32-${PYBUILD} /opt/python-wasm-sdk/src/Python-3.11.5/Modules/_ctypes/cfield.o \
245+ build/temp.emscripten-wasm32-${PYBUILD} /opt/python-wasm-sdk/src/Python-3.11.5/Modules/_ctypes/stgdict.o"
246+
247+ $SDKROOT /emsdk/upstream/emscripten/emar rcs ${SDKROOT} /prebuilt/emsdk/lib_ctypes${PYBUILD} .a $OBJS
248+ popd
249+ fi
250+
251+
220252 rm -rf $( find $ROOT /devices/ -type d| grep /__pycache__$)
221253
222254 popd
@@ -229,11 +261,15 @@ END
229261 # move them to MEMFS
230262 mv $PREFIX /lib/python${PYBUILD} /lib-dynload/* ${SDKROOT} /prebuilt/emsdk/${PYBUILD} /lib-dynload/
231263
264+ echo " =============== FIXME: _ctype dynamic build ==============="
265+ rm ${SDKROOT} /prebuilt/emsdk/${PYBUILD} /lib-dynload/_ctypes.*
266+ rm ${SDKROOT} /prebuilt/emsdk/${PYBUILD} /lib-dynload/xxlimited*
267+
232268 # specific platform support
233269 cp -Rfv $ROOT /support/__EMSCRIPTEN__.patches/${PYBUILD} /. $PREFIX /lib/python${PYBUILD} /
234270
235271 cp -vf build/cpython-wasm/libpython${PYBUILD} .a prebuilt/emsdk/
236- for lib in $( find build/cpython-wasm/| grep lib.* .a$)
272+ for lib in $( find build/cpython-wasm/| grep -v /libpython3 | grep lib.* .a$)
237273 do
238274 name=$( basename $lib .a)
239275 cp $lib prebuilt/emsdk/${name}${PYBUILD} .a
373409" 1>&2
374410 cp -rf $HPFX /${moveit} $TPFX /
375411 cp -rf $HPFX /${moveit} -* $TPFX /
412+ cp -rf $HPFX /site-package/${moveit} $TPFX /site-package/
413+ cp -rf $HPFX /site-package/${moveit} -* $TPFX /site-package/
376414done
377415
378416
0 commit comments