[Libreoffice-commits] core.git: Branch 'feature/wasm' - 194 commits - accessibility/inc accessibility/Library_acc.mk accessibility/source animations/source avmedia/Library_avmedia.mk avmedia/Module_avmedia.mk avmedia/source basctl/Library_basctl.mk basctl/source basegfx/source basic/inc basic/Library_sb.mk basic/source bin/oss-fuzz-build.sh bin/run bridges/Library_cpp_uno.mk canvas/Module_canvas.mk chart2/Library_chartcontroller.mk chart2/source comphelper/source compilerplugins/clang config_host/config_wasm_strip.h.in config_host.mk.in configmgr/source configure.ac connectivity/Library_postgresql-sdbc-impl.mk connectivity/source cppuhelper/source cppu/source cpputools/Module_cpputools.mk cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/Module_dbaccess.mk dbaccess/source desktop/CustomTarget_soffice.mk desktop/Executable_soffice_bin.mk desktop/Library_deployment.mk desktop/Module_desktop.mk desktop/Package_scripts.mk desktop/Pagein_common.mk desktop/scripts desktop/source d istro-configs/LibreOfficeWASM32.conf download.lst drawinglayer/Library_drawinglayer.mk editeng/Library_editeng.mk editeng/source embeddedobj/source emfio/source extensions/Module_extensions.mk extensions/source extensions/uiconfig external/breakpad external/coinmp external/cppunit external/hunspell external/hyphen external/lcms2 external/libnumbertext external/libxml2 external/Module_external.mk external/postgresql external/python3 external/redland extras/Module_extras.mk filter/Library_icg.mk filter/qa filter/source forms/source formula/source framework/inc framework/Library_fwk.mk framework/source framework/util .gitignore helpcompiler/Module_helpcompiler.mk helpcontent2 i18npool/CustomTarget_breakiterator.mk i18npool/inc i18npool/Library_collator_data.mk i18npool/Library_dict_ja.mk i18npool/Library_dict_zh.mk i18npool/Library_i18npool.mk i18npool/Library_index_data.mk i18npool/Library_localedata_en.mk i18npool/Library_localedata_es.mk i18npool/Library_localedata_euro.mk i18npool/ Library_localedata_others.mk i18npool/Library_textconv_dict.mk i18npool/source i18npool/util i18nutil/source include/comphelper include/cppuhelper include/filter include/formula include/i18nutil include/oox include/sfx2 include/svtools include/svx include/unotools include/vcl lingucomponent/Library_guesslang.mk lingucomponent/Module_lingucomponent.mk linguistic/source m4/libo_externals.m4 Makefile.gbuild Makefile.in odk/util officecfg/registry oox/CppunitTest_oox_tokenmap.mk oox/Library_oox.mk oox/source package/inc package/source postprocess/CustomTarget_components.mk postprocess/Module_postprocess.mk postprocess/Rdb_services.mk pyuno/source README.wasm registry/Module_registry.mk reportdesign/source RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_host.mk sal/Library_cppunitmain.mk sal/Library_sal.mk sal/Library_sal_textenc.mk sal/Module_sal.mk sal/osl sal/rtl sccomp/Module_sccomp.mk sc/inc sc/Library_sc.mk sc/Library_scui.mk sc/Module_sc.mk sc/qa scripting/ Module_scripting.mk sc/source sc/uiconfig sdext/source sd/inc sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/source sfx2/inc sfx2/Library_sfx.mk sfx2/source sfx2/util shell/Module_shell.mk slideshow/source solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/Executable_lockfile.mk solenv/gbuild solenv/lockfile solenv/Module_solenv.mk solenv/sanitizers starmath/inc starmath/source static/CustomTarget_components.mk static/CustomTarget_wasm_fs_image.mk static/environment.js static/Library_components.mk static/Makefile static/Module_static.mk static/Package_wasm_fs_image.mk static/README stoc/source svl/qa svl/source svtools/inc svtools/source svx/Library_svxcore.mk svx/Library_svx.mk svx/Module_svx.mk svx/source svx/uiconfig svx/util sw/CppunitTest_sw_core_text.mk sw/CppunitTest_sw_ooxmlexport17.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/qa sw/source sw/uiconfig sw/util toolkit/source tools/source uitest/demo_ui uitest/uitest UnoControls/source unotest /source unotools/Library_utl.mk unotools/source unoxml/source ure/Package_install.mk vbahelper/source vcl/backendtest vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk4.mk vcl/Library_vclplug_kf5.mk vcl/Library_vclplug_osx.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/qt5 vcl/source vcl/unx vcl/win wasm-qt/Module_wasm-qt.mk winaccessibility/inc winaccessibility/source writerfilter/source writerperfect/Library_wpftwriter.mk writerperfect/Module_writerperfect.mk writerperfect/source xmloff/Library_xof.mk xmloff/Library_xo.mk xmloff/source xmloff/util xmlscript/source xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/source xmlsecurity/util

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 24 10:53:36 UTC 2021


Rebased ref, commits from common ancestor:
commit 6b7d1cd42972b954bb328e2e66beaff44be15099
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Sep 24 12:52:24 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 24 12:52:24 2021 +0200

    catchall
    
    Change-Id: I9cb3c54aba92cf432c7ebd08397a27ba5f73f9ec

diff --git a/configure.ac b/configure.ac
index eb47b582b137..0d67a9fad96b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2996,6 +2996,7 @@ if test "$enable_wasm_strip" = "yes"; then
     enable_gio=no
     enable_gpgmepp=no
     enable_ldap=no
+    enable_lotuswordpro=no
     enable_lpsolve=no
     enable_nss=no
     enable_odk=no
@@ -3010,7 +3011,14 @@ if test "$enable_wasm_strip" = "yes"; then
     enable_xmlhelp=no
     enable_zxing=no
     test_libepubgen=no
-#    with_system_libxml=no
+    test_libcdr=no
+    test_libetonyek=no
+    test_libfreehand=no
+    test_libmspub=no
+    test_libpagemaker=no
+    test_libqxp=no
+    test_libvisio=no
+    test_libzmf=no
     with_galleries=no
     with_webdav=no
     with_x=no
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 4f7a827fd77b..698cc6008035 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -224,6 +224,9 @@ static OUString & getIniFileName_Impl()
         // .apk (zip) archive as the /assets/rc file.
         fileName = OUString("vnd.sun.star.pathname:/assets/rc");
         resolvePathnameUrl(&fileName);
+#elif defined EMSCRIPTEN
+        fileName = OUString("vnd.sun.star.pathname:/instdir/program/sofficerc");
+        resolvePathnameUrl(&fileName);
 #else
         if (getFromCommandLineArgs("INIFILENAME", &fileName))
         {
diff --git a/static/CustomTarget_wasm_fs_image.mk b/static/CustomTarget_wasm_fs_image.mk
index bf89c7540f75..a10c244ae4e0 100644
--- a/static/CustomTarget_wasm_fs_image.mk
+++ b/static/CustomTarget_wasm_fs_image.mk
@@ -17,8 +17,12 @@ $(eval $(call gb_CustomTarget_CustomTarget,static/wasm_fs_image))
 gb_wasm_image_filelist := \
     $(call gb_UnoApi_get_target,offapi) \
     $(call gb_UnoApi_get_target,udkapi) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap) \
     $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,fundamental) \
     $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,louno) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,setup) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,soffice) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,version) \
     $(INSTROOT)/$(LIBO_ETC_FOLDER)/services/services.rdb \
     $(INSTROOT)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
     $(INSTROOT)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk
index 90ffa4b5cd56..cd3756d4c9ba 100644
--- a/writerperfect/Library_wpftwriter.mk
+++ b/writerperfect/Library_wpftwriter.mk
@@ -68,7 +68,6 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\
 	abw \
 	boost_headers \
 	ebook \
-	etonyek \
 	icu_headers \
 	icui18n \
 	icuuc \
commit adc82412d63422b37359fc417f7316b944313e15
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Sep 18 14:10:15 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Sep 18 19:28:44 2021 +0200

    catchall
    
    Change-Id: I14d772a9fa8b55a71dd11c8fef7903fbcba22797

diff --git a/config_host/config_wasm_strip.h.in b/config_host/config_wasm_strip.h.in
index 864fa4dc29ea..c64afad98033 100644
--- a/config_host/config_wasm_strip.h.in
+++ b/config_host/config_wasm_strip.h.in
@@ -4,6 +4,7 @@
 #define HAVE_FEATURE_WASM_STRIP 0
 
 #if HAVE_FEATURE_WASM_STRIP
+#define ENABLE_WASM_STRIP
 #define ENABLE_WASM_STRIP_ACCESSIBILITY
 #define ENABLE_WASM_STRIP_CANVAS
 #define ENABLE_WASM_STRIP_CHART
diff --git a/configure.ac b/configure.ac
index 8941f7f75807..eb47b582b137 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,6 +1108,7 @@ emscripten)
     test_qt5=yes
     test_system_freetype=no
     enable_compiler_plugins=no
+    enable_qt5=yes
     enable_wasm_strip=yes
     with_system_zlib=no
     with_theme="breeze"
@@ -1145,6 +1146,7 @@ test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = s
 # Don't sort!
 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
 test "$test_kf5" = yes && test_qt5=yes
+test "$test_gtk3" != yes && enable_gtk3=no
 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
 test "$using_freetype_fontconfig" = yes && test_cairo=yes
@@ -2983,11 +2985,11 @@ if test "$enable_wasm_strip" = "yes"; then
     enable_cmis=no
     enable_coinmp=no
     enable_cups=no
-    enable_curl=no
+    test "$_os" = Emscripten && enable_curl=no
     enable_database_connectivity=no
     enable_dbus=no
     enable_dconf=no
-    test "${enable_dynamic_loading+set}" = set || enable_dynamic_loading=no
+    test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
     enable_extension_integration=no
     enable_extensions=no
     enable_extension_update=no
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 6c64502e9d38..c9f878feee6f 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <config_features.h>
+#include <config_wasm_strip.h>
 
 #if HAVE_FEATURE_MACOSX_SANDBOX
 #include <premac.h>
@@ -291,9 +292,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
 
     m_bEmpty = false;
 
-    // return to avoid #elif
-    return;
-#endif
+#else
 
     m_cwdUrl = supplier.getCwdUrl();
     CommandLineEvent eCurrentEvent = CommandLineEvent::Open;
@@ -706,6 +705,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
             }
         }
     }
+#endif
 }
 
 void CommandLineArgs::InitParamValues()
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 4b25ae8d62ab..c8966b96a56f 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -1067,6 +1067,13 @@ define gb_LinkTarget_add_libs
 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(2)
 $(if $(call gb_LinkTarget__is_merged,$(1)),\
   $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : T_LIBS += $(2))
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(if $(gb_DEBUG_STATIC),$$(info $$(call gb_LinkTarget__get_all_libraries_var,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2)))))
+$$(eval $$(call gb_LinkTarget__get_all_libraries_var,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2))))
+ifeq (,$(gb_PARTIAL_BUILD))
+$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2)))
+endif
+endif
 
 endef
 
