Skip to content

Commit c8db4f0

Browse files
committed
absolute path in tarball, more fixes
1 parent dd3e2af commit c8db4f0

File tree

8 files changed

+79
-25
lines changed

8 files changed

+79
-25
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Install dependencies
3838
run: |
3939
sudo apt-get update --fix-missing
40-
# git clang libffi-dev libssl-dev zlib1g-dev libncursesw5-dev make
40+
# git clang libffi-dev libssl-dev zlib1g-dev libncursesw5-dev python3-pip make
4141
sudo apt-get install -y bash wget
4242
4343
- name: Build sdk

config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ then
6363
echo -n
6464
else
6565
mkdir -p src
66-
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
66+
export PKG_CONFIG_PATH="${HOST_PREFIX}/lib/pkgconfig"
6767
export PATH="${HOST_PREFIX}/bin:$PATH"
6868
export PYDK=minimal
6969
fi

python-wasm-sdk.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ then
2020

2121
. scripts/cpython-fetch.sh
2222
. support/__EMSCRIPTEN__.sh
23-
. scripts/cpython-build-host.sh >/dev/null
24-
. scripts/cpython-build-host-deps.sh >/dev/null
23+
. scripts/cpython-build-host.sh
24+
# >/dev/null
25+
. scripts/cpython-build-host-deps.sh
26+
# >/dev/null
2527

