Skip to content

Commit

Permalink
24.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Dec 3, 2024
1 parent a594b68 commit 6fb7f15
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 22 deletions.
3 changes: 2 additions & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ EXTRABINS="/usr/local/bin /opt/bin"
# stable==latest dev==tot
export EMFLAVOUR=${EMFLAVOUR:latest}
export EMSDK_QUIET=1

export EMSDK_NOTTY=0
export EMSDK_VERBOSE=0

#temp fix for oom on CI (Error: Process completed with exit code 143.)
export EMSDK_NUM_CORES=1
Expand Down
5 changes: 4 additions & 1 deletion lang/rustsdk.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
*#!/bin/bash

export SDKROOT=${SDKROOT:-/tmp/sdk}

Expand All @@ -17,4 +17,7 @@ rustup target add wasm32-unknown-unknown
rustup target add wasm32-unknown-emscripten
rustup target add wasm32-wasip1

# error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35`
# LLVM_CONFIG_PATH=${SDKROOT}/wasisdk/upstream/bin/llvm-config cargo install c2rust


13 changes: 6 additions & 7 deletions scripts/cpython-build-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ then
unset CPPFLAGS
unset LDFLAGS

#export OPT="$CPOPTS -DNDEBUG -fwrapv"
mkdir -p $ROOT/src/cpython${PYBUILD}/Tools/wasm
cat > $ROOT/src/cpython${PYBUILD}/Tools/wasm/config.host-wasm32-emscripten <<END
ac_cv_lib_intl_textdomain=no
Expand Down Expand Up @@ -101,27 +100,27 @@ END
fi
fi

# CFLAGS="-fPIC" CPPFLAGS="-fPIC"
CNF="${ROOT}/src/cpython${PYBUILD}/configure \
CNF="${ROOT}/src/cpython${PYBUILD}/configure \
--prefix=$HOST_PREFIX $PYOPTS $GIL"
if CC=clang CXX=clang++ $CNF
if CC="clang" CXX="clang++" CCSHARED="-fPIC" $CNF
then

if make -j$(nproc)
then
if make install
then
echo "CPython $PYTHON_FOR_BUILD ready" 1>&2
else
echo "CPython $PYTHON_FOR_BUILD failed to install" 1>&2
exit 117
exit 114
fi
else
echo "
failed to build $PYTHON_FOR_BUILD
CC=clang CXX=clang++ $CNF
" 1>&2
exit 125
exit 122
fi
else
echo "
Expand All @@ -134,7 +133,7 @@ CC=clang CXX=clang++ $CNF
==========================================================================
" 1>&2
exit 149
exit 135
fi

popd
Expand Down
5 changes: 4 additions & 1 deletion scripts/cpython-build-wasisdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ END
fi
popd

# now libmpdec.a is correctly linked in libpython.
if false
then
pushd ${SDKROOT}/wasisdk
if [ -f libpython${PYBUILD}.a ]
then
Expand All @@ -113,7 +116,7 @@ END
wasi-c -nostdlib -fpic -r -Wl,--whole-archive -o libpython${PYBUILD}.o $LINKALL
llvm-ar rcs ${PREFIX}/lib/libpython${PYBUILD}.a libpython${PYBUILD}.o
popd

fi

else
echo cannot find PYTHON_FOR_BUILD=$PYTHON_FOR_BUILD
Expand Down
25 changes: 15 additions & 10 deletions scripts/cpython-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo "

mkdir -p src

pushd src 2>&1 >/dev/null
pushd src

NOPATCH=false
PYPATCH=true
Expand All @@ -22,7 +22,7 @@ if echo $PYBUILD |grep -q 15$
then
if [ -d cpython${PYBUILD} ]
then
pushd cpython${PYBUILD} 2>&1 >/dev/null
pushd cpython${PYBUILD}
# put the tree back to original state so we can pull
# Programs/python.c Modules/readline.c
git restore .
Expand All @@ -44,9 +44,9 @@ fi

if echo $PYBUILD |grep -q 14$
then
wget -c https://www.python.org/ftp/python/3.14.0/Python-3.14.0a1.tar.xz
tar xf Python-3.14.0a1.tar.xz
ln -s Python-3.14.0a1 cpython${PYBUILD}
wget -c https://www.python.org/ftp/python/3.14.0/Python-3.14.0a2.tar.xz
tar xf Python-3.14.0a2.tar.xz
ln -s Python-3.14.0a2 cpython${PYBUILD}

mkdir $ROOT/devices/emsdk/usr/lib $ROOT/devices/$(arch)/usr/lib -p

Expand Down Expand Up @@ -133,9 +133,9 @@ popd
# 3.10 is not wasm stable
if [ -f support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff ]
then
pushd src/cpython${PYBUILD} 2>&1 >/dev/null
pushd src/cpython${PYBUILD}
patch -p1 < ../../support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff
popd 2>&1 >/dev/null
popd
fi


Expand All @@ -147,10 +147,15 @@ if $NOPATCH
then
echo "finally there"
else
# do some patching for 3.11+ to allow more shared libs
pushd src/cpython${PYBUILD} 2>&1 >/dev/null
pushd src/cpython${PYBUILD}

# do some patching for 3.11+ to allow shared libs and move js to pymain
patch -p1 < ../../support/__EMSCRIPTEN__.embed/cpython${PYBUILD}.diff
popd 2>&1 >/dev/null

# patch host to be PIC
patch -p1 < ../../support/hostpic.diff

popd
fi

echo "
Expand Down
4 changes: 2 additions & 2 deletions support/__EMSCRIPTEN__.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ END
#include "Python.h"
#if __PYDK__
#if defined(__PYGBAG__)
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_initconfig.h" // _PyArgv
#include "pycore_interp.h" // _PyInterpreterState.sysdict
Expand Down Expand Up @@ -108,7 +108,7 @@ main(int argc, char **argv)
return Py_BytesMain(argc, argv);
}
#endif //#if __PYDK__
#endif // __PYGBAG__
END

popd
Expand Down
13 changes: 13 additions & 0 deletions support/hostpic.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- cpython3.13/Makefile.pre.in 2024-12-03 07:51:52.083841661 +0100
+++ cpython3.13-pic/Makefile.pre.in 2024-12-03 07:54:00.742976111 +0100
@@ -34,8 +34,8 @@
abs_builddir= @abs_builddir@


-CC= @CC@
-CXX= @CXX@
+CC=@CC@ -fPIC
+CXX=@CXX@ -fPIC
LINKCC= @LINKCC@
AR= @AR@
READELF= @READELF@

0 comments on commit 6fb7f15

Please sign in to comment.