Skip to content

Commit

Permalink
3.1.74.0pre
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Dec 16, 2024
1 parent f11abac commit 2b0e746
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
gosdk: false
rustsdk: false
nimsdk: false
COPTS: -Os -g3
COPTS: -Os -g0

steps:
- uses: actions/[email protected]
Expand Down
9 changes: 3 additions & 6 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ export XDG_DATA_HOME=${HOME}/build/share
export XDG_CACHE_HOME=${HOME}/build/cache
export XDG_CONFIG_HOME=${HOME}/build/config
export XDG_DATA_DIRS=${HOME}/build/share

mkdir -p $XDG_DATA_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME

export PIP_ROOT_USER_ACTION=ignore
export PIP_NO_CACHE_DIR=1
export HPY=${HOST_PREFIX}/bin/python${PYBUILD}
export HPIP="${HPY} -mpip"

# cpython build opts
export CPOPTS="-Os -g0 -fPIC"


# base wasm features pure is "mvp" , "bi" is bigint

if [ -f /mvp ]
Expand Down Expand Up @@ -154,7 +151,7 @@ done

# this is python used for emsdk : ${SYS_PYTHON} -> ${EMSDK_PYTHON}
# sane default
export SYS_PYTHON=$(command -v python${PYMAJOR})
export SYS_PYTHON=python${PYMAJOR}
for py in 10 9 8
do
if command -v python${PYMAJOR}.${py} >/dev/null
Expand Down
2 changes: 1 addition & 1 deletion emsdk-cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ else:
try:
with open(AOUT, "w") as file:
file.write("#!/usr/bin/env bash\n")
file.write('node $0.cjs "$@"\n')
file.write(os.environ.get('SYS_NODE', '/usr/bin/node')+' $0.cjs "$@"\n')
except Exception as e:
dbg("ERROR: 306", e)
os.rename(AOUT + ".cjs", AOUT)
Expand Down
29 changes: 20 additions & 9 deletions python-wasi-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ reset
# TODO: check how dbg tools work with default settings
# https://developer.chrome.com/blog/wasm-debugging-2020/

if command -v python3
mkdir -p /tmp/sdk-bin
export PATH=/tmp/sdk-bin:$PATH

which command || cat > /tmp/sdk-bin/command << END
#!/bin/bash
shift
which $1
END
chmod +x /tmp/sdk-bin/command


if which python3
then
SYS_PYTHON=$(command -v python3)
SYS_PYTHON=$(which python3)
else
SYS_PYTHON=$(command -v python)
SYS_PYTHON=$(which python)
fi

DISTRIB_RELEASE="any"
DISTRIB_RELEASE=${DISTRIB_RELEASE:-any}

# is it linux enough ?
if [ -f /etc/lsb-release ]
Expand All @@ -20,10 +31,10 @@ then
export PLATFORM=linux
else
# or not
export DISTRIB_ID=$($SYS_PYTHON -E -c "print(__import__('sys').platform)")
echo no /etc/lsb-release found, please identify platform '$DISTRIB_ID'
DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
exit 1
export DISTRIB_ID=$($SYS_PYTHON -E -c "print(__import__('sysconfig').get_config_var('HOST_GNU_TYPE'))")
export PLATFORM=$($SYS_PYTHON -E -c "print(__import__('sys').platform)")
echo no /etc/lsb-release found, please identify platform $PLATFORM : \"${DISTRIB_ID}-${DISTRIB_RELEASE}\" or hit enter to continue
read
fi

export DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
Expand Down Expand Up @@ -60,7 +71,7 @@ do
fi
done

if [ -d ${SDKROOT} ]
if mkdir -p ${SDKROOT}
then
echo "Assuming destination $SDKROOT is ready"
else
Expand Down
29 changes: 20 additions & 9 deletions python-wasm-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ reset
# TODO: check how dbg tools work with default settings
# https://developer.chrome.com/blog/wasm-debugging-2020/

if command -v python3
mkdir -p /tmp/sdk-bin
export PATH=/tmp/sdk-bin:$PATH

which command || cat > /tmp/sdk-bin/command << END
#!/bin/bash
shift
which $1
END
chmod +x /tmp/sdk-bin/command


if which python3
then
SYS_PYTHON=$(command -v python3)
SYS_PYTHON=$(which python3)
else
SYS_PYTHON=$(command -v python)
SYS_PYTHON=$(which python)
fi

DISTRIB_RELEASE="any"
DISTRIB_RELEASE=${DISTRIB_RELEASE:-any}