@@ -1161,7 +1168,7 @@ endef
 $(eval $(call gb_LinkTarget__generate_all_x_accessors,libraries,LIBRARIES))
 gb_LinkTarget__filter_lo_libraries = $(filter-out $(gb_LinkTarget__syslib),$(1))
 gb_LinkTarget__get_all_lo_libraries = $(call gb_LinkTarget__filter_lo_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
-gb_LinkTarget__filter_sys_libraries = $(patsubst $(gb_LinkTarget__syslib),%,$(filter $(gb_LinkTarget__syslib),$(1)))
+gb_LinkTarget__filter_sys_libraries = $(filter $(gb_LinkTarget__syslib),$(1))
 gb_LinkTarget__get_all_sys_libraries = $(call gb_LinkTarget__filter_sys_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
 $(eval $(call gb_LinkTarget__generate_all_x_accessors,externals,EXTERNALS))
 $(eval $(call gb_LinkTarget__generate_all_x_accessors,statics,STATICS))
@@ -1932,6 +1939,7 @@ endef
 define gb_LinkTarget_use_package
 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
 	$(call gb_Package_get_target,$(strip $(2)))
+$(call gb_Package_get_target,$(strip $(2))): RDEPENDS += $(call gb_LinkTarget__get_workdir_linktargetname,$(1))
 
 endef
 
diff --git a/solenv/gbuild/Package.mk b/solenv/gbuild/Package.mk
index 90e22806c994..16865d1f947a 100644
--- a/solenv/gbuild/Package.mk
+++ b/solenv/gbuild/Package.mk
@@ -80,7 +80,7 @@ $(call gb_Package_get_preparation_target,%) :
 $(call gb_Package_get_target,%) :
 	$(call gb_Output_announce,$*,$(true),PKG,2)
 	$(call gb_Trace_StartRange,$*,PKG)
-	$(if $(PACKAGE_DEFINED),,$(call gb_Output_error,Something depends on package $* which does not exist.))
+	$(if $(PACKAGE_DEFINED),,$(call gb_Output_error,$(RDEPENDS) depend(s) on package $* which does not exist.))
 	rm -f $@ && \
 	mv $(call var2file,$@.tmp,100,$(sort $(FILES))) $@
 	$(call gb_Trace_EndRange,$*,PKG)
diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk
index 141eb3318445..801365f72f9e 100644
--- a/solenv/gbuild/platform/linux.mk
+++ b/solenv/gbuild/platform/linux.mk
@@ -17,10 +17,6 @@ gb_LinkTarget_LDFLAGS += $(gb__LinkTarget_LDFLAGS_zdefs)
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-gb_STDLIBS += -pthread -lpthread
-endif
-
 ifneq ($(ATOMIC_LIB),)
 gb_STDLIBS_CXX += $(ATOMIC_LIB)
 endif
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 79b0cc29a6cc..670bd5d7d8f2 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -140,11 +140,11 @@ $(call gb_Helper_abbreviate_dirs,\
 		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)), \
 		    -Wl$(COMMA)--start-group \
-		    $(if $(filter-out EMSCRIPTEN,$(OS)),-Wl$(COMMA)-Bstatic) \
+		    $(if $(filter-out EMSCRIPTEN LINUX,$(OS)),-Wl$(COMMA)-Bstatic) \
 		    $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
-		    $(T_LIBS) \
-		    $(if $(filter-out EMSCRIPTEN,$(OS)),-Wl$(COMMA)-Bdynamic) \
+		    $(patsubst %@,%,$(T_LIBS)) \
+		    $(if $(filter-out EMSCRIPTEN LINUX,$(OS)),-Wl$(COMMA)-Bdynamic) \
 		    $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
 		, \
diff --git a/static/Module_static.mk b/static/Module_static.mk
index 0c8b4e6e1f29..9d2ac9608fca 100644
--- a/static/Module_static.mk
+++ b/static/Module_static.mk
@@ -12,10 +12,15 @@ ifeq ($(DISABLE_DYNLOADING),TRUE)
 
 $(eval $(call gb_Module_add_targets,static,\
     CustomTarget_components \
-    CustomTarget_wasm_fs_image \
     Library_components \
+))
+
+ifeq (EMSCRIPTEN,$(OS))
+$(eval $(call gb_Module_add_targets,static,\
+    CustomTarget_wasm_fs_image \
     Package_wasm_fs_image \
 ))
+endif
 
 endif
 
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c9cee7d8327c..b847d1453790 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1548,6 +1548,7 @@ static void lcl_CheckHiddenPara( SwPosition& rPos )
         rPos = SwPosition( aTmp, SwIndex( pTextNd, 0 ) );
 }
 
+#ifndef ENABLE_WASM_STRIP_ACCESSIBILITY
 namespace {
 
 // #i27301# - helper class that notifies the accessibility about invalid text
@@ -1564,13 +1565,12 @@ class SwNotifyAccAboutInvalidTextSelections
 
         ~SwNotifyAccAboutInvalidTextSelections() COVERITY_NOEXCEPT_FALSE
         {
-#ifndef ENABLE_WASM_STRIP_ACCESSIBILITY
             mrCursorSh.InvalidateAccessibleParaTextSelection();
-#endif
         }
 };
 
 }
+#endif
 
 void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 {
@@ -1584,7 +1584,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
         return; // if not then no update
     }
 
+#ifndef ENABLE_WASM_STRIP_ACCESSIBILITY
     SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );
+#endif
 
     if ( m_bIgnoreReadonly )
     {
diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk
index 1904d627ec14..ec2eb1d76744 100644
--- a/xmlsecurity/Library_xsec_xmlsec.mk
+++ b/xmlsecurity/Library_xsec_xmlsec.mk
@@ -131,13 +131,18 @@ else # !$(OS),WNT
 
 ifeq ($(SYSTEM_XMLSEC),)
 $(eval $(call gb_Library_add_libs,xsec_xmlsec,\
-       $(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
        $(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \
 ))
 endif
 
 ifeq ($(ENABLE_NSS),TRUE)
 
+ifeq ($(SYSTEM_XMLSEC),)
+$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
+       $(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
+))
+endif
+
 $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
 	xmlsecurity/source/xmlsec/nss/ciphercontext \
 	xmlsecurity/source/xmlsec/nss/digestcontext \
commit c5a857f61575862276fcbf74749c4ccab26c630c
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Sep 12 14:39:03 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:28 2021 +0200

    catchall
    
    Change-Id: I1be34ad0b858345ee657f8118b74a4a3ccdfa092

diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 039cefd37c53..79b0cc29a6cc 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -140,11 +140,11 @@ $(call gb_Helper_abbreviate_dirs,\
 		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)), \
 		    -Wl$(COMMA)--start-group \
-		    -Wl$(COMMA)-Bstatic \
+		    $(if $(filter-out EMSCRIPTEN,$(OS)),-Wl$(COMMA)-Bstatic) \
 		    $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		    $(T_LIBS) \
-		    -Wl$(COMMA)-Bdynamic \
+		    $(if $(filter-out EMSCRIPTEN,$(OS)),-Wl$(COMMA)-Bdynamic) \
 		    $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
 		, \
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index ca23138b5739..ed80dd0033d6 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -534,8 +534,10 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve
         return false;
     }
 
+#if QT5_USING_X11
     // prevent interference of writing direction switch (Ctrl + L/R-Shift) with "normal" shortcuts
     rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
+#endif
 
     SalKeyEvent aEvent;
     aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : pEvent->text().at(0).unicode());
@@ -610,7 +612,9 @@ void Qt5Widget::closePopup()
 
 void Qt5Widget::focusOutEvent(QFocusEvent*)
 {
+#if QT5_USING_X11
     m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
+#endif
     endExtTextInput();
     m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr);
     closePopup();
commit 3933a1d9dd39740b5f50ba5a05301c480e3ec001
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Aug 28 13:24:14 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Remove linker flags from CPPFLAGS
    
    Current emscripten (2.0.29) spills a lot of warnings about unused
    linker flags for compilation, so move them.
    
    Change-Id: I45fe13c63572c88a74742bfad7bcb26b2bf6dedc

diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 36814b9b87da..bdb615d0dee9 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,11 +13,11 @@ include $(GBUILDDIR)/platform/unxgcc.mk
 
 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 TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+gb_EMSCRIPTEN_CPPFLAGS := -pthread -s USE_PTHREADS=1
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.link --pre-js $(SRCDIR)/static/environment.js
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4 -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.link --pre-js $(SRCDIR)/static/environment.js
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
commit 5fd838a88eefb4653a4fda2895680a347687c868
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Mon Aug 2 00:37:54 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Amend documentation
    
    Change-Id: I2f1d82de577acfbec01dfba807ac8c7fa72c9e9b

diff --git a/README.wasm b/README.wasm
index a592a34628ca..0ba9eb6aa5c7 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,7 +1,12 @@
 = Status =
 
 $ make
-$ emrun --serve_after_close instdir/program/qt_vcldemo.html
+$ emrun --serve_after_close workdir/LinkTarget/Executable/qt_vcldemo.html
+
+or
+
+$ make
+$ emrun --serve_after_close instdir/program/qt_soffice.html
 
 The ui-previewer "binary" will "crash" with memory alignment problems.
 
commit 09020014056096b67982a1f8ec9f250175c9b89e
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Sun Aug 1 19:56:35 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Fix -Wdeprecated warning
    
    Change-Id: Ibd28f4c6ee39d395c37bd0cdb713942de92fe54c

diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 326fdd78f5ec..36814b9b87da 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,7 +17,7 @@ gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHR
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.link --pre-js $(SRCDIR)/static/environment.js
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.link --pre-js $(SRCDIR)/static/environment.js
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
commit 22c5e8999cabc55eee2b71c8b91a870120e0772b
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 23 15:21:36 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Update docs for 0.0.0.0 => 127.0.0.1
    
    Change-Id: I0a78f30d6843d1fef5eb2222157cfb3159aa846d

diff --git a/README.wasm b/README.wasm
index 3c9863da0e26..a592a34628ca 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,15 +1,16 @@
 = Status =
 
 $ make
-$ emrun --serve_after_close instdir/program/ui-previewer.html
+$ emrun --serve_after_close instdir/program/qt_vcldemo.html
 
 The ui-previewer "binary" will "crash" with memory alignment problems.
 
 You can run the WASM mandelbrot Qt example:
 
-$ emrun --serve_after_close workdir/LinkTarget/Executable/qt_mandelbrot.html
+$ emrun --serve_after_close workdir/LinkTarget/Executable/qt_wasm-qt5-mandelbrot.html
 
 REMINDER: always start new tabs in the browser, reload might fail / cache!
+INFO: latest browser won't work anymore with 0.0.0.0 and need 127.0.0.1.
 
 
 = Setup for the LO WASM build (with Qt) =
commit f54fd4a465c8f4b2d58508c2d7721bb635eaaacd
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 23 14:17:26 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Create WASM FS image via gbuild
    
    README.wasm has a summary how to add files.
    Also renames static/debug.js to static/environment.js.
    
    Change-Id: If6804e282a37a37ffae1d291d2af8430e60b59d1

