desktop/Executable_soffice_bin.mk              |    7 +++++++
 solenv/gbuild/Executable.mk                    |    4 +++-
 solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk |    9 ---------
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit cf0b0f0dd04fae98b686cd5768673c217a58fab6
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Tue Apr 30 15:24:44 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Tue Apr 30 17:49:17 2024 +0200

    Emscripten: Only add the --pre-js code to the soffice executable
    
    ...so that e.g. executing `echo test | node instdir/program/uri-encode.js`
    doesn't fail with
    
    > instdir/program/uri-encode.js:460
    >       throw ex;
    >       ^
    >
    > ReferenceError: XMLHttpRequest is not defined
    >     at runMetaWithFS (instdir/program/uri-encode.js:312:15)
    >     at callRuntimeCallbacks (instdir/program/uri-encode.js:1882:26)
    >     at preRun (instdir/program/uri-encode.js:913:3)
    >     at run (instdir/program/uri-encode.js:6854:3)
    >     at runCaller (instdir/program/uri-encode.js:6802:19)
    >     at removeRunDependency (instdir/program/uri-encode.js:1060:7)
    >     at receiveInstance (instdir/program/uri-encode.js:1265:5)
    >     at receiveInstantiationResult (instdir/program/uri-encode.js:1281:5)
    
    (There's nothing special about uri-encode here, it just happens to be the 
only
    other executable that is built into instdir/program/ by the Emscripten 
build,
    even if it is probably not even useful there.  It expects to read something 
from
    stdin, hence the echo part.)
    
    (The generic solenv/gbuild/Executable.mk no longer depends on
    soffice.data.js.link, but it still depends on soffice.data and
    soffice.data.js.metadata for some cp instructions in
    solenv/gbuild/platform/unxgcc.mk, so make those dependencies explicit.  
That can
    probably be cleaned up further in a next step.)
    
    Change-Id: I993878a5f6d19d13728d17e803ae7d773946a1d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166930
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins

diff --git a/desktop/Executable_soffice_bin.mk 
b/desktop/Executable_soffice_bin.mk
index 34146dc5bfe9..dba50e637aba 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -27,9 +27,16 @@ $(eval $(call gb_Executable_add_cobjects,soffice_bin,\
     desktop/source/app/main \
 ))
 
+ifeq ($(OS),EMSCRIPTEN)
+$(call gb_LinkTarget_get_target,$(call 
gb_Executable_get_linktarget,soffice_bin)) : $(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link
+
+# don't sort; later can override previous settings!
+$(eval $(call 
gb_Executable_add_prejs,soffice_bin,$(SRCDIR)/static/emscripten/environment.js))
+$(eval $(call gb_Executable_add_prejs,soffice_bin,$(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link))
 ifeq ($(OS)-$(ENABLE_QT5),EMSCRIPTEN-TRUE)
 $(eval $(call 
gb_Executable_add_prejs,soffice_bin,$(SRCDIR)/static/emscripten/soffice_args.js))
 endif
+endif
 
 ifeq ($(OS),WNT)
 
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 7c8cf199496d..3027b0de30fa 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -76,7 +76,9 @@ $(call gb_Executable_get_clean_target,$(1)) : $(call 
gb_LinkTarget_get_clean_tar
 $(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS :=
 $(call 
gb_Executable_Executable_platform,$(1),$(2),$(gb_Executable_BINDIR)/$(1).lib)
 ifeq ($(OS),EMSCRIPTEN)
-$(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$(1))) : 
$(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link
+$(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$(1))) : \
+    $(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data \
+    $(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.metadata
 endif
 
 $$(eval $$(call gb_Module_register_target,$(call 
gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1))))
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk 
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 64713ec66fd1..e660c20cc650 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -9,11 +9,6 @@
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
-# don't sort; later can override previous settings!
-gb_EMSCRIPTEN_PRE_JS_FILES = \
-    $(SRCDIR)/static/emscripten/environment.js \
-    $(call 
gb_CustomTarget_get_workdir,static/emscripten_fs_image)/soffice.data.js.link \
-
 gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
 # avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps
 gb_EMSCRIPTEN_CPPFLAGS := -pthread -s USE_PTHREADS=1 -D_LARGEFILE64_SOURCE 
-D_LARGEFILE_SOURCE
@@ -85,8 +80,6 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
         $(patsubst %.lib,%.worker.js,$(3)) \
 )
 
-$(foreach pre_js,$(gb_EMSCRIPTEN_PRE_JS_FILES),$(call 
gb_Executable_add_prejs,$(1),$(pre_js)))
-
 endef
 
 define gb_CppunitTest_CppunitTest_platform
@@ -97,8 +90,6 @@ $(call gb_LinkTarget_add_auxtargets,$(2),\
         $(patsubst %.lib,%.worker.js,$(3)) \
 )
 
-$(foreach pre_js,$(gb_EMSCRIPTEN_PRE_JS_FILES),$(call 
gb_CppunitTest_add_prejs,$(1),$(pre_js)))
-
 endef
 
 gb_SUPPRESS_TESTS := $(true)

Reply via email to