From 968b9e1d1191cad7534d08a68666a65ad6ba859c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sat, 26 Jul 2025 21:57:21 +0200 Subject: [PATCH] Add serve-wasm.py to the emscripten bundle --- .github/build.sh | 3 ++- resources/serve-wasm.template.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) mode change 100644 => 100755 resources/serve-wasm.template.py diff --git a/.github/build.sh b/.github/build.sh index 494fbb0de..3744e41fb 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -521,7 +521,8 @@ if [[ $BSH_HOST_PLATFORM == darwin ]]; then exit 1 fi elif [[ $PACKAGE_MODE == emscripten ]]; then - tar cvf $ASSET_PATH $APP_EXE.js $APP_EXE.wasm + cp resources/serve-wasm.py . + tar cvf $ASSET_PATH $APP_EXE.js $APP_EXE.wasm serve-wasm.py elif [[ $PACKAGE_MODE == appimage ]]; then # so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later case $BSH_HOST_ARCH in diff --git a/resources/serve-wasm.template.py b/resources/serve-wasm.template.py old mode 100644 new mode 100755 index f305f6b20..c2d6c8dac --- a/resources/serve-wasm.template.py +++ b/resources/serve-wasm.template.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + from OpenSSL import crypto import http.server import json @@ -7,12 +9,13 @@ import ssl import sys import time -( - script, - build_root, -) = sys.argv - -os.chdir(build_root) +if len(sys.argv) >= 2: + # chdir if invoked through meson; assume that we're in the correct dir already otherwise + ( + script, + build_root, + ) = sys.argv + os.chdir(build_root) HTTP_HOST = '127.0.0.1' HTTP_PORT = 8000