2628
# use ./ or emsdk will pollute env
2729
./scripts/emsdk-fetch.sh
@@ -36,14 +38,15 @@ then
3638
cd /
3739
rm -rf ${SDKDIR}/emsdk/upstream/emscripten/cache/ports*
3840
mkdir -p /tmp/sdk
39-
tar -cpRj \
40-
.${SDKDIR}/config \
41-
.${SDKDIR}/build/pycache/sysconfig/_sysconfigdata__emscripten_debug.py \
42-
.${SDKDIR}/python3-wasm \
43-
.${SDKDIR}/wasm32-*-shell.sh \
44-
.${SDKDIR}/emsdk \
45-
.${SDKDIR}/devices/* \
46-
.${SDKDIR}/prebuilt/* \
41+
tar -cpPRj \
42+
${SDKDIR}/config \
43+
${SDKDIR}/build/pycache/.??* \
44+
${SDKDIR}/build/pycache/sysconfig/_sysconfigdata__emscripten_debug.py \
45+
${SDKDIR}/python3-wasm \
46+
${SDKDIR}/wasm32-*-shell.sh \
47+
${SDKDIR}/emsdk \
48+
${SDKDIR}/devices/* \
49+
${SDKDIR}/prebuilt/* \
4750
> /tmp/sdk/python-wasm-sdk-stable.tar.bz2
4851
else
4952
echo " cpython-build-emsdk-deps failed"

scripts/cpython-build-emsdk-deps.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
. ./scripts/emsdk-fetch.sh
66

7+
8+
HPFX=./devices/x86_64/usr/lib/python3.11
9+
rm ./devices/emsdk/usr/lib/python3.11/ensurepip/_bundled/setuptools-*-py3-none-any.whl
10+
cp -Rf $HPFX/setuptool* ./devices/emsdk/usr/lib/python3.11/
11+
cp -Rf $HPFX/_distutils* ./devices/emsdk/usr/lib/python3.11/
12+
cp -Rf $HPFX/pkg_resources ./devices/emsdk/usr/lib/python3.11/
13+
14+
715
# ../../devices/x86_64/usr/bin/python3-wasm -mpip install .
816
# not working because python startup is skipped
917

scripts/cpython-build-emsdk.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ else
121121

122122
# CFLAGS="-DHAVE_FFI_PREP_CIF_VAR=1 -DHAVE_FFI_PREP_CLOSURE_LOC=1 -DHAVE_FFI_CLOSURE_ALLOC=1"
123123

124-
CONFIG_SITE=$ROOT/src/cpython/Tools/wasm/config.site-wasm32-emscripten\
124+
CONFIG_SITE=$ROOT/src/cpython/Tools/wasm/config.site-wasm32-emscripten \
125125
OPT="$CPOPTS -DNDEBUG -fwrapv" \
126126
eval emconfigure $ROOT/src/cpython/configure -C --without-pymalloc --disable-ipv6 \
127127
--cache-file=${PYTHONPYCACHEPREFIX}/config.cache \
@@ -191,6 +191,15 @@ do
191191
fi
192192
done
193193
194+
for arg do
195+
shift
196+
[ "\$arg" = "-I/usr/include" ] && continue
197+
[ "\$arg" = "-I/usr/include/SDL2" ] && continue
198+
[ "\$arg" = "-L/usr/lib64" ] && continue
199+
[ "\$arg" = "-L/usr/lib" ] && continue
200+
set -- "\$@" "\$arg"
201+
done
202+
194203
SHARED=""
195204
IS_SHARED=false
196205
@@ -223,6 +232,12 @@ set tabsize 4
223232
set tabstospaces
224233
END
225234

235+
cat >${PYTHONPYCACHEPREFIX}/.numpy-site.cfg <<NUMPY
236+
[DEFAULT]
237+
library_dirs = $PREFIX/lib
238+
include_dirs = $PREFIX/include
239+
NUMPY
240+
226241
cat > $ROOT/${PYDK_PYTHON_HOST_PLATFORM}-shell.sh <<END
227242
#!/bin/bash
228243
@@ -233,10 +248,11 @@ then
233248
else
234249
. ${ROOT}/config
235250
. ${ROOT}/emsdk/emsdk_env.sh
251+
export PATH=$ROOT/emsdk/upstream/emscripten/system/bin:\$PATH
252+
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
236253
fi
237254
238255
export PATH=${HOST_PREFIX}/bin:\$PATH
239-
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
240256
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
241257
export HOME=${PYTHONPYCACHEPREFIX}
242258
export PLATFORM_TRIPLET=${PYDK_PYTHON_HOST_PLATFORM}
@@ -250,12 +266,6 @@ export PS1="[PyDK:wasm] \w $ "
250266
251267
export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__emscripten_
252268
253-
cat >${PYTHONPYCACHEPREFIX}/.numpy-site.cfg <<NUMPY
254-
[DEFAULT]
255-
library_dirs = $PREFIX/lib
256-
include_dirs = $PREFIX/include
257-
NUMPY
258-
259269
END
260270

261271
cat > $HOST_PREFIX/bin/python3-wasm <<END

scripts/cpython-build-host-deps.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ echo "
88
# https://stackoverflow.com/questions/6301003/stopping-setup-py-from-installing-as-egg
99
# python3 setup.py install --single-version-externally-managed --root=/
1010

11+
# just in case
12+
$PIP install pip --upgrade
13+
1114
# to remove ctypes deps
1215
$PIP install setuptools --upgrade
1316

14-
# just in case
15-
$PIP install pip --upgrade
17+
HPFX=./devices/x86_64/usr/lib/python3.11
18+
rm $HPFX/ensurepip/_bundled/setuptools-*-py3-none-any.whl
19+
mv $HPFX/site-packages/setuptool* $HPFX/
20+
mv $HPFX/site-packages/_distutils* $HPFX/
21+
mv $HPFX/site-packages/pkg_resources $HPFX/
22+
23+
1624

1725
export CC=clang
1826

scripts/cpython-build-host.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,31 @@ then
3131

3232

3333
#export OPT="$CPOPTS -DNDEBUG -fwrapv"
34+
cat $ROOT/src/cpython/Tools/wasm/config.host-wasm32-emscripten <<END
35+
ac_cv_lib_intl_textdomain=no
36+
ac_cv_func_bind_textdomain_codeset=no
37+
END
38+
39+
CONFIG_SITE=$ROOT/src/cpython/Tools/wasm/config.host-wasm32-emscripten \
3440
PYOPTS="--disable-ipv6 \
3541
--with-c-locale-coercion --without-pymalloc --without-pydebug \
3642
--with-ensurepip\
3743
--with-decimal-contextvar --disable-shared \
3844
--with-computed-gotos"
3945

46+
cat >> pyconfig.h <<END
47+
#ifdef HAVE_LIBINTL_H
48+
#undef HAVE_LIBINTL_H
49+
#endif
50+
51+
#ifdef WITH_LIBINTL
52+
#undef WITH_LIBINTL
53+
#endif
54+
55+
END
56+
57+
58+
4059
# Prevent freezing bytecode with a different magic
4160
rm -f $HOST_PREFIX/bin/python3*
4261

@@ -66,6 +85,9 @@ then
6685
eval make -j$(nproc) install $QUIET
6786
rm -rf $(find $ROOT/devices/ -type d|grep __pycache__$)
6887

88+
patchelf --remove-needed libintl.so.8 $HOST_PREFIX/bin/python3.11
89+
sed -i 's|-lintl ||g' /opt/python-wasm-sdk/devices/x86_64/usr/bin/python3.11-config
90+
6991
cp -Rfv $ROOT/support/__EMSCRIPTEN__.patches/. $HOST_PREFIX/lib/python3.??/
7092
else
7193
echo "

scripts/emsdk-fetch.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ then
2222
./emsdk install tot
2323
./emsdk activate tot
2424
popd
25-
tar -cpR emsdk > emsdk.tar
25+
[ -f dev ] && tar -cpR emsdk > emsdk.tar
2626
fi
2727
fi
2828

29-
3029
if [ -f emsdk/emsdk_env.sh ]
3130
then
3231
echo "
@@ -79,7 +78,9 @@ then
7978
#embuilder build $one
8079
done
8180

82-
#tar xvfp emsdk-fix.tar
81+
82+
# -Wno-limited-postlink-optimizations
83+
8384

8485
cat > emsdk/upstream/emscripten/emcc <<END
8586
#!/bin/bash
@@ -134,6 +135,8 @@ END
134135
sync
135136
fi
136137

138+
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
139+
137140
if echo $PATH|grep -q $EMSDK/upstream/emscripten/system/bin
138141
then
139142
# emsdk env does not set it, but it's required for eg sdl2-config

0 commit comments

Comments
 (0)