diff --git a/README.wasm b/README.wasm
index abe7c2af6f4e..3c9863da0e26 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,23 +1,3 @@
-= Manually updating the WASM FS image =
-
-.../git_emsdk/upstream/emscripten/tools/file_packager instdir/program/soffice.data --use-preload-plugins --preload instdir/program/*rc instdir/program/*.rdb instdir/program/services/services.rdb instdir/program/resource/* instdir/program/types/* instdir/presets/  --js-output=instdir/program/soffice.data.js --separate-metadata
-
-Anything can be added to the list. I just kept the normal instdir layout.
-
-This generates the reqired image files. --separate-metadata is used, so
-regenerating the image doesn't require re-linking.
-
-The environment settings are in static/debug.js. This unfortunatly needs re-
-linking. It could probably use some mechanism equal to the FS metadata, but
-I didn't find anything.
-
-There is a stub of the generation CustomTarget in static/CustomTarget_data.mk.
-
-The actual data should probably just be generated in workdir/CustomTarget/static
-and then linked to instdir/program and workdir/LinkTarget/Executable/. 
-
-
-
 = Status =
 
 $ make
@@ -133,6 +113,10 @@ https://developer.chrome.com/blog/wasm-debugging-2020/
 This way you don't need source maps (much faster linking!) and can resolve local WASM
 variables to C++ names!
 
+== Updating the WASM FS image ==
+
+All files included in the image are listened in static/CustomTarget_wasm_fs_image.mk,
+$(gb_wasm_image_filelist). Read its comment for further info and restrictions.
 
 == Using Docker to cross-build with emscripten ==
 
diff --git a/Repository.mk b/Repository.mk
index d40833516c05..75f7dd74c8f1 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -1048,6 +1048,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 	) \
 	resource_fonts \
 	cui \
+    static/wasm_fs_image \
 ))
 
 $(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index ef393cb33949..d9be2f5c3b5c 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -75,6 +75,9 @@ $(call gb_Executable_get_runtime_target,$(1)) : $(call gb_Executable_get_target_
 $(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
 $(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/wasm_fs_image)/soffice.data.js.link
+endif
 
 $$(eval $$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1))))
 $(call gb_Helper_make_userfriendly_targets,$(1),Executable)
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 2eb8e6be197a..326fdd78f5ec 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,7 +17,7 @@ gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHR
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(INSTDIR)/program/soffice.data.js --pre-js $(SRCDIR)/static/debug.js
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.link --pre-js $(SRCDIR)/static/environment.js
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index fa28087b5195..039cefd37c53 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -168,7 +168,10 @@ $(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
 		$(WORKDIR)/LinkTarget/$(2).exports,$(1))))
 $(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \
 	cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \
-	sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)))
+	sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)) ; \
+	ln -sf $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data $(dir $(1))/soffice.data ; \
+	ln -sf $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)/soffice.data.js.metadata $(dir $(1))/soffice.data.js.metadata ; \
+)
 endef
 
 define gb_LinkTarget__command_staticlink
diff --git a/static/CustomTarget_data.mk b/static/CustomTarget_data.mk
deleted file mode 100644
index 52344b6c35cc..000000000000
--- a/static/CustomTarget_data.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# vim: set noet sw=4 ts=4:
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_CustomTarget_CustomTarget,static/data))
-
-/home/jmg/Development/libreoffice/git_emsdk/upstream/emscripten/tools/file_packager instdir/program/soffice.data --use-preload-plugins --preload instdir/program/*rc instdir/program/*.rdb instdir/program/services/services.rdb instdir/program/resource/* instdir/program/types/* instdir/presets/  --js-output=instdir/program/soffice.data.js --separate-metadata
-
-gb_objcopy_bfdname := $(shell objdump -a $(call gb_GenCxxObject_get_target,CustomTarget/static/component_maps) | sed -ne 's/^.*format //p')
-
-static_WORKDIR := $(call gb_CustomTarget_get_workdir,static)
-postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
-
-$(call gb_CustomTarget_get_target,static/components): \
-    $(static_WORKDIR)/component_maps.cxx \
-
-gb_GenCxxObject_get_target
-static_WORKDIR := $(call gb_CustomTarget_get_workdir,static)
-postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
-
-gb_GenCxxObject_get_target
-gb_GenCxxObject_get_dwo_target
-CustomTarget/static/component_maps
-
-define gb_static_components_create_component_map
-TEMPFILE=`$(gb_MKTEMP)` && \
-$(call gb_Helper_abbreviate_dirs, \
-    $(call gb_ExternalExecutable_get_command,python) $(1) \
-        $(if $(ENABLE_SERVICES_RDB_FROM_BUILD), \
-            -c $(postprocess_WORKDIR)/services_constructors.list, \
-            -g core -g writer -g desktop \
-        ) \
-) > $$TEMPFILE && \
-$(call gb_Helper_replace_if_different_and_touch,$${TEMPFILE},$(2))
-
-endef
-
-
-
-$(call gb_CustomTarget_get_target,static/data): \
-    $(static_WORKDIR)/soffice.data.js.metadata \
-    $(static_WORKDIR)/soffice.data \
-
-$(static_WORKDIR)/component_maps.cxx: \
-    $(SRCDIR)/solenv/bin/native-code.py \
-    | $(static_WORKDIR)/.dir
-        $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
-	objcopy -I binary -B i386 -O elf64-x86-64 \
-  --rename-section .data=.mydata,readonly,contents src dst.o
-	objdump -a $(call gb_GenCxxObject_get_target,CustomTarget/static/component_maps) | sed -ne 's/^.*format //p'
-        $(call gb_static_components_create_component_map,$<,$@)
-
-# vim: set noet sw=4:
diff --git a/static/CustomTarget_wasm_fs_image.mk b/static/CustomTarget_wasm_fs_image.mk
new file mode 100644
index 000000000000..bf89c7540f75
--- /dev/null
+++ b/static/CustomTarget_wasm_fs_image.mk
@@ -0,0 +1,52 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,static/wasm_fs_image))
+
+# WASM assumes the image has the same layout then instdir, so everything you want
+# to include must be "installed" somewhere in it, as there is no mechanism to easily
+# change paths or rename them (you could hack soffice.data.js.metadata).
+# We make them relative paths as input for the file_packager.py!
+gb_wasm_image_filelist := \
+    $(call gb_UnoApi_get_target,offapi) \
+    $(call gb_UnoApi_get_target,udkapi) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,fundamental) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,louno) \
+    $(INSTROOT)/$(LIBO_ETC_FOLDER)/services/services.rdb \
+    $(INSTROOT)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
+    $(INSTROOT)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
+
+wasm_fs_image_WORKDIR := $(call gb_CustomTarget_get_workdir,static/wasm_fs_image)
+
+# we just need data.js.link at link time, which is equal to soffice.data.js
+$(call gb_CustomTarget_get_target,static/wasm_fs_image): \
+    $(wasm_fs_image_WORKDIR)/soffice.data \
+    $(wasm_fs_image_WORKDIR)/soffice.data.js.link \
+    $(wasm_fs_image_WORKDIR)/soffice.data.js.metadata \
+
+$(wasm_fs_image_WORKDIR)/soffice.data $(wasm_fs_image_WORKDIR)/soffice.data.js : $(wasm_fs_image_WORKDIR)/soffice.data.js.metadata
+
+$(wasm_fs_image_WORKDIR)/soffice.data.js.link: $(wasm_fs_image_WORKDIR)/soffice.data.js
+	cp $^ $^.tmp
+	$(call gb_Helper_replace_if_different_and_touch,$^.tmp,$@)
+
+$(wasm_fs_image_WORKDIR)/soffice.data.filelist: $(gb_wasm_image_filelist) | $(wasm_fs_image_WORKDIR)/.dir
+	TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),1,$(subst $(BUILDDIR)/,,$^)) && \
+	    mv $$TEMPFILE $@.tmp
+	$(call gb_Helper_replace_if_different_and_touch,$@.tmp,$@)
+
+# Unfortunatly the file packager just allows a cmdline file list, but all paths are
+# relative to $(BUILDDIR), so we won't run out of cmdline space that fast...
+$(wasm_fs_image_WORKDIR)/soffice.data.js.metadata: $(wasm_fs_image_WORKDIR)/soffice.data.filelist \
+	$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(wasm_fs_image_WORKDIR)/soffice.data),$(true),GEN,2)
+	$(EMSDK_FILE_PACKAGER) $(wasm_fs_image_WORKDIR)/soffice.data --preload $(shell cat $^) --js-output=$(wasm_fs_image_WORKDIR)/soffice.data.js --separate-metadata \
+	    || rm -f $(wasm_fs_image_WORKDIR)/soffice.data.js $(wasm_fs_image_WORKDIR)/soffice.data $(wasm_fs_image_WORKDIR)/soffice.data.js.metadata
+
+# vim: set noet sw=4:
diff --git a/static/Module_static.mk b/static/Module_static.mk
index f8909994ab7b..0c8b4e6e1f29 100644
--- a/static/Module_static.mk
+++ b/static/Module_static.mk
@@ -12,7 +12,9 @@ ifeq ($(DISABLE_DYNLOADING),TRUE)
 
 $(eval $(call gb_Module_add_targets,static,\
     CustomTarget_components \
+    CustomTarget_wasm_fs_image \
     Library_components \
+    Package_wasm_fs_image \
 ))
 
 endif
diff --git a/static/Package_wasm_fs_image.mk b/static/Package_wasm_fs_image.mk
new file mode 100644
index 000000000000..cd1855b322b2
--- /dev/null
+++ b/static/Package_wasm_fs_image.mk
@@ -0,0 +1,17 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Package_Package,static/wasm_fs_image,$(call gb_CustomTarget_get_workdir,static/wasm_fs_image)))
+
+ifeq (EMSCRIPTEN,$(OS))
+$(eval $(call gb_Package_add_file,static/wasm_fs_image,$(LIBO_BIN_FOLDER)/soffice.data,soffice.data))
+$(eval $(call gb_Package_add_file,static/wasm_fs_image,$(LIBO_BIN_FOLDER)/soffice.data.js.metadata,soffice.data.js.metadata))
+endif
+
+# vim: set ts=4 sw=4 noet:
diff --git a/static/debug.js b/static/environment.js
similarity index 100%
rename from static/debug.js
rename to static/environment.js
commit 7e97d8aa7de93efeaac1273d8e28eaae1f01e786
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Tue Jul 20 22:25:28 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:27 2021 +0200

    Use proper absolute paths on linker lines
    
    Change-Id: Ic09d2074144ebc58142f55a105d22540561628df

diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index e8b090516633..2eb8e6be197a 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,7 +17,7 @@ gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHR
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js instdir/program/soffice.data.js --pre-js static/debug.js
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js $(INSTDIR)/program/soffice.data.js --pre-js $(SRCDIR)/static/debug.js
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
commit ad5169da18db815c683a2d4b71045bd83e8bf745
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 2 11:49:37 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    Build vcldemo + link image + image instructions
    
    Change-Id: Iaf6fbdaee0f8842fdde25de81f1345f1458cfcbb

diff --git a/README.wasm b/README.wasm
index 21a81d6684a4..abe7c2af6f4e 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,3 +1,23 @@
+= Manually updating the WASM FS image =
+
+.../git_emsdk/upstream/emscripten/tools/file_packager instdir/program/soffice.data --use-preload-plugins --preload instdir/program/*rc instdir/program/*.rdb instdir/program/services/services.rdb instdir/program/resource/* instdir/program/types/* instdir/presets/  --js-output=instdir/program/soffice.data.js --separate-metadata
+
+Anything can be added to the list. I just kept the normal instdir layout.
+
+This generates the reqired image files. --separate-metadata is used, so
+regenerating the image doesn't require re-linking.
+
+The environment settings are in static/debug.js. This unfortunatly needs re-
+linking. It could probably use some mechanism equal to the FS metadata, but
+I didn't find anything.
+
+There is a stub of the generation CustomTarget in static/CustomTarget_data.mk.
+
+The actual data should probably just be generated in workdir/CustomTarget/static
+and then linked to instdir/program and workdir/LinkTarget/Executable/. 
+
+
+
 = Status =
 
 $ make
diff --git a/config_host.mk.in b/config_host.mk.in
index 2d722d3e1fcf..7bbca7fc4386 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -133,6 +133,7 @@ export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
 export DPKG=@DPKG@
 export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
 export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
+export EMSDK_FILE_PACKAGER=@EMSDK_FILE_PACKAGER@
 export ENABLE_ANDROID_LOK=@ENABLE_ANDROID_LOK@
 export ENABLE_ANDROID_EDITING=@ENABLE_ANDROID_EDITING@
 export ENABLE_AVAHI=@ENABLE_AVAHI@
diff --git a/configure.ac b/configure.ac
index 5f88a1900684..8941f7f75807 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1345,10 +1345,16 @@ if test "$_os" = "Emscripten"; then
         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
         EMSCRIPTEN_ERROR=1
     fi
+    EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
+    if ! test -x "$EMSDK_FILE_PACKAGER"; then
+        AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
+	EMSCRIPTEN_ERROR=1
+    fi
     if test $EMSCRIPTEN_ERROR -ne 0; then
         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
     fi
 fi
+AC_SUBST(EMSDK_FILE_PACKAGER)
 
 ###############################################################################
 # Extensions switches --enable/--disable
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 41dd609e584c..0996321fb7ae 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -62,7 +62,11 @@ OUString cppu::getUnoIniUri() {
     //     defaultBootstrap_InitialComponentContext
     // and since rtlBootstrapHandle is not ref-counted doing anything
     // clean here is hardish.
+#if defined ANDROID
     OUString uri("file:///assets/program");
+#else
+    OUString uri("file:///instdir/program");
+#endif
 #else
 
     OUString uri;
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 917476d7ab03..e301c54b34a0 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -214,14 +214,22 @@ template<> OUString fromOString(OString const & s)
 template<typename T> bool realpath_(const T& pstrFileName, T& ppstrResolvedName)
 {
     OString fn = toOString(pstrFileName);
-#ifdef ANDROID
+#if defined ANDROID || defined EMSCRIPTEN
+#if defined ANDROID
     if (fn == "/assets" || fn.startsWith("/assets/"))
+#else
+    if (fn == "/instdir" || fn.startsWith("/instdir/"))
+#endif
     {
         if (osl::access(fn, F_OK) == -1)
+        {
+            SAL_INFO("sal.file", "realpath(" << fn << "): FAILED");
             return false;
+        }
 
         ppstrResolvedName = pstrFileName;
 
+        SAL_INFO("sal.file", "realpath(" << fn << "): OK");
         return true;
     }
 #endif
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index da6169e9459c..e8b090516633 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,7 +17,7 @@ gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHR
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --pre-js instdir/program/soffice.data.js --pre-js static/debug.js
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
@@ -32,7 +32,7 @@ gb_LINKEROPTFLAGS :=
 gb_LINKERSTRIPDEBUGFLAGS :=
 # This maps to g3, no source maps, but DWARF with current emscripten!
 # https://developer.chrome.com/blog/wasm-debugging-2020/
-gb_DEBUGINFO_FLAGS = -g3
+gb_DEBUGINFO_FLAGS = -g
 #gb_DEBUGINFO_FLAGS = -gsource-map --source-map-base=file://$(WORKDIR)/LinkTarget/Executable
 # We need at least code elimination, otherwise linking OOMs even with 64GB.
 # So we "fake" -Og support to mean -O1 for Emscripten and always enable it for debug in configure.
diff --git a/static/CustomTarget_data.mk b/static/CustomTarget_data.mk
new file mode 100644
index 000000000000..52344b6c35cc
--- /dev/null
+++ b/static/CustomTarget_data.mk
@@ -0,0 +1,59 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,static/data))
+
+/home/jmg/Development/libreoffice/git_emsdk/upstream/emscripten/tools/file_packager instdir/program/soffice.data --use-preload-plugins --preload instdir/program/*rc instdir/program/*.rdb instdir/program/services/services.rdb instdir/program/resource/* instdir/program/types/* instdir/presets/  --js-output=instdir/program/soffice.data.js --separate-metadata
+
+gb_objcopy_bfdname := $(shell objdump -a $(call gb_GenCxxObject_get_target,CustomTarget/static/component_maps) | sed -ne 's/^.*format //p')
+
+static_WORKDIR := $(call gb_CustomTarget_get_workdir,static)
+postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
+
+$(call gb_CustomTarget_get_target,static/components): \
+    $(static_WORKDIR)/component_maps.cxx \
+
+gb_GenCxxObject_get_target
+static_WORKDIR := $(call gb_CustomTarget_get_workdir,static)
+postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
+
+gb_GenCxxObject_get_target
+gb_GenCxxObject_get_dwo_target
+CustomTarget/static/component_maps
+
+define gb_static_components_create_component_map
+TEMPFILE=`$(gb_MKTEMP)` && \
+$(call gb_Helper_abbreviate_dirs, \
+    $(call gb_ExternalExecutable_get_command,python) $(1) \
+        $(if $(ENABLE_SERVICES_RDB_FROM_BUILD), \
+            -c $(postprocess_WORKDIR)/services_constructors.list, \
+            -g core -g writer -g desktop \
+        ) \
+) > $$TEMPFILE && \
+$(call gb_Helper_replace_if_different_and_touch,$${TEMPFILE},$(2))
+
+endef
+
+
+
+$(call gb_CustomTarget_get_target,static/data): \
+    $(static_WORKDIR)/soffice.data.js.metadata \
+    $(static_WORKDIR)/soffice.data \
+
+$(static_WORKDIR)/component_maps.cxx: \
+    $(SRCDIR)/solenv/bin/native-code.py \
+    | $(static_WORKDIR)/.dir
+        $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
+	objcopy -I binary -B i386 -O elf64-x86-64 \
+  --rename-section .data=.mydata,readonly,contents src dst.o
+	objdump -a $(call gb_GenCxxObject_get_target,CustomTarget/static/component_maps) | sed -ne 's/^.*format //p'
+        $(call gb_static_components_create_component_map,$<,$@)
+
+# vim: set noet sw=4:
diff --git a/static/debug.js b/static/debug.js
new file mode 100644
index 000000000000..9e4e263f3c73
--- /dev/null
+++ b/static/debug.js
@@ -0,0 +1,3 @@
+Module.preRun.push(function() {
+    ENV.SAL_LOG = "+INFO+WARN"
+});
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 5470aa73cba5..9fc651ef5bb8 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -36,7 +36,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
         Package_skia_denylist ) \
     $(if $(filter DESKTOP,$(BUILD_TYPE)), \
         StaticLibrary_vclmain \
-        $(if $(or $(DISABLE_GUI),$(DISABLE_DYNLOADING)),, \
+        $(if $(or $(DISABLE_GUI),$(DISABLE_DYNLOADING)),Executable_vcldemo, \
             $(if $(ENABLE_MACOSX_SANDBOX),, \
                 Executable_ui-previewer) \
             $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)), \
commit 9a23e8fd35f42f9e1603ff1a01564cf864d35f8c
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Tue Jun 22 18:35:17 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    Hack-fix missing hunspell (which mythes need)
    
    Change-Id: I84178e6551904b34932b1eaf8c2d88d807439039

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c16e30ecec33..47875a1a6b58 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -556,7 +556,6 @@ endef
 gb_ExternalProject__use_hunspell :=
 
 else # !SYSTEM_HUNSPELL
-ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
 
 define gb_LinkTarget__use_hunspell
 $(call gb_LinkTarget_add_defs,$(1),\
@@ -584,7 +583,6 @@ $(call gb_ExternalProject_use_external_project,$(1),hunspell)
 
 endef
 
-endif # ENABLE_WASM_STRIP_HUNSPELL
 endif # SYSTEM_HUNSPELL
 
 
diff --git a/external/mythes/ExternalProject_mythes.mk b/external/mythes/ExternalProject_mythes.mk
index 6a1e9b14e882..298607f0aa73 100644
--- a/external/mythes/ExternalProject_mythes.mk
+++ b/external/mythes/ExternalProject_mythes.mk
@@ -9,9 +9,7 @@
 
 $(eval $(call gb_ExternalProject_ExternalProject,mythes))
 
-ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
 $(eval $(call gb_ExternalProject_use_external,mythes,hunspell))
-endif
 
 $(eval $(call gb_ExternalProject_register_targets,mythes,\
 	build \
commit eb11df1d97a164b41eb3c60be0e377f16205ff45
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 22 17:15:12 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    wasm UNO: use fixed path as on Android
    
    Change-Id: Ic51641338a6c85bfc67771e141ed76c7ccddba27

diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 79bb929183e4..41dd609e584c 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -35,7 +35,7 @@
 
 namespace {
 
-#ifndef ANDROID
+#if !(defined ANDROID || defined EMSCRIPTEN)
 OUString get_this_libpath() {
     static OUString s_uri = []() {
         OUString uri;
@@ -54,7 +54,7 @@ OUString get_this_libpath() {
 }
 
 OUString cppu::getUnoIniUri() {
-#if defined ANDROID
+#if defined ANDROID || defined EMSCRIPTEN
     // Wouldn't it be lovely to avoid this ugly hard-coding.
     // The problem is that the 'create_bootstrap_macro_expander_factory()'
     // required for bootstrapping services, calls cppu::get_unorc directly
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 0c4c33bd6241..da6169e9459c 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,7 +17,7 @@ gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHR
 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
 # See emscrypten.py, finalize_wasm, modify_wasm = True
 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
commit facc87c95b8caf6f2a1ef622067328e8733b3a84
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 22 15:01:45 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    wasm: rename soffice.bin to soffice.html
    
    Change-Id: Ia957fae6edff4583f3d01dc5c6c7c215fab3879f

diff --git a/RepositoryFixes.mk b/RepositoryFixes.mk
index db78722ce545..0cbb5ad93e6c 100644
--- a/RepositoryFixes.mk
+++ b/RepositoryFixes.mk
@@ -34,8 +34,12 @@ endif
 ifeq ($(OS),MACOSX)
 gb_Executable_FILENAMES := $(patsubst soffice_bin:soffice_bin,soffice_bin:soffice,$(gb_Executable_FILENAMES))
 else
+ifeq ($(OS),EMSCRIPTEN)
+gb_Executable_FILENAMES := $(patsubst soffice_bin:soffice_bin%,soffice_bin:soffice.html,$(gb_Executable_FILENAMES))
+else
 gb_Executable_FILENAMES := $(patsubst soffice_bin:soffice_bin%,soffice_bin:soffice.bin,$(gb_Executable_FILENAMES))
 endif
+endif
 
 gb_Executable_FILENAMES := $(patsubst soffice_exe:soffice_exe%,soffice_exe:soffice.exe,$(gb_Executable_FILENAMES))
 gb_Executable_FILENAMES := $(patsubst soffice_com:soffice_com%,soffice_com:soffice.com,$(gb_Executable_FILENAMES))
commit 6c9f660fc9e8edc545ac4a991104763ffcef496b
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Tue Jun 22 14:40:11 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    Workaround: missing i18npool.component dependency
    
    Fixes: No LIBFILENAME set at component target:
     <workdir>/ComponentTarget/i18npool/util/i18npool.component: Stop.
    Change-Id: I54b9fa6b4ed6bb1fd5f85da6c8962fc88258e487

diff --git a/distro-configs/LibreOfficeWASM32.conf b/distro-configs/LibreOfficeWASM32.conf
index 4d5062ff8958..962b76a55302 100644
--- a/distro-configs/LibreOfficeWASM32.conf
+++ b/distro-configs/LibreOfficeWASM32.conf
@@ -1,4 +1,5 @@
 --host=wasm32-local-emscripten
+--enable-services-rdb-from-build
 --enable-wasm-strip
 --disable-gtk3
 --enable-qt5
commit 49b049bb0087679cc4108f5a24a1eb73570f2fd4
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 22 14:19:48 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:26 2021 +0200

    wasm: test for Qt5 and non-system Freetype
    
    Change-Id: I91a99f5bb58ae6caad020f8159313413dfa0ab6a

diff --git a/configure.ac b/configure.ac
index 348d22382b24..5f88a1900684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1105,6 +1105,8 @@ emscripten)
     using_freetype_fontconfig=yes
     using_x11=no
     test_openldap=no
+    test_qt5=yes
+    test_system_freetype=no
     enable_compiler_plugins=no
     enable_wasm_strip=yes
     with_system_zlib=no
commit 2e4dd914cc1d7cf7ed35a464f05eac14035d5f02
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:25 2021 +0200

    libxml2: Use xml2-config dummy for internal
    
    When building a static LO with --disable-dynloading on Linux,
    --without-system-libs failed for me. And it left me really puzzled:
    raptor configure failed and claimed it couldn't link libxml2.
    config.log showed missing math functions. xml2-config of LO's
    build is patched and it includes a -lm. The xml2-config in my
    chroot doesn't. But we explicitly pass the xml2-config for
    non-system-libxml2 build. Reading the configure from raptor didn't
    reveal a way, that it could somehow pick up the xml2-config from
    the chroot, but that code is autoconf-complex...
    
    When running "sh -x configure", it turned out the configure script
    actually picks up the LIBXML_* flags from the environment, which
    are set by LO's config_host.mk. These just add -lm for Android.
    
    So this adds a xml2-config.in "dummy", which overwrites the one
    from the libxml2 source and just echos LO's LIBXML_* values.
    And it adds -lm for all DISABLE_DYNLOADING targets. And drops the
    atexit xmlCleanupParser test, which fails with duplicate symbols
    for a static build.
    
    Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87

diff --git a/configure.ac b/configure.ac
index 4a59262b36cb..348d22382b24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9618,7 +9618,7 @@ else
         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
     else
         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
-        if test "$_os" = Android; then
+        if test "$DISABLE_DYNLOADING" = TRUE; then
             LIBXML_LIBS="$LIBXML_LIBS -lm"
         fi
     fi
diff --git a/desktop/Executable_soffice_bin.mk b/desktop/Executable_soffice_bin.mk
index 9c08a28361df..14a72ab6c055 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -14,6 +14,10 @@ $(eval $(call gb_Executable_set_include,soffice_bin,\
     -I$(SRCDIR)/desktop/source/inc \
 ))
 
+$(eval $(call gb_Executable_add_defs,soffice_bin,\
+    $(if $(DISABLE_DYNLOADING),$(if $(SYSTEM_LIBXML),,-DNOTEST_xmlCleanupParser)) \
+))
+
 $(eval $(call gb_Executable_use_libraries,soffice_bin,\
     sal \
     sofficeapp \
diff --git a/desktop/source/app/main.c b/desktop/source/app/main.c
index 6631c3ceb337..fdd2eb3505dc 100644
--- a/desktop/source/app/main.c
+++ b/desktop/source/app/main.c
@@ -21,6 +21,7 @@
 
 #include "sofficemain.h"
 
+#ifndef NOTEST_xmlCleanupParser
 #ifdef DBG_UTIL
 #ifdef __gnu_linux__
 #include <stdio.h>
@@ -43,14 +44,17 @@ __attribute__((visibility("default"))) void xmlCleanupParser(void)
 }
 #endif
 #endif
+#endif // NOTEST_xmlCleanupParser
 
 SAL_IMPLEMENT_MAIN()
 {
     int ret = soffice_main();
+#ifndef NOTEST_xmlCleanupParser
 #ifdef DBG_UTIL
 #ifdef __gnu_linux__
     g_Exiting = 1;
 #endif
+#endif
 #endif
     return ret;
 }
diff --git a/external/libxml2/UnpackedTarball_libxml2.mk b/external/libxml2/UnpackedTarball_libxml2.mk
index 83df02849cb3..8c81c3d26e4c 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -14,7 +14,6 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libxml2,$(LIBXML_TARBALL),,libxml2)
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libxml2))
 
 $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
-	external/libxml2/libxml2-config.patch.1 \
 	external/libxml2/libxml2-global-symbols.patch \
 	external/libxml2/libxml2-vc10.patch \
 	$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
@@ -23,4 +22,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
 		external/libxml2/libxml2-icu.patch.0) \
 ))
 
+$(eval $(call gb_UnpackedTarball_add_file,libxml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 5a2ef1485e92..000000000000
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
---- a/xml2-config.in	2009-12-17 11:45:20.000000000 +0000
-+++ b/xml2-config.in	2009-12-17 11:45:36.000000000 +0000
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@
-+#includedir=@includedir@
-+#libdir=@libdir@
-+
-+prefix=${WORKDIR}/UnpackedTarball/libxml2
-+exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
-+includedir=${WORKDIR}/UnpackedTarball/libxml2/include
-+libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
- cflags=
- libs=
- 
-@@ -67,7 +72,8 @@
- 	;;
- 
-     --cflags)
--        cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+        #cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+        cflags="-I${includedir}"
-        	;;
- 
-     --libtool-libs)
-@@ -91,7 +96,8 @@
-             libs="@XML_LIBDIR@ $libs"
-         fi
- 
--        libs="$libs @WIN32_EXTRA_LIBADD@"
-+        #libs="$libs @WIN32_EXTRA_LIBADD@"
-+        libs="-L${libdir} -lxml2 -lm"
-         ;;
- 
-     *)
diff --git a/external/libxml2/xml2-config.in b/external/libxml2/xml2-config.in
new file mode 100644
index 000000000000..164508e47e67
--- /dev/null
+++ b/external/libxml2/xml2-config.in
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+while test $# -gt 0; do
+    case "$1" in
+    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+    *) optarg= ;;
+    esac
+
+    case "$1" in
+    --version)
+	echo @VERSION@
+	exit 0
+        ;;
+    --cflags)
+        cflags="$LIBXML_CFLAGS"
+        ;;
+    --libs)
+        libs="$LIBXML_LIBS"
+        ;;
+    esac
+    shift
+done
+
+if test -n "$cflags$libs"; then
+    echo $cflags $libs
+fi
+
+exit 0
diff --git a/external/redland/UnpackedTarball_raptor.mk b/external/redland/UnpackedTarball_raptor.mk
index c5ff226168d8..fbdc8b6f5510 100644
--- a/external/redland/UnpackedTarball_raptor.mk
+++ b/external/redland/UnpackedTarball_raptor.mk
@@ -30,7 +30,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,raptor,\
 	external/redland/raptor/0001-Calcualte-max-nspace-declarations-correctly-for-XML-.patch.1 \
 	external/redland/raptor/0001-CVE-2020-25713-raptor2-malformed-input-file-can-lead.patch.1 \
 	external/redland/raptor/libtool.patch \
-	external/redland/raptor/libxml-override.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/redland/raptor/libxml-override.patch b/external/redland/raptor/libxml-override.patch
deleted file mode 100644
index edc2d0d497a4..000000000000
--- a/external/redland/raptor/libxml-override.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- configure
-+++ configure
-@@ -14387,8 +14387,8 @@
- 
- libxml_source=no
- if test "X$XML_CONFIG" != "X"; then
--  LIBXML_CFLAGS=`$XML_CONFIG --cflags`
--  LIBXML_LIBS=`$XML_CONFIG --libs`
-+  : ${LIBXML_CFLAGS=`$XML_CONFIG --cflags`}
-+  : ${LIBXML_LIBS=`$XML_CONFIG --libs`}
- 
-   CPPFLAGS="$LIBXML_CFLAGS $CPPFLAGS"
-   LIBS="$LIBS $LIBXML_LIBS"
commit b3ba217e13929bc00adac1d5c5924268a408954f
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Sat May 22 14:20:59 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:25 2021 +0200

    wasm: Fix linking for clang build
    
    Change-Id: I593ab41a4602cedb6586e428773ed41d7e21f1f4

diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk
index 801365f72f9e..141eb3318445 100644
--- a/solenv/gbuild/platform/linux.mk
+++ b/solenv/gbuild/platform/linux.mk
@@ -17,6 +17,10 @@ gb_LinkTarget_LDFLAGS += $(gb__LinkTarget_LDFLAGS_zdefs)
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+gb_STDLIBS += -pthread -lpthread
+endif
+
 ifneq ($(ATOMIC_LIB),)
 gb_STDLIBS_CXX += $(ATOMIC_LIB)
 endif
commit cca2e990afad9803e0d2a253be3e78431e97ceed
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu May 27 12:15:53 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:25 2021 +0200

    wasm: catchall of small fixes and updated README
    
    A bunch of smalll fixes to make the WASM build work.
    
    * Enable the Qt5 WASM mandelbrot example
    * Use non-multiuser DESKTOP build
    * Remove leftover artifacts from configure
    * Disable UNO bridge code
    * Fix numbertext CXXFLAGS
    * Adapt link flags to prevent WASM rewriting
      and use DWARF debug info
    * Include the correct poll.h
    
    Change-Id: If8dcf7646ee57669fec3ab0c222d09782a79ca2c

diff --git a/README.wasm b/README.wasm
index 926f6565452c..21a81d6684a4 100644
--- a/README.wasm
+++ b/README.wasm
@@ -5,31 +5,27 @@ $ emrun --serve_after_close instdir/program/ui-previewer.html
 
 The ui-previewer "binary" will "crash" with memory alignment problems.
 
-You can run the WASM mandelbrot Qt example, if you copy its HTML
-and the qtloader.js from the Qt's example folder after build with:
+You can run the WASM mandelbrot Qt example:
 
-$ emrun --serve_after_close workdir/LinkTarget/Executable/mandelbrot.html
+$ emrun --serve_after_close workdir/LinkTarget/Executable/qt_mandelbrot.html
 
 REMINDER: always start new tabs in the browser, reload might fail / cache!
 
 
 = Setup for the LO WASM build (with Qt) =
 
-We're using Qt 5.15 with the officially supported emscripten v1.39.8.
-But there are several potential problems with threads and exceptions, so this will likely
-change later to a newer emscripten.
+We're using Qt 5.15 with current upstream emscripten, currently 2.0.23.
 
-Qt WASM is not yet used with LO, just if you're wondering!
+++ See below under Docker build for another build option ++
 
- ++ See below under Docker build for another build option ++
 
 == Setup emscripten ==
 
 https://emscripten.org/docs/getting_started/index.html
 
 git clone https://github.com/emscripten-core/emsdk.git
-./emsdk install 1.39.8
-./emsdk activate --embedded 1.39.8
+./emsdk install 2.0.23
+./emsdk activate --embedded 2.0.23
 
 Example bashrc scriptlet:
 
@@ -49,10 +45,21 @@ git clone https://github.com/qt/qt5.git
 cd qt5
 git checkout v5.15.2
 ./init-repository
-./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
-make -j<CORES> module-qtbase module-qtdeclarative
 
-Building with examples will break with some of them, but at that point Qt already works.
+./configure -xplatform wasm-emscripten -feature-thread -prefix $PWD/qtbase
+
+Optionally you can add the configure flag "-compile-examples". But then you also have to
+patch at least mkspecs/wasm-emscripten/qmake.conf with EXIT_RUNTIME=0, otherwise they will
+fail to run. In addition, building with examples will break with some of them, but at that
+point Qt already works and also most examples.
+
+Linking takes quite a long time, because emscripten-finalize rewrites the whole WASM files
+with some options. This way the LO WASM needs at least 64GB RAM. For faster link times add
+"-s WASM_BIGINT=1", change to ASSERTIONS=1 nd use -g3 to prevent rewriting the WASM file
+and generating source maps (see emscripten.py, finalize_wasm, and avoid modify_wasm = True).
+This is just needed for Qt examples, as LO already uses the correct flags!
+
+make -j<CORES> module-qtbase module-qtdeclarative
 
 At some point Qt configure failed for me with:
 "Checking for target architecture... Project ERROR: target architecture detection binary not found."
@@ -74,10 +81,6 @@ autogen.sh is patched to use emconfigure. That basically sets various environmen
 especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
 configure (a.out).
 
-There's a distro config for WASM (work in progress), that gets your
-defaults right (and currently disables a ton of 3rd party stuff which
-is not essential).
-
 Recommended configure setup is thusly:
 
 # grab defaults
@@ -88,7 +91,27 @@ QT5DIR=/dir/of/git_qt5/qtbase
 
 # if you want to use ccache on both sides of the build
 --with-build-platform-configure-options=--enable-ccache
---enable-ccache
+
+# Include all build components, not just the manual list
+#--enable-services-rdb-from-build
+
+-----------
+
+FWIW: it's also possible to build an almost static Linux LibreOffice by just using
+--disable-dynloading. System externals are still linked dynamically, but everything
+else is static. Then there is --enable-wasm-strip for a smaller feature set.
+
+
+== Debugging setup ==
+
+Since a few months you can use DWARF information embedded by LLVM into the WASM to
+debug WASM in Chrome. You need to enable an experimental feature and install an
+additional extension. The whole setup is described in:
+
+https://developer.chrome.com/blog/wasm-debugging-2020/
+
+This way you don't need source maps (much faster linking!) and can resolve local WASM
+variables to C++ names!
 
 
 == Using Docker to cross-build with emscripten ==
diff --git a/Repository.mk b/Repository.mk
index ad0adef42346..d40833516c05 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -82,6 +82,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
     mtfdemo \
     visualbackendtest \
 	$(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), gtktiledviewer) \
+    $(if $(filter EMSCRIPTEN,$(OS)),wasm-qt5-mandelbrot) \
 ))
 
 $(eval $(call gb_Helper_register_executables_for_install,SDK,sdk, \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 7fdfb2974a83..c16e30ecec33 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3093,7 +3093,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 	$(call gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT) \
 	$(call gb_UnpackedTarball_get_dir,postgresql)/src/common/libpgcommon$(gb_StaticLibrary_PLAINEXT) \
 	$(call gb_UnpackedTarball_get_dir,postgresql)/src/port/libpgport$(gb_StaticLibrary_PLAINEXT) \
-    $(if $(WITH_GSSAPI),$(GSSAPI_LIBS)) \
+    $(if $(and $(DISABLE_DYNLOADING),$(WITH_GSSAPI)),$(GSSAPI_LIBS)) \
 )
 
 endif # !WNT
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index 9aaedfd66ee8..b26979a4b225 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -184,6 +184,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	uui \
 	vbahelper \
 	vcl \
+    $(if $(filter EMSCRIPTEN,$(OS)),wasm-qt) \
 	wizards \
 	writerfilter \
 	writerperfect \
diff --git a/configure.ac b/configure.ac
index 71b49d3c1478..4a59262b36cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2960,10 +2960,12 @@ dnl "desktop" one but a "mobile" one, we are always cross-compiling.
 dnl Note the direction of the implication; there is no assumption that
 dnl cross-compiling would imply a non-desktop OS.
 
-if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
+if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
     BUILD_TYPE="$BUILD_TYPE DESKTOP"
     AC_DEFINE(HAVE_FEATURE_DESKTOP)
-    AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
+    if test "$_os" != Emscripten; then
+        AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
+    fi
 fi
 
 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
@@ -2998,6 +3000,7 @@ if test "$enable_wasm_strip" = "yes"; then
     enable_xmlhelp=no
     enable_zxing=no
     test_libepubgen=no
+#    with_system_libxml=no
     with_galleries=no
     with_webdav=no
     with_x=no
@@ -14647,4 +14650,7 @@ if test -s "$WARNINGS_FILE"; then
     cat "$WARNINGS_FILE"
 fi
 
+# Remove unneeded emconfigure artifacts
+rm -f a.out a.wasm a.out.js a.out.wasm
+
 dnl vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index c9a2d89933d5..01d5a2bab1df 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1002,6 +1002,7 @@ void EnvironmentsData::getRegisteredEnvironments(
 bool loadEnv(OUString const  & cLibStem,
                     uno_Environment * pEnv)
 {
+#ifndef __EMSCRIPTEN__
 #ifdef DISABLE_DYNLOADING
     uno_initEnvironmentFunc fpInit;
 
@@ -1041,6 +1042,11 @@ bool loadEnv(OUString const  & cLibStem,
 
     (*fpInit)( pEnv ); // init of environment
     return true;
+#else
+    (void)cLibStem;
+    (void)pEnv;
+    return false;
+#endif
 }
 
 }
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index a88259627b2c..850633817048 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -329,8 +329,10 @@ static void setNegativeBridge( const OUString & rBridgeName )
 
 static uno_ext_getMappingFunc selectMapFunc( const OUString & rBridgeName )
 {
+#ifndef EMSCRIPTEN
     if (rBridgeName.equalsAscii( CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno" ))
         return CPPU_ENV_uno_ext_getMapping;
+#endif
 #if HAVE_FEATURE_JAVA
     if (rBridgeName.equalsAscii( "java" "_uno" ))
         return java_uno_ext_getMapping;
diff --git a/external/libnumbertext/ExternalProject_libnumbertext.mk b/external/libnumbertext/ExternalProject_libnumbertext.mk
index 3094351aebf2..eae3f34dc412 100644
--- a/external/libnumbertext/ExternalProject_libnumbertext.mk
+++ b/external/libnumbertext/ExternalProject_libnumbertext.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,libnumbertext,\
 	build \
 ))
 
-libnumbertext_CXXFLAGS=$(CXXFLAGS) $(CXXFLAGS_CXX11)
+libnumbertext_CXXFLAGS=$(CXXFLAGS) $(CXXFLAGS_CXX11) $(gb_EMSCRIPTEN_CPPFLAGS)
 
 ifneq (,$(filter ANDROID DRAGONFLY FREEBSD iOS LINUX NETBSD OPENBSD,$(OS)))
 ifneq (,$(gb_ENABLE_DBGUTIL))
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index 193c46f3d75d..cb373f99982a 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -104,6 +104,7 @@ $(eval $(call gb_Module_add_targets,shell,\
 ))
 endif
 
+ifeq (,$(filter EMSCRIPTEN,$(OS)))
 ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
 
 $(eval $(call gb_Module_add_targets,shell,\
@@ -111,17 +112,16 @@ $(eval $(call gb_Module_add_targets,shell,\
 ))
 
 ifneq ($(OS),WNT)
-
 $(eval $(call gb_Module_add_targets,shell,\
 	StaticLibrary_xmlparser \
 	Executable_uri_encode \
 	Library_cmdmail \
 	$(if $(ENABLE_MACOSX_SANDBOX),,Package_senddoc) \
 ))
-
 endif
 
-endif
+endif # DESKTOP
+endif # !EMSCRIPTEN
 
 $(eval $(call gb_Module_add_l10n_targets,shell,\
     AllLangMoTarget_shell \
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 3a7441454f0d..0c4c33bd6241 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -14,7 +14,10 @@ include $(GBUILDDIR)/platform/unxgcc.mk
 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 TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=2 -s EXIT_RUNTIME=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
+# To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
+# See emscrypten.py, finalize_wasm, modify_wasm = True
+# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
 gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 
 gb_Executable_EXT := .html
@@ -27,8 +30,10 @@ gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_LDFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb
 # Linker and compiler optimize + debug flags are handled in LinkTarget.mk
 gb_LINKEROPTFLAGS :=
 gb_LINKERSTRIPDEBUGFLAGS :=
-# This maps to g4, AKA source maps. The LO default would otherwise be g2!
-gb_DEBUGINFO_FLAGS = -g
+# This maps to g3, no source maps, but DWARF with current emscripten!
+# https://developer.chrome.com/blog/wasm-debugging-2020/
+gb_DEBUGINFO_FLAGS = -g3
+#gb_DEBUGINFO_FLAGS = -gsource-map --source-map-base=file://$(WORKDIR)/LinkTarget/Executable
 # We need at least code elimination, otherwise linking OOMs even with 64GB.
 # So we "fake" -Og support to mean -O1 for Emscripten and always enable it for debug in configure.
 gb_COMPILERDEBUGOPTFLAGS := -O1
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index b573f756f411..c89aefb4ced8 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -27,7 +27,11 @@
 #include <fcntl.h>
 #include <pthread.h>
 #include <sys/time.h>
+#ifdef EMSCRIPTEN
+#include <poll.h>
+#else
 #include <sys/poll.h>
+#endif
 
 #include <sal/types.h>
 #include <sal/log.hxx>
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 06dbaf6c5f32..5464754bab56 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -19,10 +19,6 @@
 
 #include <impglyphitem.hxx>
 
-#if (defined UNX && !defined MACOSX && !defined IOS)
-#include <unx/freetype_glyphcache.hxx>
-#endif
-
 SalLayoutGlyphs::SalLayoutGlyphs() {}
 
 SalLayoutGlyphs::~SalLayoutGlyphs() {}
diff --git a/wasm-qt/Module_wasm-qt.mk b/wasm-qt/Module_wasm-qt.mk
index 8e86df4e8baa..72da667363aa 100644
--- a/wasm-qt/Module_wasm-qt.mk
+++ b/wasm-qt/Module_wasm-qt.mk
@@ -8,13 +8,9 @@
 
 $(eval $(call gb_Module_Module,wasm-qt))
 
-ifeq ($(OS),EMSCRIPTEN)
-
 $(eval $(call gb_Module_add_targets,wasm-qt,\
     CustomTarget_wasm-qt5-mandelbrot_moc \
     Executable_wasm-qt5-mandelbrot \
 ))
 
-endif
-
 # vim: set noet sw=4 ts=4:
commit 173752220a880bb39d2efa7953f284df764bb920
Author:     Armin Le Grand (Allotropia) <Armin.Le.Grand at me.com>
AuthorDate: Fri Apr 30 17:26:41 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 17 11:36:22 2021 +0200

    wasm strip: squashed patches from Armin + fixes
    
    In addition to the squashed patches, this patch
    
    * drops the global compiler defines in favour of a config header
      file, for better ccache usage
    * revers almost all header changes in favour for empty function
      calls (just keeüs the premultiply table drop)
    * some additional changes for unused function calls
    * adapts more component files, so building the services.db and
      the component_mao.cxx from the build still works
    
    Currently crashs with anything different then soffice --writer.
    Closing the document also crashes.
    
    bfee2970a79e Wasm strip some SW exports & corrections
    fac2aeca4010 Wasm optional premultiply table replace
    ec9e2c81b4ec Wasm remove hunspell/hyphen optionally
    302a6f6f777a Wasm LanguageGuess optional removal
    55404a55984c Wasm oprtional autorecovery remove additions
    640d53e1e7c1 Wasm optional EPUB removal
    4a09f57c132c Wasm strip: remove UcpHelp
    eeebc1383df7 Wasm optional accessibility removal
    b95eaa630273 Additions/corrections to dbaccess wasm removal
    d8c11d72aa5a Wasm: Removed dbaccess optional
    f7d462b61c08 WASM Removal of clucene
    a1c508fc1c41 Stripped canvas/cppcanvas and related
    ebfb45f46319 Use more expressive ENABLE_WASM_STRIP markers
    a3519b1a41c8 Disable wpftcalc for wasm reduction
    fa86c5bc36f7 Chart wasm optional removal
    90d9a8dee35a BackingWindow (RecentDocsView) optional removal
    68e5f972b1a6 Deeper TipOfTheDay optional removal
    4ed18d09ce07 Optional removal of more startup-modules
    ab8d809b6ab7 Remove RecoveryCore
    f82517838840 Remove RecoveryUI, correct spl stuff
    f38dca150d58 SplashScreen and Startup
    
    Not included:
    34243e3acfe8 Wasm correct unresolved CreateMediaTempFile
    10963e79ac7d Wasm optional reduce created locales
    
    Change-Id: Ib9c0f9452815910c0a2aceaf142ba1ad4a9cb0d7

diff --git a/Repository.mk b/Repository.mk
index 95061c869c05..ad0adef42346 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -17,13 +17,18 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
+ifneq ($(ENABLE_WASM_STRIP_CANVAS),TRUE)
+$(eval $(call gb_Helper_register_executables,NONE, \
+	canvasdemo \
+))
+endif
+
 $(eval $(call gb_Helper_register_executables,NONE, \
     $(call gb_Helper_optional,HELPTOOLS, \
 	HelpIndexer \
 	HelpLinker \
     ) \
 	bestreversemap \
-	canvasdemo \
 	cfgex \
 	concat-deps \
 	cpp \
@@ -90,6 +95,12 @@ $(eval $(call gb_Helper_register_executables_for_install,SDK,sdk, \
 	$(if $(filter ODK,$(BUILD_TYPE)),uno-skeletonmaker) \
 ))
 
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
+$(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
+	$(if $(filter-out ANDROID HAIKU iOS MACOSX WNT,$(OS)),oosplash) \
+))
+endif
+
 $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
 	$(if $(ENABLE_ONLINE_UPDATE_MAR),\
 		mar \
@@ -143,7 +154,6 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
 	$(call gb_Helper_optional,FUZZERS,mtpfuzzer) \
 	$(call gb_Helper_optional,FUZZERS,htmlfuzzer) \
 	$(call gb_Helper_optional,FUZZERS,sftfuzzer) \
-	$(if $(filter-out ANDROID HAIKU iOS MACOSX WNT,$(OS)),oosplash) \
 	soffice_bin \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \
 	$(if $(filter WNT,$(OS)), \
@@ -329,6 +339,43 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ogltrans, \
 	OGLTrans \
 ))
 
+ifneq ($(ENABLE_WASM_STRIP_CANVAS),TRUE)
+$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
+	canvastools \
+	$(if $(ENABLE_CAIRO_CANVAS),cairocanvas) \
+	canvasfactory \
+	cppcanvas \
+	$(if $(filter WNT,$(OS)),directx9canvas) \
+	$(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \
+	$(if $(filter WNT,$(OS)),gdipluscanvas) \
+	simplecanvas \
+	vclcanvas \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_CLUCENE),TRUE)
+$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
+    $(call gb_Helper_optionals_or,HELPTOOLS XMLHELP,helplinker) \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_GUESSLANG),TRUE)
+$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
+	guesslang \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
+$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
+	hyphen \
+	lnth \
+	spell \
+	$(if $(filter iOS MACOSX,$(OS)), \
+		MacOSXSpell \
+	) \
+))
+endif
+
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
     avmedia \
     $(call gb_Helper_optional,AVMEDIA, \
@@ -342,14 +389,10 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	) \
 	basegfx \
 	bib \
-	$(if $(ENABLE_CAIRO_CANVAS),cairocanvas) \
-	canvasfactory \
-	canvastools \
 	chartcore \
 	chartcontroller \
 	$(call gb_Helper_optional,OPENCL,clew) \
 	$(if $(filter $(OS),WNT),,cmdmail) \
-	cppcanvas \
 	configmgr \
 	ctl \
 	dba \
@@ -362,8 +405,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(filter-out MACOSX WNT,$(OS)),desktopbe1) \
 	$(if $(USING_X11),desktop_detector) \
 	$(call gb_Helper_optional,SCRIPTING,dlgprov) \
-	$(if $(filter WNT,$(OS)),directx9canvas) \
-	$(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \
 	drawinglayer \
 	editeng \
 	$(if $(filter WNT,$(OS)),emser) \
@@ -379,19 +420,14 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	frm \
 	fsstorage \
 	fwk \
-	$(if $(filter WNT,$(OS)),gdipluscanvas) \
-	guesslang \
-    $(call gb_Helper_optionals_or,HELPTOOLS XMLHELP,helplinker) \
 	i18npool \
 	i18nsearch \
-	hyphen \
 	$(if $(ENABLE_JAVA),jdbc) \
 	$(if $(ENABLE_LDAP),ldapbe2) \
 	$(if $(filter WNT,$(OS)),WinUserInfoBe) \
 	localebe1 \
 	log \
 	lng \
-	lnth \
 	$(if $(filter $(OS),MACOSX),macbe1) \
 	$(if $(MERGELIBS),merged) \
 	migrationoo2 \
@@ -420,11 +456,9 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	sdd \
 	sdfilt \
 	sfx \
-	simplecanvas \
 	slideshow \
 	sot \
-	spell \
-	$(if $(DISABLE_GUI),,spl) \
+	$(if $(or $(DISABLE_GUI),$(ENABLE_WASM_STRIP_SPLASH)),,spl) \
 	storagefd \
 	$(call gb_Helper_optional,SCRIPTING,stringresource) \
 	svgio \
@@ -454,7 +488,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 		vbahelper \
 	) \
 	vcl \
-	vclcanvas \
 	writerperfect \
 	xmlscript \
 	xmlfa \
@@ -475,9 +508,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 		) \
 		fps_aqua \
 	) \
-	$(if $(filter iOS MACOSX,$(OS)), \
-		MacOSXSpell \
-	) \
 ))
 
 $(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,ooo, \
@@ -614,6 +644,14 @@ $(eval $(call gb_Helper_register_plugins_for_install,PRIVATELIBS_URE,ure, \
     sal_textenc \
 ))
 
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
+$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
+	$(if $(filter WNT,$(OS)), \
+		winaccessibility \
+	) \
+))
+endif
+
 $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
     $(call gb_Helper_optional,AVMEDIA, \
         $(if $(ENABLE_GSTREAMER_1_0),avmediagst) \
@@ -658,7 +696,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
 		fps \
 		inprocserv \
 		UAccCOM \
-		winaccessibility \
 	) \
 ))
 
@@ -891,6 +928,18 @@ $(eval $(call gb_Helper_register_packages_for_install,sdk,\
 	) \
 ))
 
+ifneq ($(ENABLE_WASM_STRIP_PINGUSER),TRUE)
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+	tipoftheday_images \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_CANVAS),TRUE)
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+	$(if $(ENABLE_OPENGL_CANVAS),canvas_opengl_shader) \
+))
+endif
+
 $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 	$(if $(SYSTEM_LIBEXTTEXTCAT),,libexttextcat_fingerprint) \
 	officecfg_misc \
@@ -974,13 +1023,11 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 	wizards_basicusr \
 	wizards_properties \
 	wizards_wizardshare \
-	tipoftheday_images \
 	toolbarmode_images \
 	vcl_theme_definitions \
 	$(if $(filter WNT,$(OS)), \
 		vcl_opengl_denylist \
 	) \
-	$(if $(ENABLE_OPENGL_CANVAS),canvas_opengl_shader) \
 	$(if $(filter SKIA,$(BUILD_TYPE)), \
 		vcl_skia_denylist ) \
 	$(if $(DISABLE_PYTHON),,$(if $(filter-out AIX,$(OS)), \
@@ -1170,9 +1217,14 @@ $(eval $(call gb_Helper_register_mos,\
 ))
 
 # UI configuration
+ifneq ($(ENABLE_WASM_STRIP_DBACCESS),TRUE)
 $(eval $(call gb_Helper_register_uiconfigs,\
-	cui \
 	$(call gb_Helper_optional,DBCONNECTIVITY,dbaccess) \
+))
+endif
+
+$(eval $(call gb_Helper_register_uiconfigs,\
+	cui \
 	desktop \
 	editeng \
 	filter \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2cfa0a9f4e2a..7fdfb2974a83 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -556,6 +556,7 @@ endef
 gb_ExternalProject__use_hunspell :=
 
 else # !SYSTEM_HUNSPELL
+ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
 
 define gb_LinkTarget__use_hunspell
 $(call gb_LinkTarget_add_defs,$(1),\
@@ -583,6 +584,7 @@ $(call gb_ExternalProject_use_external_project,$(1),hunspell)
 
 endef
 
+endif # ENABLE_WASM_STRIP_HUNSPELL
 endif # SYSTEM_HUNSPELL
 
 
@@ -1889,6 +1891,7 @@ endef
 gb_ExternalProject__use_epubgen :=
 
 else # !SYSTEM_EPUBGEN
+ifneq ($(ENABLE_WASM_STRIP_EPUB),TRUE)
 
 define gb_LinkTarget__use_epubgen
 $(call gb_LinkTarget_set_include,$(1),\
@@ -1906,6 +1909,7 @@ $(call gb_ExternalProject_use_external_project,$(1),libepubgen)
 
 endef
 
+endif # ENABLE_WASM_STRIP_EPUB
 endif # SYSTEM_EPUBGEN
 
 ifneq ($(SYSTEM_REVENGE),)
@@ -2847,7 +2851,6 @@ endif # SYSTEM_POPPLER
 
 endif # ENABLE_POPPLER
 
-
 ifneq ($(SYSTEM_CLUCENE),)
 
 define gb_LinkTarget__use_clucene
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index 64d9788b59e4..9aaedfd66ee8 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -20,8 +20,35 @@ $(eval $(call gb_Module_add_targets,libreoffice,\
 ))
 endif
 
+# WASM_CHART change
+ifneq ($(ENABLE_WASM_STRIP_CHART),TRUE)
+$(eval $(call gb_Module_add_moduledirs,libreoffice,\
+	chart2 \
+))
+endif
+
+# WASM_CANVAS change
+ifneq ($(ENABLE_WASM_STRIP_CANVAS),TRUE)
+$(eval $(call gb_Module_add_moduledirs,libreoffice,\
+	canvas \
+	cppcanvas \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_DBACCESS),TRUE)
+$(eval $(call gb_Module_add_moduledirs,libreoffice,\
+	dbaccess \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
 $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	accessibility \
+	winaccessibility \
+))
+endif
+
+$(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	android \
     $(if $(ENABLE_WASM_STRIP_BASIC_CALC_DRAW_MATH_IMPRESS),, \
 	animations \
@@ -36,19 +63,15 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	bean \
 	binaryurp \
 	bridges \
-	canvas \
-	chart2 \
 	cli_ure \
 	$(call gb_Helper_optional,DESKTOP,codemaker) \
 	comphelper \
 	configmgr \
 	connectivity \
-	cppcanvas \
 	cppu \
 	cppuhelper \
 	cpputools \
 	cui \
-	dbaccess \
 	desktop \
 	$(call gb_Helper_optional,DICTIONARIES,dictionaries) \
 	drawinglayer \
@@ -121,7 +144,9 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	$(call gb_Helper_optional,DESKTOP,setup_native) \
 	sfx2 \
 	shell \
+    $(if $(ENABLE_WASM_STRIP_BASIC_CALC_DRAW_MATH_IMPRESS),, \
 	slideshow \
+    ) \
 	smoketest \
 	solenv \
 	soltools \
@@ -159,7 +184,6 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	uui \
 	vbahelper \
 	vcl \
-	winaccessibility \
 	wizards \
 	writerfilter \
 	writerperfect \
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index f874dfe9cc54..122ae4a909a3 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -62,9 +62,14 @@ $(eval $(call gb_Library_use_libraries,basctl,\
 	xmlscript \
 ))
 
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
 $(eval $(call gb_Library_add_exception_objects,basctl,\
 	basctl/source/accessibility/accessibledialogcontrolshape \
 	basctl/source/accessibility/accessibledialogwindow \
+))
+endif
+
+$(eval $(call gb_Library_add_exception_objects,basctl,\
 	basctl/source/basicide/basdoc \
 	basctl/source/basicide/IDEComboBox \
 	basctl/source/basicide/basicrenderable \
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 05f031415213..7eddba17f348 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,chartcontroller,\
 
 $(eval $(call gb_Library_set_componentfile,chartcontroller,chart2/source/controller/chartcontroller))
 
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
 $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
     chart2/source/controller/accessibility/AccessibleBase \
     chart2/source/controller/accessibility/AccessibleChartElement \
@@ -60,6 +61,10 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
     chart2/source/controller/accessibility/AccessibleTextHelper \
     chart2/source/controller/accessibility/AccessibleViewForwarder \
     chart2/source/controller/accessibility/ChartElementFactory \
+))
+endif
+
+$(eval $(call gb_Library_add_exception_objects,chartcontroller,\
     chart2/source/controller/chartapiwrapper/AreaWrapper \
     chart2/source/controller/chartapiwrapper/AxisWrapper \
     chart2/source/controller/chartapiwrapper/Chart2ModelContact \
diff --git a/config_host.mk.in b/config_host.mk.in
index c6dfa007597d..2d722d3e1fcf 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -207,7 +207,23 @@ export ENABLE_SKIA_DEBUG=@ENABLE_SKIA_DEBUG@
 export ENABLE_SYMBOLS_FOR=@ENABLE_SYMBOLS_FOR@
 export ENABLE_VALGRIND=@ENABLE_VALGRIND@
 export ENABLE_WASM_STRIP=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_ACCESSIBILITY=@ENABLE_WASM_STRIP@
 export ENABLE_WASM_STRIP_BASIC_CALC_DRAW_MATH_IMPRESS=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_CANVAS=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_CHART=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_CLUCENE=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_DBACCESS=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_EPUB=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_EXTRA=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_GUESSLANG=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_HUNSPELL=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_LOCALES=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_PINGUSER=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_PREMULTIPLY=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_RECENT=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_RECOVERYUI=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_SPLASH=@ENABLE_WASM_STRIP@
+export ENABLE_WASM_STRIP_SWEXPORTS=@ENABLE_WASM_STRIP@
 export ENABLE_WERROR=@ENABLE_WERROR@
 export ENDIANNESS=@ENDIANNESS@
 export EPM=@EPM@
diff --git a/config_host/config_wasm_strip.h.in b/config_host/config_wasm_strip.h.in
new file mode 100644
index 000000000000..864fa4dc29ea
--- /dev/null
+++ b/config_host/config_wasm_strip.h.in
@@ -0,0 +1,24 @@
+#ifndef CONFIG_FEATURE_WASM_STRIP_H
+#define CONFIG_FEATURE_WASM_STRIP_H
+
+#define HAVE_FEATURE_WASM_STRIP 0
+
+#if HAVE_FEATURE_WASM_STRIP
+#define ENABLE_WASM_STRIP_ACCESSIBILITY
+#define ENABLE_WASM_STRIP_CANVAS
+#define ENABLE_WASM_STRIP_CHART
+#define ENABLE_WASM_STRIP_CLUCENE
+#define ENABLE_WASM_STRIP_DBACCESS
+#define ENABLE_WASM_STRIP_EPUB
+#define ENABLE_WASM_STRIP_EXTRA
+#define ENABLE_WASM_STRIP_GUESSLANG
+#define ENABLE_WASM_STRIP_HUNSPELL
+#define ENABLE_WASM_STRIP_PINGUSER
+#define ENABLE_WASM_STRIP_PREMULTIPLY
+#define ENABLE_WASM_STRIP_RECENT
+#define ENABLE_WASM_STRIP_RECOVERYUI
+#define ENABLE_WASM_STRIP_SPLASH
+#define ENABLE_WASM_STRIP_SWEXPORTS
+#endif
+
+#endif
diff --git a/configure.ac b/configure.ac
index a05f3260746b..71b49d3c1478 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3004,6 +3004,8 @@ if test "$enable_wasm_strip" = "yes"; then
 
     test "${with_fonts+set}" = set || with_fonts=yes
     test "${with_locales+set}" = set || with_locales=en
+
+    AC_DEFINE(HAVE_FEATURE_WASM_STRIP)
 fi
 
 ENABLE_SERVICES_RDB_FROM_BUILD=
@@ -14535,6 +14537,7 @@ AC_CONFIG_HEADERS([config_host/config_oauth2.h])
 AC_CONFIG_HEADERS([config_host/config_poppler.h])
 AC_CONFIG_HEADERS([config_host/config_python.h])
 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
+AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
 AC_OUTPUT
 
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 686bd039f251..5813ebe10ba3 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -93,6 +93,18 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 ))
 endif
 
+ifneq ($(ENABLE_WASM_STRIP_PINGUSER),TRUE)
+$(eval $(call gb_Library_add_exception_objects,cui,\
+    cui/source/dialogs/tipofthedaydlg \
+))
+endif
+
+ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
+$(eval $(call gb_Library_add_exception_objects,cui,\
+    cui/source/dialogs/hyphen \
+))
+endif
+
 $(eval $(call gb_Library_add_exception_objects,cui,\
     cui/source/customize/acccfg \
     cui/source/customize/cfg \
@@ -126,9 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
     cui/source/dialogs/hlmailtp \
     cui/source/dialogs/hlmarkwn \
     cui/source/dialogs/hltpbase \
-    cui/source/dialogs/hyphen \
     cui/source/dialogs/iconcdlg \
-    cui/source/dialogs/tipofthedaydlg \
     cui/source/dialogs/insdlg \
     cui/source/dialogs/insrc \
     cui/source/dialogs/linkdlg \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index daa8a1e3d55d..301d29303981 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -15,6 +15,12 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
 ))
 endif
 
+ifneq ($(ENABLE_WASM_STRIP_PINGUSER),TRUE)
+$(eval $(call gb_UIConfig_add_uifiles,cui,\
+	cui/uiconfig/ui/tipofthedaydialog \
+))
+endif
+
 $(eval $(call gb_UIConfig_add_uifiles,cui,\
 	cui/uiconfig/ui/aboutdialog \
 	cui/uiconfig/ui/aboutconfigdialog\
@@ -99,7 +105,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
 	cui/uiconfig/ui/hyphenate \
 	cui/uiconfig/ui/iconchangedialog \
 	cui/uiconfig/ui/iconselectordialog \
-	cui/uiconfig/ui/tipofthedaydialog \
 	cui/uiconfig/ui/insertfloatingframe \
 	cui/uiconfig/ui/insertoleobject \
 	cui/uiconfig/ui/insertrowcolumn \
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 75fb59b7fe29..d45be7cb5023 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <config_extensions.h>
+#include <config_wasm_strip.h>
 
 #include <align.hxx>
 #include "dlgfact.hxx"
@@ -134,7 +135,11 @@ short AbstractFmShowColsDialog_Impl::Execute()
 
 short AbstractHyphenWordDialog_Impl::Execute()
 {
+#ifndef ENABLE_WASM_STRIP_HUNSPELL
     return m_xDlg->run();
+#else
+    return 0;
+#endif
 }
 
 short AbstractThesaurusDialog_Impl::Execute()
@@ -1095,7 +1100,16 @@ VclPtr<AbstractHyphenWordDialog> AbstractDialogFactory_Impl::CreateHyphenWordDia
                                                 css::uno::Reference< css::linguistic2::XHyphenator >  &xHyphen,
                                                 SvxSpellWrapper* pWrapper)
 {
+#ifndef ENABLE_WASM_STRIP_EXTRA
     return VclPtr<AbstractHyphenWordDialog_Impl>::Create(std::make_unique<SvxHyphenWordDialog>(rWord, nLang, pParent, xHyphen, pWrapper));
+#else
+    (void) pParent;
+    (void) rWord;
+    (void) nLang;
+    (void) xHyphen;
+    (void) pWrapper;
+    return nullptr;
+#endif
 }
 
 VclPtr<AbstractFmShowColsDialog> AbstractDialogFactory_Impl::CreateFmShowColsDialog(weld::Window* pParent)
@@ -1683,7 +1697,7 @@ VclPtr<AbstractAdditionsDialog> AbstractDialogFactory_Impl::CreateAdditionsDialo
 #else
     (void) pParent;
     (void) sAdditionsTag;
-    return VclPtr<AbstractAdditionsDialog>(nullptr);
+    return nullptr;
 #endif
 }
 
@@ -1697,8 +1711,13 @@ AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent)
 VclPtr<VclAbstractDialog>
 AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent)
 {
+#ifndef ENABLE_WASM_STRIP_PINGUSER
     return VclPtr<CuiAbstractTipController_Impl>::Create(
         std::make_shared<TipOfTheDayDialog>(pParent));
+#else
+    (void) pParent;
+    return nullptr;
+#endif
 }
 
 VclPtr<VclAbstractDialog>
diff --git a/desktop/Library_deployment.mk b/desktop/Library_deployment.mk
index 57fe1c55a0b6..dc36691b63b1 100644
--- a/desktop/Library_deployment.mk
+++ b/desktop/Library_deployment.mk
@@ -39,6 +39,15 @@ $(eval $(call gb_Library_use_libraries,deployment,\
 
 $(eval $(call gb_Library_set_componentfile,deployment,desktop/source/deployment/deployment))
 
+ifneq ($(ENABLE_WASM_STRIP_CLUCENE),TRUE)
+$(eval $(call gb_Library_set_componentfile,deployment,desktop/source/deployment/deployment.extended))
+
+$(eval $(call gb_Library_add_exception_objects,deployment,\
+    desktop/source/deployment/registry/help/dp_help \
+    desktop/source/deployment/registry/component/dp_component \
+))
+endif
+
 $(eval $(call gb_Library_add_exception_objects,deployment,\
     desktop/source/deployment/dp_log \
     desktop/source/deployment/dp_persmap \
@@ -51,7 +60,6 @@ $(eval $(call gb_Library_add_exception_objects,deployment,\
     desktop/source/deployment/manager/dp_managerfac \
     desktop/source/deployment/manager/dp_properties \
     desktop/source/deployment/registry/component/dp_compbackenddb \
-    desktop/source/deployment/registry/component/dp_component \
     desktop/source/deployment/registry/configuration/dp_configuration \
     desktop/source/deployment/registry/configuration/dp_configurationbackenddb \
     desktop/source/deployment/registry/dp_backend \
@@ -59,7 +67,6 @@ $(eval $(call gb_Library_add_exception_objects,deployment,\
     desktop/source/deployment/registry/dp_registry \
     desktop/source/deployment/registry/executable/dp_executable \
     desktop/source/deployment/registry/executable/dp_executablebackenddb \
-    desktop/source/deployment/registry/help/dp_help \
     desktop/source/deployment/registry/help/dp_helpbackenddb \
     desktop/source/deployment/registry/package/dp_extbackenddb \
     desktop/source/deployment/registry/package/dp_package \
@@ -71,11 +78,9 @@ $(eval $(call gb_Library_add_exception_objects,deployment,\
 ))
 
 ifneq (,$(filter XMLHELP,$(BUILD_TYPE)))
-
 $(eval $(call gb_Library_use_libraries,deployment,\
     helplinker \
 ))
-
 endif
 
 # vim: set ts=4 sw=4 et:
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index 3be81056aad9..265f0248534e 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -20,7 +20,7 @@ $(eval $(call gb_Module_add_targets,desktop,\
     $(if $(ENABLE_BREAKPAD), \
         Library_crashreport \
         ) \
-    $(if $(DISABLE_GUI),,Library_spl) \
+    $(if $(or $(DISABLE_GUI),$(ENABLE_WASM_STRIP_SPLASH)),,Library_spl) \
     Package_branding \
     $(if $(CUSTOM_BRAND_DIR),Package_branding_custom) \
     UIConfig_deployment \
@@ -107,9 +107,11 @@ $(eval $(call gb_Module_add_targets,desktop,\
 
 else ifeq (,$(filter MACOSX ANDROID iOS HAIKU,$(OS)))
 
+ifneq ($(ENABLE_WASM_STRIP_ACCESSIBILITY),TRUE)
 $(eval $(call gb_Module_add_targets,desktop,\
     $(if $(DISABLE_DYNLOADING),,Executable_oosplash) \
 ))
+endif # ENABLE_WASM_STRIP_ACCESSIBILITY
 
 endif
 
diff --git a/desktop/Pagein_common.mk b/desktop/Pagein_common.mk
index d0a0e689c2d2..96d5fe49f919 100644
--- a/desktop/Pagein_common.mk
+++ b/desktop/Pagein_common.mk
@@ -9,6 +9,12 @@
 
 $(eval $(call gb_Pagein_Pagein,common))
 
+ifneq ($(ENABLE_WASM_STRIP_CLUCENE),TRUE)
+$(eval $(call gb_Pagein_add_objects,common,\
+    helplinker \
+))
+endif
+
 # sorted in approx. reverse load order (ld.so.1)
 $(eval $(call gb_Pagein_add_objects,common,\
     $(if $(MERGELIBS),merged) \
@@ -56,7 +62,6 @@ $(eval $(call gb_Pagein_add_objects,common,\
     svt \
     spl \
     avmedia \
-    helplinker \
     sax \
     fsstorage \
     desktopbe1 \
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index f65f93d63f80..f1cb4c29ec09 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -24,6 +24,7 @@
 #include <config_java.h>
 #include <config_folders.h>
 #include <config_extensions.h>
+#include <config_wasm_strip.h>
 
 #include <sal/config.h>
 
@@ -969,6 +970,7 @@ struct RefClearGuard
     @param  bEmergencySave
             differs between EMERGENCY_SAVE and RECOVERY
 */
