From ec1a32d96e239269bb8324001c65fc6383cecfe8 Mon Sep 17 00:00:00 2001 From: pmp-p Date: Wed, 2 Oct 2024 18:32:43 +0200 Subject: [PATCH] 3.1.69.0bi --- .github/workflows/ci.yml | 2 +- scripts/cpython-fetch.sh | 25 +++++++++++++++------ scripts/pack-sdk.sh | 1 + sources.wasm/w2c2.sh | 43 ++++++++++++++++++++++++++++++++++++ wasisdk/hotfix/patch.h | 34 +++++++++++++++++++--------- wasisdk/hotfix/sys/termios.h | 0 6 files changed, 86 insertions(+), 19 deletions(-) create mode 100755 sources.wasm/w2c2.sh create mode 100644 wasisdk/hotfix/sys/termios.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c951e35..08b5b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/scripts/cpython-fetch.sh b/scripts/cpython-fetch.sh index 85bbc26..3b933fd 100755 --- a/scripts/cpython-fetch.sh +++ b/scripts/cpython-fetch.sh @@ -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 <md_gil = gil; + return 0; +END popd diff --git a/scripts/pack-sdk.sh b/scripts/pack-sdk.sh index 96e501e..0caf236 100644 --- a/scripts/pack-sdk.sh +++ b/scripts/pack-sdk.sh @@ -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 diff --git a/sources.wasm/w2c2.sh b/sources.wasm/w2c2.sh new file mode 100755 index 0000000..b721ebb --- /dev/null +++ b/sources.wasm/w2c2.sh @@ -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 + diff --git a/wasisdk/hotfix/patch.h b/wasisdk/hotfix/patch.h index 5aa1cb0..1dcc31b 100644 --- a/wasisdk/hotfix/patch.h +++ b/wasisdk/hotfix/patch.h @@ -158,7 +158,7 @@ getpid(void) { } -static pid_t +static pid_t getppid(void) { char *val = getenv("WASIX_PPID"); char *end = val + strlen(val); @@ -183,7 +183,7 @@ geteuid(void) { return 1000; } -static mode_t +static mode_t umask(mode_t mask) { return 18; } @@ -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; @@ -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; diff --git a/wasisdk/hotfix/sys/termios.h b/wasisdk/hotfix/sys/termios.h new file mode 100644 index 0000000..e69de29