# is it linux enough ?
if [ -f /etc/lsb-release ]
Expand All @@ -20,10 +31,10 @@ then
export PLATFORM=linux
else
# or not
export DISTRIB_ID=$($SYS_PYTHON -E -c "print(__import__('sys').platform)")
echo no /etc/lsb-release found, please identify platform '$DISTRIB_ID'
DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
exit 1
export DISTRIB_ID=$($SYS_PYTHON -E -c "print(__import__('sysconfig').get_config_var('HOST_GNU_TYPE'))")
export PLATFORM=$($SYS_PYTHON -E -c "print(__import__('sys').platform)")
echo no /etc/lsb-release found, please identify platform $PLATFORM : \"${DISTRIB_ID}-${DISTRIB_RELEASE}\" or hit enter to continue
read
fi

export DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
Expand Down Expand Up @@ -60,7 +71,7 @@ do
fi
done

if [ -d ${SDKROOT} ]
if mkdir -p ${SDKROOT}
then
echo "Assuming destination $SDKROOT is ready"
else
Expand Down
4 changes: 2 additions & 2 deletions scripts/cpython-build-emsdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ else



EMCC_CFLAGS="-O0 -g0 -fPIC" CFLAGS="-O0 -g0 -fPIC" CC=${SDKROOT}/emsdk/upstream/emscripten/emcc \
CC=${SDKROOT}/emsdk/upstream/emscripten/emcc \
emconfigure $ROOT/src/libffi/configure --host=wasm32-bi-emscripten \
--prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking\
--disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs
Expand Down Expand Up @@ -147,7 +147,7 @@ else

# --with-tzpath="/usr/share/zoneinfo" \

export EMCC_CFLAGS="$CPOPTS -D_XOPEN_SOURCE_EXTENDED=1 -I$PREFIX/include/ncursesw -sUSE_ZLIB -sUSE_BZIP2"
export EMCC_CFLAGS="-D_XOPEN_SOURCE_EXTENDED=1 -I$PREFIX/include/ncursesw -sUSE_ZLIB -sUSE_BZIP2"

CPPFLAGS="$CPPFLAGS -I$PREFIX/include/ncursesw"
CFLAGS="$CPPFLAGS -I$PREFIX/include/ncursesw"
Expand Down
2 changes: 1 addition & 1 deletion scripts/cpython-build-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ END

CNF="${ROOT}/src/cpython${PYBUILD}/configure \
--prefix=$HOST_PREFIX $PYOPTS $GIL"
if CC="clang" CXX="clang++" CCSHARED="-fPIC" $CNF
if CC="clang" CXX="clang++" CCSHARED="-fPIC" EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" $CNF
then

if make -j$(nproc)
Expand Down
8 changes: 5 additions & 3 deletions scripts/cpython-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ fi

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

sed -i 's|ProcessPoolExecutor = None|return True|g' cpython3.13/Lib/compileall.py

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

Expand Down
11 changes: 9 additions & 2 deletions scripts/emsdk-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ END

curl -fsSL https://bun.sh/install | bash

npm install --prefix $ROOT/emsdk/node/??.??.* -g pnpm@^9.0.0
# emsdk shipped node cannot run on alpine
if [ -f /alpine ]
then
cp -vf /usr/bin/node $ROOT/emsdk/node/??.??.*/bin/node
fi

export PATH=$(echo -n ${SDKROOT}/emsdk/node/??.??.*/bin):$PATH
$ROOT/emsdk/node/??.??.*/bin/npm install --prefix $ROOT/emsdk/node/??.??.* -g pnpm@^9.0.0

# maybe rewrite that in python and move it to emcc.py

Expand Down Expand Up @@ -523,7 +530,7 @@ END
# emsdk env does not set it, but it's required for eg sdl2-config
echo -n
else
export PATH=$EMSDK/upstream/emscripten/system/bin:$EMSDK/upstream/emscripten:$PATH
export PATH=$(echo -n ${EMSDK}/node/??.??.*/bin):$EMSDK/upstream/emscripten/system/bin:$EMSDK/upstream/emscripten:$PATH
fi

#ln $EMSDK/upstream/emscripten/emstrip $EMSDK/upstream/emscripten/strip
Expand Down
7 changes: 6 additions & 1 deletion sources.extra/1000-glib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ c = 'emcc'
cpp = 'em++'
ar = 'emar'
ranlib = 'emranlib'
pkgconfig = ['pkg-config', '--static']
pkg-config = ['pkg-config', '--static']
# https://docs.gtk.org/glib/cross-compiling.html#cross-properties
[properties]
growing_stack = true
have_c99_vsnprintf = true
Expand All @@ -136,6 +137,10 @@ system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'
[ninja]
backend_max_links = 1
END

meson setup _build --prefix=$PREFIX --cross-file=emscripten-crossfile.meson --default-library=static --buildtype=release \
Expand Down
91 changes: 70 additions & 21 deletions sources.wasm/9000-uuid-ossp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@

. ${CONFIG:-config}

. scripts/emsdk-fetch.sh

cd ${ROOT}/src