+#ifndef ENABLE_WASM_STRIP_RECOVERYUI
 bool impl_callRecoveryUI(bool bEmergencySave     ,
                          bool bExistsRecoveryData)
 {
@@ -1000,6 +1002,7 @@ bool impl_callRecoveryUI(bool bEmergencySave     ,
     aRet >>= bRet;
     return bRet;
 }
+#endif
 
 bool impl_bringToFrontRecoveryUI()
 {
@@ -1149,9 +1152,11 @@ void Desktop::Exception(ExceptionCategory nCategory)
         // Save all open documents so they will be reopened
         // the next time the application is started
         // returns true if at least one document could be saved...
+#ifndef ENABLE_WASM_STRIP_RECOVERYUI
         bRestart = impl_callRecoveryUI(
                         true , // force emergency save
                         false);
+#endif
     }
 
     FlushConfiguration();
@@ -1165,8 +1170,10 @@ void Desktop::Exception(ExceptionCategory nCategory)
             osl_removeSignalHandler( pSignalHandler );
 
         restartOnMac(false);
+#ifndef ENABLE_WASM_STRIP_SPLASH
         if ( m_rSplashScreen.is() )
             m_rSplashScreen->reset();
+#endif
 
         _exit( EXITHELPER_CRASH_WITH_RESTART );
     }
@@ -1269,7 +1276,9 @@ int Desktop::Main()
     Translate::SetReadStringHook(ReplaceStringHookProc);
 
     // Startup screen
+#ifndef ENABLE_WASM_STRIP_SPLASH
     OpenSplashScreen();
+#endif
 
     SetSplashScreenProgress(10);
 
@@ -1712,8 +1721,10 @@ int Desktop::doShutdown()

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list