desktop/Executable_soffice_bin.mk |    2 ++
 solenv/gbuild/platform/unxgcc.mk  |    3 ++-
 static/emscripten/script.js       |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 77bf20f9d5e48deaac6efd51046aeb0724f788eb
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Mon Apr 14 09:55:39 2025 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Apr 17 22:13:22 2025 +0200

    Emscripten: Provide Module.script
    
    ...which is useful for some downstream scripts
    
    Change-Id: Ibf9d336fb4ad018dcaa5ed460cac1e8e5030ab50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184334
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit fae15203e825647416b0a17dd46a1d5c1e3984fe)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184341
    Tested-by: allotropia jenkins <jenk...@allotropia.de>

diff --git a/desktop/Executable_soffice_bin.mk 
b/desktop/Executable_soffice_bin.mk
index a791e8f362e4..0a26ff86f8e8 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -80,6 +80,8 @@ $(call gb_Executable_get_linktarget_target,soffice_bin): \
     $(SRCDIR)/static/emscripten/uno.js \
     $(EMSCRIPTEN_EXTRA_SOFFICE_PRE_JS)
 
+$(eval $(call 
gb_Executable_add_prejs,soffice_bin,$(SRCDIR)/static/emscripten/script.js))
+
 $(eval $(call gb_Executable_add_ldflags,soffice_bin, \
     --post-js $(gb_CustomTarget_workdir)/static/unoembind/bindings_uno.js \
     --post-js $(SRCDIR)/static/emscripten/uno.js \
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 1c289b193d4e..cab5026d27e9 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -183,7 +183,8 @@ $(if $(filter Library,$(TARGETTYPE)), $(call 
gb_Helper_abbreviate_dirs,\
 $(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter 
EMSCRIPTEN,$(OS))), \
 $(if $(filter TRUE,$(ENABLE_QT5)), \
     sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' 
$(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(basename $(notdir 
$(1))).html && \
-    cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js 
$(dir $(1)) && \
+    sed -e 's/var Module = {}/var Module = {script: document.currentScript}/' 
$(QT5_PLATFORMS_SRCDIR)/qtloader.js > $(dir $(1))qtloader.js && \
+    cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(dir $(1)) && \
 ,$(if $(filter TRUE,$(ENABLE_QT6)), \
     sed -e 's/@APPNAME@/$(basename $(notdir $(1)))/g' -e 
's/@APPEXPORTNAME@/$(basename $(notdir $(1)))_entry/g' -e 's/@PRELOAD@//g' -e 
's/}$(CLOSE_PAREN);$$/}$(CLOSE_PAREN); window.Module = instance;/' 
$(QT6_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(basename $(notdir 
$(1))).html && \
     cp $(QT6_PLATFORMS_SRCDIR)/qtlogo.svg $(QT6_PLATFORMS_SRCDIR)/qtloader.js 
$(dir $(1)) && \
diff --git a/static/emscripten/script.js b/static/emscripten/script.js
new file mode 100644
index 000000000000..4b3188557e0f
--- /dev/null
+++ b/static/emscripten/script.js
@@ -0,0 +1,14 @@
+/* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+if (typeof Module.script == 'undefined' && typeof document != 'undefined') {
+    Module.script = document.currentScript;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to