if [ -d uuid-1.6.2 ]
pushd ${ROOT}/src

if [ -d libuuid ]
then
echo ok
echo "using local source tree"
else
#wget -c http://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
#tar xfz uuid-1.6.2.tar.gz
git clone https://github.com/pygame-web/ossp-uuid uuid-1.6.2
#wget -c http://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/libuuid.tar.gz
#tar xfz libuuid.tar.gz

#wget -c http://deb.debian.org/debian/pool/main/o/ossp-uuid/ossp-uuid_1.6.4.orig.tar.gz
#tar xvfz ossp-uuid_1.6.4.orig.tar.gz
#mv ossp-uuid-UUID_1_6_4 libuuid

git clone https://github.com/pygame-web/ossp-uuid libuuid

#tar xfp /data/git/python-wasm-sdk/libuuid.tar

pushd libuuid
# libtoolize && aclocal && autoheader && autoconf && autoreconf && automake --add-missing
#cp -vf /data/git/python-wasm-sdk/{libtool,shtool} ./
cp -vf /data/git/python-wasm-sdk/shtool ./
chmod u-w+x libtool shtool
popd

fi

popd


. scripts/emsdk-fetch.sh

INCDIR=$EMSDK/upstream/emscripten/cache/sysroot/include
LIBDIR=$EMSDK/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten

Expand All @@ -27,7 +47,7 @@ else

mkdir -p $ROOT/build/libuuid

for mode in "--without-pic" "--with-pic"
for mode in "--without-pic" "--with-pic"
do
rm -rf $ROOT/build/libuuid/*
pushd $ROOT/build/libuuid
Expand All @@ -38,32 +58,61 @@ END
ln -sf /bin/true bin/strip
export PATH=$(pwd)/bin:$PATH

if CONFIG_SIZE=$(pwd)/config.site emconfigure ../../src/uuid-1.6.2/configure --with-gnu-ld $mode --disable-shared --prefix=$PREFIX
cp -vf /data/git/python-wasm-sdk/{libtool,shtool} /tmp/
cp -vf /data/git/python-wasm-sdk/libtool ./
chmod u-w+x /tmp/libtool /tmp/shtool libtool

if PATH=/tmp:$PATH CONFIG_SIZE=$(pwd)/config.site emconfigure ../../src/libuuid/configure --with-gnu-ld $mode --disable-shared --prefix=$PREFIX
then
emmake make
sed -i 's|luuid|lossp-uuid|g' uuid.pc
cp uuid.pc ../../src/uuid-1.6.2/
echo "------ installing uuid ---------"
emmake make install
mkdir -p ${INCDIR}/ossp
mv $PREFIX/include/uuid.h ${INCDIR}/ossp/
cp -vf /data/git/python-wasm-sdk/{libtool,shtool} /tmp/
cp -vf /data/git/python-wasm-sdk/libtool ./
chmod u-w+x /tmp/libtool /tmp/shtool libtool

cp -r ${INCDIR}/ossp $PREFIX/include/
PATH=/tmp:$PATH emmake make
# LIBTOOL="'bash ${ROOT}/src/libuuid/libtool'" SHTOOL="'bash ${ROOT}/src/libuuid/shtool'"
sed -i 's|luuid|lossp-uuid|g' uuid.pc
cp uuid.pc ../../src/libuuid/

if echo $mode | grep -q with-pic
then
mv $PREFIX/lib/libuuid.a $LIBDIR/pic/libossp-uuid.a
TARGETLIB=$LIBDIR/pic/libossp-uuid.a
else
TARGETLIB=$LIBDIR/libossp-uuid.a
fi


echo "------ installing uuid to $TARGETLIB ---------"

if PATH=/tmp:$PATH emmake make install
then
mkdir -p ${INCDIR}/ossp
cp $PREFIX/include/uuid.h ${INCDIR}/ossp/
cp -r ${INCDIR}/ossp $PREFIX/include/
mv $PREFIX/lib/libuuid.a $TARGETLIB
rm $PREFIX/lib/libuuid.la
else
echo "FIXME: libtool wasm"
fi

if [ -f $TARGETLIB ]
then
echo "normal build sucess"
else
mv $PREFIX/lib/libuuid.a $LIBDIR/libossp-uuid.a
echo "TODO: fix uuid ossp for alpine"
mkdir -p ${INCDIR}/ossp
cp $PREFIX/include/uuid.h ${INCDIR}/ossp/
cp -r ${INCDIR}/ossp $PREFIX/include/
emar cr libuuid.a *.o
mv libuuid.a $TARGETLIB
fi
rm $PREFIX/lib/libuuid.la

else
echo "
failed to build uuid-ossp
"
exit 44
exit 115
fi
popd
done
Expand Down

0 comments on commit 2b0e746

Please sign in to comment.