Skip to content

Commit

Permalink
3.1.69.0bi
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Oct 2, 2024
1 parent 1ceb82c commit ec1a32d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-22.04
env:
BUILDS: 3.12 3.13
EMFLAVOUR: 3.1.68
EMFLAVOUR: tot

steps:
- uses: actions/checkout@v3.3.0
Expand Down
25 changes: 18 additions & 7 deletions scripts/cpython-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,29 @@ fi

if echo $PYBUILD |grep -q 13$
then
# wget -q -c https://www.python.org/ftp/python/3.13.0/Python-3.13.0rc1.tar.xz
# tar xf Python-3.13.0rc1.tar.xz
# ln -s Python-3.13.0rc1 cpython${PYBUILD}

wget -q -c https://www.python.org/ftp/python/3.13.0/Python-3.13.0rc2.tar.xz
tar xf Python-3.13.0rc2.tar.xz
ln -s Python-3.13.0rc2 cpython${PYBUILD}
wget -q -c https://www.python.org/ftp/python/3.13.0/Python-3.13.0rc3.tar.xz
tar xf Python-3.13.0rc3.tar.xz
ln -s Python-3.13.0rc3 cpython${PYBUILD}

mkdir $ROOT/devices/emsdk/usr/lib $ROOT/devices/$(arch)/usr/lib -p
ln -s $ROOT/devices/$(arch)/usr/lib/python3.13t $ROOT/devices/$(arch)/usr/lib/python3.13
ln -s $ROOT/devices/emsdk/usr/lib/python3.13t $ROOT/devices/emsdk/usr/lib/python3.13
pushd cpython${PYBUILD}
patch -p1 <<END
--- Python-3.13.0rc3/Objects/moduleobject.c 2024-10-01 04:03:08.000000000 +0200
+++ Python-3.13.0rc3.wasm/Objects/moduleobject.c 2024-10-02 13:16:33.030387509 +0200
@@ -442,8 +442,8 @@
PyUnstable_Module_SetGIL(PyObject *module, void *gil)
{
if (!PyModule_Check(module)) {
- PyErr_BadInternalCall();
- return -1;
+ //PyErr_BadInternalCall();
+ return 0;
}
((PyModuleObject *)module)->md_gil = gil;
return 0;
END

popd

Expand Down
1 change: 1 addition & 0 deletions scripts/pack-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tar -cpPR \
${SDKROOT}/scripts/*sdk-fetch.sh \
${SDKROOT}/devices/* \
${SDKROOT}/prebuilt/* \
${SDKROOT}/native \
> /tmp/sdk/python${PYBUILD}-${TAG}-sdk-${CIVER}.tar
lz4 -c --favor-decSpeed --best /tmp/sdk/python${PYBUILD}-${TAG}-sdk-${CIVER}.tar \
> /tmp/sdk/python${PYBUILD}-${TAG}-sdk-${CIVER}.tar.lz4
Expand Down
43 changes: 43 additions & 0 deletions sources.wasm/w2c2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# TODO make it wasm

. ${CONFIG:-config}

mkdir -p src native build/libdwarf build/zstd


pushd src
[ -d libdwarf-code ] || git clone --recursive --no-tags --depth 1 --single-branch --branch main https://github.com/davea42/libdwarf-code
[ -d w2c2 ] || git clone --recursive --no-tags --depth 1 --single-branch --branch main https://github.com/pygame-web/w2c2
wget -c -q https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz
tar xfz zstd-1.5.6.tar.gz
popd

if [ -f $HOST_PREFIX/lib/libzstd.a ]
then
echo "zstd already built"
else
pushd build/zstd
cmake -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=$HOST_PREFIX ../../src/zstd-1.5.6/build/cmake
make -j $(nproc) && make install
popd
fi

if [ -f $HOST_PREFIX/bin/dwarfdump ]
then
echo "libdarwf already built"
else
pushd build/libdwarf
cmake -DCMAKE_INSTALL_LIBDIR=lib -DENABLE_DECOMPRESSION=False -DCMAKE_INSTALL_PREFIX=$HOST_PREFIX ../../src/libdwarf-code
make install
popd
fi

pushd native

cmake -DCMAKE_INSTALL_PREFIX=$HOST_PREFIX ${SDKROOT}/src/w2c2 \
-DDWARF_FOUND=1 -DDWARF_LIBRARIES="-ldwarf -lzstd" -DDWARF_LIBRARY_DIRS=$HOST_PREFIX/lib -DDWARF_INCLUDE_DIRS=$HOST_PREFIX/include
make
popd

34 changes: 23 additions & 11 deletions wasisdk/hotfix/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ getpid(void) {
}


static pid_t
static pid_t
getppid(void) {
char *val = getenv("WASIX_PPID");
char *end = val + strlen(val);
Expand All @@ -183,7 +183,7 @@ geteuid(void) {
return 1000;
}

static mode_t
static mode_t
umask(mode_t mask) {
return 18;
}
Expand Down Expand Up @@ -215,20 +215,23 @@ kill(pid_t pid, int sig) {

typedef uint32_t socklen_t;


static int
fd_sock = 100;

static int
socket(int domain, int type, int protocol) {
return fd_sock++;
}

static int
bind(int socket, void *address, socklen_t address_len) {
return 0;
}



#if defined(PYDK)

extern ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, void *address, socklen_t *address_len);
extern int socket(int domain, int type, int protocol);
extern ssize_t sendto(int socket, const void *message, size_t length, int flags, void *dest_addr, socklen_t dest_len);
extern int connect(int socket, void *address, socklen_t address_len);


#else

static int
connect(int socket, void *address, socklen_t address_len) {
return 0;
Expand All @@ -238,12 +241,21 @@ static ssize_t
sendto(int socket, const void *message, size_t length, int flags, void *dest_addr, socklen_t dest_len) {
return 0;
}
static int
fd_sock = 100;

static ssize_t
recvfrom(int socket, void *buffer, size_t length, int flags, void *address, socklen_t *address_len) {
return 0;
}

static int
socket(int domain, int type, int protocol) {
return fd_sock++;
}

#endif

static int
setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len) {
return 0;
Expand Down
Empty file added wasisdk/hotfix/sys/termios.h
Empty file.

0 comments on commit ec1a32d

Please sign in to comment.