[Libreoffice-commits] core.git: Branch 'feature/wasm' - 249 commits - accessibility/inc accessibility/Library_acc.mk accessibility/source autogen.sh avmedia/Library_avmediavlc.mk avmedia/Module_avmedia.mk avmedia/source basctl/qa basctl/source basctl/uiconfig basegfx/source basegfx/test basic/qa basic/source bin/lint-ui.py bridges/Module_bridges.mk canvas/inc canvas/Module_canvas.mk canvas/source chart2/qa chart2/source chart2/uiconfig codemaker/source comphelper/source compilerplugins/clang config_host.mk.in configmgr/source configure.ac connectivity/qa connectivity/source cppcanvas/qa cppcanvas/source cppuhelper/source cppu/source cpputools/Module_cpputools.mk cui/qa cui/source cui/uiconfig dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/inc desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/qa desktop/source desktop/uiconfig dictionaries distro-configs/Jenkins drawinglayer/source editeng/source embeddedobj/qa embeddedobj/source emfio/qa emfio/source extensions/Module_extensi ons.mk extensions/qa extensions/source extensions/uiconfig external/apr external/boost external/breakpad external/cairo external/coinmp external/cppunit external/curl external/epm external/expat external/firebird external/fontconfig external/freetype external/gpgmepp external/harfbuzz external/hunspell external/hyphen external/icu external/lcms2 external/libabw external/libassuan external/libatomic_ops external/libcdr external/libebook external/libeot external/libepubgen external/libetonyek external/libexttextcat external/libffi external/libfreehand external/libgpg-error external/libjpeg-turbo external/liblangtag external/libmspub external/libmwaw external/libnumbertext external/libodfgen external/liborcus external/libpagemaker external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwpg external/libwps external/libxml2 external/libxslt external/libzmf external/mythes external/neon external/openldap external/openssl external/pdfium ext ernal/poppler external/postgresql external/python3 external/redland external/serf external/xmlsec filter/Library_gie.mk filter/qa filter/source filter/uiconfig forms/source formula/qa formula/uiconfig fpicker/qa fpicker/source fpicker/uiconfig framework/inc framework/qa framework/source .git-hooks/pre-commit .gitignore helpcompiler/source helpcontent2 hwpfilter/qa i18nlangtag/source i18npool/inc i18npool/Library_i18npool.mk i18npool/source i18nutil/source icon-themes/elementary icon-themes/elementary_svg idl/source include/avmedia include/basic include/codemaker include/comphelper include/connectivity include/editeng include/filter include/helpcompiler include/i18nlangtag include/o3tl include/oox include/osl include/rtl include/sal include/sax include/sfx2 include/sot include/svl include/svtools include/svx include/test include/tools include/unotest include/unotools include/vbahelper include/vcl include/xmloff io/source jvmfwk/plugins l10ntools/inc l10ntools/source linguistic/source lotuswordpro/qa lotuswordpro/source Makefile.gbuild o3tl/qa offapi/com officecfg/registry oox/qa oox/source opencl/inc opencl/source package/inc package/qa package/source postprocess/Rdb_services.mk pyuno/source README.md README.wasm registry/source reportdesign/qa reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_build.mk RepositoryModule_host.mk sal/osl sal/qa sax/qa sax/source sccomp/qa sc/inc sc/Library_scui.mk sc/qa scripting/Module_scripting.mk scripting/source sc/source sc/uiconfig sdext/source sd/inc sd/Library_sdui.mk sd/qa sd/source sd/uiconfig sfx2/inc sfx2/qa sfx2/source sfx2/uiconfig shell/Module_shell.mk slideshow/source smoketest/smoketest.cxx solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/gbuild sot/qa sot/source starmath/qa starmath/source stoc/source svgio/qa svgio/source svl/Library_svl.mk svl/qa svl/source svtools/qa svtools/source svtools/uiconfig svx/Executable_gengal.mk svx/Modul e_svx.mk svx/qa svx/sdi svx/source svx/uiconfig sw/inc sw/Library_swui.mk sw/qa sw/source sw/uiconfig sysui/desktop test/source testtools/source toolkit/source tools/qa tools/source ucb/source unodevtools/source unoidl/Executable_unoidl-read.mk unoidl/source unotest/source unotools/qa unotools/source uui/qa uui/uiconfig vbahelper/source vcl/backendtest vcl/CppunitTest_vcl_filter_igif.mk vcl/Executable_ui-previewer.mk vcl/headless vcl/inc vcl/IwyuFilter_vcl.yaml vcl/jsdialog vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.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/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/uiconfig vcl/unx vcl/wasm vcl/win vcl/workben wasm/CustomTarget_components.mk wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk wasm/Executable_wasm-qt5-mandelbrot.mk wasm/Library_components.mk wasm/Makefile wasm/Module_wasm.mk wasm/README wasm/source wizards/source writerfilter/qa writerfilter/source writerperfect/qa writerperfect/source writerperfect/uiconfig xmlhelp/source xmloff/inc xmloff/qa xmloff/source xmlscript/source xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 31 02:12:38 UTC 2020


Rebased ref, commits from common ancestor:
commit f85ec31b3a2d4101a587e0878212df5ae9c0a11a
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Dec 31 00:25:16 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:50 2020 +0100

    Link writer
    
    Change-Id: Ic475e2a9c5c9f493eb1b897dc8356aed5523037d

diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index 8c0988ad67a1..bd3eb0036c0d 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_Executable_use_externals,ui-previewer,\
         boost_system \
         cairo \
         dtoa \
+        epubgen \
         expat \
         fontconfig \
         freetype \
@@ -43,6 +44,7 @@ $(eval $(call gb_Executable_use_externals,ui-previewer,\
         orcus-parser \
         qrcodegen \
         qt5 \
+        revenge \
     ) \
 ))
 
diff --git a/wasm/CustomTarget_components.mk b/wasm/CustomTarget_components.mk
index 0ba6e57eddbb..cb188166d894 100644
--- a/wasm/CustomTarget_components.mk
+++ b/wasm/CustomTarget_components.mk
@@ -19,6 +19,6 @@ $(wasm_WORKDIR)/component_maps.cxx: \
 	    $(SRCDIR)/solenv/bin/native-code.py \
 	    | $(wasm_WORKDIR)/.dir
 	$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
-	$(call gb_Helper_abbreviate_dirs,$(call gb_ExternalExecutable_get_command,python) $< -g core) > $@
+	$(call gb_Helper_abbreviate_dirs,$(call gb_ExternalExecutable_get_command,python) $< -g core -g writer) > $@
 
 # vim: set noet sw=4:
commit 6d93744463ecb3cc6eed40b5631b66d8c9a9b6bb
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 29 11:49:50 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:50 2020 +0100

    Add a static components library
    
    This adds all component libraries as dependency to a new components
    library, which otherwise just contains the "native" code with the
    mapping of the component constructors.
    
    Since there is no way to know, which components are actually used,
    this has to include all build components.
    
    Change-Id: Ie78af06c3325c0f58226a4c4da85a1d64fb45dc6

diff --git a/Makefile.gbuild b/Makefile.gbuild
index 6df4904421bd..f55f72c3da94 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -54,6 +54,10 @@ $(foreach lib,$(call gb_LinkTarget__get_link_depends,$(1)),
 ))
 endef
 
+ifeq ($(OS),EMSCRIPTEN)
+$(foreach lib,$(gb_Library_KNOWNLIBS),$(if $(call gb_Library__get_component,$(lib)),$(eval $(call gb_Library_use_libraries,components,$(lib)))))
+endif
+
 # gb_LinkTarget__fill_static_libs and gb_LinkTarget__remove_mark must run separate loops!
 $(foreach lib,$(gb_Library_KNOWNLIBS),$(eval $(call gb_LinkTarget__fill_static_libs,$(lib))))
 $(foreach lib,$(gb_Library_KNOWNLIBS),$(eval $(call gb_LinkTarget__remove_mark,$(call gb_Library_get_linktarget,$(lib)))))
diff --git a/Repository.mk b/Repository.mk
index 8d3fe5be50bd..2b5d597fc01b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -345,6 +345,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(call gb_Helper_optional,OPENCL,clew) \
 	$(if $(filter $(OS),WNT),,cmdmail) \
 	cppcanvas \
+	$(if $(filter $(OS),EMSCRIPTEN),components) \
 	configmgr \
 	ctl \
 	cui \
diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk
index 6bbab747d462..da044da5b9b9 100644
--- a/i18npool/Library_i18npool.mk
+++ b/i18npool/Library_i18npool.mk
@@ -25,6 +25,17 @@ $(eval $(call gb_Library_use_libraries,i18npool,\
 	i18nlangtag \
 	i18nutil \
 	sal \
+    $(if $(DISABLE_DYNLOADING), \
+        collator_data \
+        dict_ja \
+        dict_zh \
+        index_data \
+        localedata_en \
+        localedata_es \
+        localedata_euro \
+        localedata_others \
+        textconv_dict \
+    ) \
 ))
 
 $(eval $(call gb_Library_use_externals,i18npool,\
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 4e94f9b36a14..91b7bccb8376 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -233,7 +233,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
         if (bInitialized)
             return aInstance;
 
-#ifndef MACOSX
+#if ! defined(MACOSX) && ! defined(EMSCRIPTEN)
         // try libpaper
         // #i78617# workaround missing paperconf command
         FILE* pPipe = popen( "paperconf 2>/dev/null", "r" );
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
index 9cb1684caffc..52110127b842 100644
--- a/idl/source/objects/types.cxx
+++ b/idl/source/objects/types.cxx
@@ -251,7 +251,7 @@ void SvMetaType::WriteSfxItem(
 
     // write the implementation part
     rOutStm.WriteCharPtr( "#ifdef SFX_TYPEMAP" ) << endl;
-    rOutStm.WriteCharPtr( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(LINUX)))" ) << endl;
+    rOutStm.WriteCharPtr( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(EMSCRIPTEN) || defined(LINUX)))" ) << endl;
     rOutStm.WriteCharPtr( "__attribute__((__weak__))" ) << endl;
     rOutStm.WriteCharPtr( "#endif" ) << endl;
     rOutStm.WriteOString( aTypeName ).WriteOString( aVarName )
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx
index 046be764ba19..4378ad2d2f84 100644
--- a/sd/source/core/typemap.cxx
+++ b/sd/source/core/typemap.cxx
@@ -95,7 +95,49 @@
 #include <svx/galleryitem.hxx>
 #include <svx/sdangitm.hxx>
 
+#ifdef DISABLE_DYNLOADING
+/* Avoid clash with the ones from svx/source/form/typemap.cxx */
+#define aSfxBoolItem_Impl sd_source_core_typemap_aSfxBoolItem_Impl
+#define aSfxInt32Item_Impl sd_source_core_typemap_aSfxInt32Item_Impl
+#define aSfxStringItem_Impl sd_source_core_typemap_aSfxStringItem_Impl
+#define aSfxUInt16Item_Impl sd_source_core_typemap_aSfxUInt16Item_Impl
+#define aSfxUInt32Item_Impl sd_source_core_typemap_aSfxUInt32Item_Impl
+#define aSfxVoidItem_Impl sd_source_core_typemap_aSfxVoidItem_Impl
+#define aSvxClipboardFormatItem_Impl sd_source_core_typemap_aSvxClipboardFormatItem_Impl
+#define aSvxColorItem_Impl sd_source_core_typemap_aSvxColorItem_Impl
+#define aSvxContourItem_Impl sd_source_core_typemap_aSvxContourItem_Impl
+#define aSvxCrossedOutItem_Impl sd_source_core_typemap_aSvxCrossedOutItem_Impl
+#define aSvxFontHeightItem_Impl sd_source_core_typemap_aSvxFontHeightItem_Impl
+#define aSvxFontItem_Impl sd_source_core_typemap_aSvxFontItem_Impl
+#define aSvxLanguageItem_Impl sd_source_core_typemap_aSvxLanguageItem_Impl
+#define aSvxPostureItem_Impl sd_source_core_typemap_aSvxPostureItem_Impl
+#define aSvxShadowedItem_Impl sd_source_core_typemap_aSvxShadowedItem_Impl
+#define aSvxUnderlineItem_Impl sd_source_core_typemap_aSvxUnderlineItem_Impl
+#define aSvxOverlineItem_Impl sd_source_core_typemap_aSvxOverlineItem_Impl
+#define aSvxWeightItem_Impl sd_source_core_typemap_aSvxWeightItem_Impl
+#endif
+
 #define SFX_TYPEMAP
 #include <sdslots.hxx>
 
+#ifdef DISABLE_DYNLOADING
+#undef aSfxBoolItem_Impl
+#undef aSfxInt32Item_Impl
+#undef aSfxStringItem_Impl
+#undef aSfxUInt16Item_Impl
+#undef aSfxUInt32Item_Impl
+#undef aSfxVoidItem_Impl
+#undef aSvxClipboardFormatItem_Impl
+#undef aSvxColorItem_Impl
+#undef aSvxContourItem_Impl
+#undef aSvxCrossedOutItem_Impl
+#undef aSvxFontHeightItem_Impl
+#undef aSvxFontItem_Impl
+#undef aSvxLanguageItem_Impl
+#undef aSvxPostureItem_Impl
+#undef aSvxShadowedItem_Impl
+#undef aSvxTextLineItem_Impl
+#undef aSvxWeightItem_Impl
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 8883262025af..4edc248a6cf6 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -119,6 +119,9 @@ $(if $(3),$(call gb_Output_error,gb_Library_set_soversion_script: too many argum
 $(call gb_Library__set_soversion_script_platform,$(1),$(2))
 endef
 
+gb_Library__get_component_var = $(call gb_Library__get_workdir_linktargetname,$(1))<>COMPONENTFILE
+gb_Library__get_component = $($(call gb_Library__get_component_var,$(1)))
+
 # The dependency from workdir component target to outdir library should ensure
 # that gb_CppunitTest_use_component can transitively depend on the library.
 # But the component target also must be delivered; use the target
@@ -134,6 +137,7 @@ $(call gb_ComponentTarget_get_target,$(2)) :| \
 	$(call gb_Library_get_target,$(gb_Library__get_name))
 $(call gb_Library_get_clean_target,$(gb_Library__get_name)) : \
 	$(call gb_ComponentTarget_get_clean_target,$(2))
+$(eval $(call gb_Library__get_component_var,$(1)) += $(2))
 endef
 
 gb_Library__get_name = $(if $(filter $(1),$(gb_MERGEDLIBS)),merged,$(1))
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 941081614291..929712bd6081 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -7,11 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
 gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
-else
-gb_UnoApiHeadersTarget_select_variant = $(2)
-endif
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index b26a5b1dae6d..8c0988ad67a1 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -68,117 +68,7 @@ $(eval $(call gb_Executable_use_libraries,ui-previewer,\
     ucbhelper \
     vcl \
     $(if $(filter TRUE,$(DISABLE_DYNLOADING)), \
-        acc \
-        avmedia \
-        basegfx \
-        bib \
-        bootstrap \
-        cairocanvas \
-        canvasfactory \
-        canvastools \
-        chartcontroller \
-        chartcore \
-        collator_data \
-        configmgr \
-        cppcanvas \
-        ctl \
-        cui \
-        dba \
-        dbtools \
-        dict_ja \
-        dict_zh \
-        drawinglayer \
-        editeng \
-        embobj \
-        emfio \
-        epoxy \
-        evtatt \
-        expwrap \
-        filterconfig \
-        frm \
-        fsstorage \
-        fwk \
-        gie \
-        gie \
-        graphicfilter \
-        graphicfilter \
-        guesslang \
-        hyphen \
-        i18nlangtag \
-        i18npool \
-        i18npool \
-        i18nsearch \
-        i18nutil \
-        icg \
-        index_data \
-        introspection \
-        invocadapt \
-        invocation \
-        lng \
-        lnth \
-        localebe1 \
-        localedata_en \
-        localedata_es \
-        localedata_euro \
-        localedata_others \
-        msfilter \
-        mtfrenderer \
-        namingservice \
-        numbertext \
-        odfflatxml \
-        oox \
-        package2 \
-        pdffilter \
-        proxyfac \
-        reflection \
-        reg \
-        salhelper \
-        sax \
-        sax \
-        sb \
-        sfx \
-        simplecanvas \
-        sot \
-        spell \
-        srtrs1 \
-        stocservices \
-        storagefd \
-        store \
-        svgfilter \
-        svgio \
-        svl \
-        svt \
-        svx \
-        svxcore \
-        t602filter \
-        textconv_dict \
-        textfd \
-        tl \
-        tk \
-        ucb1 \
-        ucbhelper \
-        ucpdav1 \
-        ucpfile1 \
-        ucphier1 \
-        ucppkg1 \
-        ucptdoc1 \
-        unoidl \
-        unordf \
-        unoxml \
-        utl \
-        uui \
-        vclcanvas \
-        xmlfa \
-        xmlfd \
-        xmlreader \
-        xmlscript \
-        xo \
-        xof \
-        xsltdlg \
-        xsltfilter \
-        xsltfilter \
-        xstor \
-        $(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
+        $(if $(filter EMSCRIPTEN,$(OS)),components) \
     ) \
 ))
 
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 67290fdd6e9d..602d09a1ac24 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -579,9 +579,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     $(vcl_headless_freetype_code) \
 ))
 
-$(eval $(call gb_Library_add_generated_exception_objects,vcl,\
-    CustomTarget/vcl/wasm/native-code \
-))
 
 $(eval $(call gb_Library_use_externals,vcl,\
     cairo \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 34e0bd041583..a45b43be22bd 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -123,12 +123,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
 ))
 endif
 
-ifeq ($(OS),EMSCRIPTEN)
-$(eval $(call gb_Module_add_targets,vcl,\
-    CustomTarget_wasm_native \
-))
-endif
-
 ifneq ($(ENABLE_FUZZERS),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_nativecore \
diff --git a/vcl/CustomTarget_wasm_native.mk b/wasm/CustomTarget_components.mk
similarity index 71%
rename from vcl/CustomTarget_wasm_native.mk
rename to wasm/CustomTarget_components.mk
index 1bd829634030..0ba6e57eddbb 100644
--- a/vcl/CustomTarget_wasm_native.mk
+++ b/wasm/CustomTarget_components.mk
@@ -8,14 +8,14 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_CustomTarget_CustomTarget,vcl/wasm))
+$(eval $(call gb_CustomTarget_CustomTarget,wasm/components))
 
-wasm_WORKDIR := $(call gb_CustomTarget_get_workdir,vcl/wasm)
+wasm_WORKDIR := $(call gb_CustomTarget_get_workdir,wasm)
 
-$(call gb_CustomTarget_get_target,vcl/wasm): \
-	$(wasm_WORKDIR)/native-code.cxx
+$(call gb_CustomTarget_get_target,wasm/components): \
+	$(wasm_WORKDIR)/component_maps.cxx
 
-$(wasm_WORKDIR)/native-code.cxx: \
+$(wasm_WORKDIR)/component_maps.cxx: \
 	    $(SRCDIR)/solenv/bin/native-code.py \
 	    | $(wasm_WORKDIR)/.dir
 	$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
diff --git a/wasm/Library_components.mk b/wasm/Library_components.mk
new file mode 100644
index 000000000000..128a3c12c2df
--- /dev/null
+++ b/wasm/Library_components.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,components))
+
+$(eval $(call gb_Library_add_generated_exception_objects,components,\
+    CustomTarget/wasm/component_maps \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm/Module_wasm.mk b/wasm/Module_wasm.mk
index 0ef8c4c6aaf4..d6f507a005df 100644
--- a/wasm/Module_wasm.mk
+++ b/wasm/Module_wasm.mk
@@ -13,6 +13,8 @@ ifeq ($(OS),EMSCRIPTEN)
 $(eval $(call gb_Module_add_targets,wasm,\
     CustomTarget_wasm-qt5-mandelbrot_moc \
     Executable_wasm-qt5-mandelbrot \
+    CustomTarget_components \
+    Library_components \
 ))
 
 endif
commit 3ad35ccc24f1a60b242eaa59fab919520a5ae016
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 29 11:42:30 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:49 2020 +0100

    gbuild: introduce plugin (loader) concept
    
    This introduces two concepts: a plugin and its loader (library)
    
    LO currrently has dependency cycles for some libraries. There is
    scui, which depends on sc, while sc dlopen's scui. There are the
    various vclplug_* and the filters/gie libraries, which depends on
    vcl and vcl dlopen's them. While the dependcies of the plugins on
    their loader works fine, for static builds you must add a
    dependency from the loader to the plugins, which introduces a
    dependency cycle.
    
    In the end this adds the plugins as dependencies to Executables,
    if they depend on a plugin loader library.
    
    I codeified a few rules into the build system along with it:
    * just plugins are allowed to depend / link other plugins
    * plugins aren't allowed to be linked into the merge lib
    * plugin loaders are "limited" to libraries
    
    At the high level, this is implemented via two new gbuild calls:
    * gb_Library_set_plugin_for,lib,loader: declare a library to be a
      plugin of a loader library
    * gb_Helper_register_plugins_for_install: "plugin" replacement for
      gb_Helper_register_libraries_for_install to implement some
      additional checks in the build system
    
    For the shared build, nothing changes. gb_Library_set_plugin_for is
    just forwarded to gb_LinkTarget__use_libraries.
    
    P.S. Android and iOS don't build their "executables" using gbuild,
    but call bin/lo-all-static-libs to "let the linker figure it out".
    
    Change-Id: I7b01d9c384cbc5838bd2cc93aff18e4868939d6e

diff --git a/Makefile.gbuild b/Makefile.gbuild
index c796662b35e7..6df4904421bd 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -47,6 +47,8 @@ endef
 define gb_LinkTarget__add_static_libs
 $(foreach lib,$(call gb_LinkTarget__get_link_depends,$(1)),
 	$(foreach dep,$(lib) $(call gb_Library__get_link_depends,$(lib)),
+		$(foreach plugin,$(call gb_Library__get_plugins,$(dep)),$(if $(filter $(plugin),$(call gb_LinkTarget__get_link_depends,$(1))),,
+			$(eval $(call gb_LinkTarget_use_libraries,$(1),$(call gb_Library__get_plugins,$(dep))))))
 		$(if $(filter $(dep),$(lib) $(call gb_LinkTarget__get_link_depends,$(1))),,
 			$(eval $(call gb_LinkTarget_use_libraries,$(1),$(dep))))
 ))
diff --git a/Repository.mk b/Repository.mk
index fbe24f3855bc..8d3fe5be50bd 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -252,12 +252,15 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \
 	sc \
 	scd \
 	scfilt \
-	scui \
 	wpftcalc \
 	solver \
 	$(call gb_Helper_optional,SCRIPTING,vbaobj) \
 ))
 
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,calc, \
+	scui \
+))
+
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,graphicfilter, \
 	svgfilter \
 	wpftdraw \
@@ -280,19 +283,26 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,onlineupdate, \
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,gnome, \
 	$(if $(ENABLE_EVOAB2),evoab) \
-	$(if $(ENABLE_GTK3),vclplug_gtk3) \
 	$(if $(ENABLE_GIO),losessioninstall) \
 	$(if $(ENABLE_GIO),ucpgio1) \
 ))
 
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,gnome, \
+    $(if $(ENABLE_GTK3),vclplug_gtk3) \
+))
+
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \
 	$(if $(ENABLE_KF5),kf5be1) \
-	$(if $(USING_X11), \
-        $(if $(ENABLE_KF5),vclplug_kf5) \
-        $(if $(ENABLE_QT5),vclplug_qt5) \
-        $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \
-	) \
 ))
+
+ifneq (,$(USING_X11))
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,kde, \
+    $(if $(ENABLE_KF5),vclplug_kf5) \
+    $(if $(ENABLE_QT5),vclplug_qt5) \
+    $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \
+))
+endif
+
 ifneq ($(ENABLE_GTK3_KDE5),)
 $(eval $(call gb_Helper_register_executables_for_install,OOO,kde, \
        lo_kde5filepicker \
@@ -300,7 +310,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,kde, \
 endif
 
 ifeq ($(OS),HAIKU)
-$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,haiku, \
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,haiku, \
     $(if $(ENABLE_QT5),vclplug_qt5) \
     $(if $(ENABLE_KF5),vclplug_kf5) \
 ))
@@ -370,7 +380,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),helplinker) \
 	i18npool \
 	i18nsearch \
-    gie \
 	hyphen \
     icg \
 	$(if $(ENABLE_JAVA),jdbc) \
@@ -406,7 +415,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	sd \
 	sdd \
 	sdfilt \
-	sdui \
 	sfx \
 	simplecanvas \
 	slideshow \
@@ -451,14 +459,10 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	xof \
 	xsltdlg \
 	xsltfilter \
-	$(if $(USING_X11), \
-		vclplug_gen \
-	) \
 	$(if $(filter $(OS),WNT), \
 		ado \
 		oleautobridge \
 		smplmail \
-		vclplug_win \
 		wininetbe1 \
 	) \
 	$(if $(filter $(OS),MACOSX), \
@@ -466,12 +470,19 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 			AppleRemote \
 		) \
 		fps_aqua \
-		vclplug_osx \
 	) \
 	$(if $(filter iOS MACOSX,$(OS)), \
 		MacOSXSpell \
 	) \
-	$(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
+))
+
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,ooo, \
+    gie \
+    sdui \
+    $(if $(USING_X11),vclplug_gen) \
+    $(if $(filter $(OS),WNT),vclplug_win) \
+    $(if $(filter $(OS),MACOSX),vclplug_osx) \
+    $(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,postgresqlsdbc, \
@@ -510,7 +521,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,writer, \
 	$(if $(ENABLE_LWP),lwpft) \
 	msword \
 	swd \
-	swui \
 	t602filter \
 	$(call gb_Helper_optional,SCRIPTING,vbaswobj) \
 	wpftwriter \
@@ -518,6 +528,10 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,writer, \
 	$(call gb_Helper_optional,DBCONNECTIVITY,writer) \
 ))
 
+$(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,writer, \
+	swui \
+))
+
 # cli_cppuhelper is NONE even though it is actually in URE because it is CliNativeLibrary
 $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
 	smoketest \
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 2dcab32717b6..524f98d1d555 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -24,6 +24,8 @@ $(eval $(call gb_Library_set_include,gie,\
     -I$(SRCDIR)/filter/inc \
 ))
 
+$(eval $(call gb_Library_set_plugin_for,gie,vcl))
+
 $(eval $(call gb_Library_use_external,gie,boost_headers))
 
 $(eval $(call gb_Library_use_sdk_api,gie))
@@ -39,7 +41,6 @@ $(eval $(call gb_Library_use_libraries,gie,\
     comphelper \
     i18nlangtag \
     svt \
-    vcl \
     utl \
     tl \
     tk \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 86605ab63a0d..4d4cffa12bd4 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -9,6 +9,8 @@
 
 $(eval $(call gb_Library_Library,scui))
 
+$(eval $(call gb_Library_set_plugin_for,scui,sc))
+
 $(eval $(call gb_Library_set_include,scui,\
 	-I$(SRCDIR)/sc/source/core/inc \
 	-I$(SRCDIR)/sc/source/filter/inc \
@@ -55,7 +57,6 @@ $(eval $(call gb_Library_use_libraries,scui,\
 	$(call gb_Helper_optional,OPENCL, \
 		opencl) \
 	sal \
-	sc \
 	sfx \
 	sot \
 	svl \
diff --git a/sd/Library_sdui.mk b/sd/Library_sdui.mk
index c776e2eed532..a774d0610cb4 100644
--- a/sd/Library_sdui.mk
+++ b/sd/Library_sdui.mk
@@ -9,6 +9,8 @@
 
 $(eval $(call gb_Library_Library,sdui))
 
+$(eval $(call gb_Library_set_plugin_for,sdui,sd))
+
 $(eval $(call gb_Library_set_include,sdui,\
     $$(INCLUDE) \
     -I$(SRCDIR)/sd/inc \
@@ -49,7 +51,6 @@ $(eval $(call gb_Library_use_libraries,sdui,\
     fwk \
     sal \
     salhelper \
-    sd \
     sfx \
     sot \
     svl \
diff --git a/solenv/gbuild/Helper.mk b/solenv/gbuild/Helper.mk
index 2aa0fc8d65b2..2367a8ba9a91 100644
--- a/solenv/gbuild/Helper.mk
+++ b/solenv/gbuild/Helper.mk
@@ -199,6 +199,13 @@ $(if $(filter UNOVERLIBS RTVERLIBS,$(1)),\
 
 endef
 
+# a plugin is a library, why can't be dynamically linked and must be dlopen'd, but must be linked static
+define gb_Helper_register_plugins_for_install
+$(call gb_Helper_register_libraries_for_install,$(1),$(2),$(3))
+gb_Library_KNOWNPLUGINS += $(3)
+
+endef
+
 define gb_Helper__register_jars
 $(foreach group,$(gb_Jar_VALIDGROUPS),\
  $(foreach target,$(2),\
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 8c3c2207480d..8883262025af 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -162,6 +162,18 @@ gb_Library__COMPONENTPREFIXES := \
 
 gb_Library_get_runtime_filename = $(call gb_Library_get_filename,$(1))
 
+# call gb_Library_set_plugin_for,library,loader
+define gb_Library_set_plugin_for
+ifneq (,$$(filter-out $(gb_Library_KNOWNPLUGINS),$(1)))
+$$(eval $$(call gb_Output_info,currently known plugins are: $(sort $(gb_Library_KNOWNPLUGINS)),ALL))
+$$(eval $$(call gb_Output_error,Unknown plugin(s) '$$(filter-out $(gb_Library_KNOWNPLUGINS),$(1)))'. Plugins must be registered in Repository.mk or RepositoryExternal.mk))
+endif
+
+$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(2))) : PLUGINS += $(1)
+$(eval $(call gb_LinkTarget__add_plugin,$(call gb_Library_get_linktarget,$(2)),$(1)))
+$(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+endef
+
 # forward the call to the gb_LinkTarget implementation
 # (note: because the function name is in $(1), the other args are shifted by 1)
 define gb_Library__forward_to_Linktarget
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index f350dbce7994..a2712b15dc07 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -1085,6 +1085,7 @@ $(call gb_LinkTarget_get_target,$(1)) : \
 else
 $(call gb_LinkTarget__get_link_depends_var,$(1)) += $(3)
 endif
+
 $(call gb_LinkTarget_get_headers_target,$(1)) : \
 	$(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
 $(foreach lib,$(2),$(call gb_LinkTarget__lib_dummy_depend,$(lib)))
@@ -1133,7 +1134,12 @@ endef
 define gb_LinkTarget_use_libraries
 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
-$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+$$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+endif
+ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS)))
+ifneq (,$$(filter $(1),$$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library__get_workdir_linktargetname,$(plugin)))))
+$$(eval $$(call gb_Output_error,Cannot link against plugin library/libraries '$$(filter $(2),$(gb_Library_KNOWNPLUGINS))'. Only plugins are allowed to do that.))
+endif
 endif
 
 ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
@@ -1833,5 +1839,33 @@ $(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(or $(CLANG_USE_LD),$(USE_L
 
 endef
 
+gb_LinkTarget__get_plugins_var = $(call gb_LinkTarget__get_workdir_linktargetname,$(1))<>PLUGINS
+gb_LinkTarget__get_plugins = $($(call gb_LinkTarget__get_plugins_var,$(1)))
+gb_Library__get_plugins = $($(call gb_LinkTarget__get_plugins_var,$(call gb_Library_get_linktarget,$(1))))
+
+define gb_LinkTarget__add_plugin
+$(call gb_LinkTarget__get_plugins_var,$(1)) += $(2)
+
+endef
+
+# call gb_LinkTarget__set_plugin_for,linktarget,loader
+define gb_LinkTarget__set_plugin_for
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
+$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+endif
+ifeq (,$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin)))))
+$$(eval $$(call gb_Output_error,Unknown plugin(s) '$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin))))'. Plugins must be registered in Repository.mk or RepositoryExternal.mk))
+endif
+ifeq (,$(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib)))))
+$$(eval $$(call gb_Output_error,Plugins can't be in mergelibs))
+endif
+ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
+$$(eval $$(call gb_Output_error,Plugin support for build tools not implemented))
+endif
+
+$(call gb_LinkTarget__use_libraries,$(1),$(2),$(2))
+
+endef
 
 # vim: set noet sw=4:
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 99f1dd20ae3d..e643179d355f 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,swui))
 
+$(eval $(call gb_Library_set_plugin_for,swui,sw))
+
 $(eval $(call gb_Library_set_include,swui,\
     -I$(SRCDIR)/sw/inc \
     -I$(SRCDIR)/sw/source/uibase/inc \
@@ -69,7 +71,6 @@ $(eval $(call gb_Library_use_libraries,swui,\
     svx \
     svx \
     svxcore \
-    sw \
     tk \
     tl \
     ucbhelper \
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index 0b9d23e40de5..126ae9ad8263 100644
--- a/vcl/Library_vclplug_gen.mk
+++ b/vcl/Library_vclplug_gen.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_gen))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_gen,vcl))
+
 $(eval $(call gb_Library_set_include,vclplug_gen,\
     $$(INCLUDE) \
     -I$(SRCDIR)/vcl/inc \
@@ -33,7 +35,6 @@ $(eval $(call gb_Library_use_sdk_api,vclplug_gen))
 $(eval $(call gb_Library_use_common_precompiled_header,vclplug_gen))
 
 $(eval $(call gb_Library_use_libraries,vclplug_gen,\
-    vcl \
     tl \
     utl \
     sot \
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index afc85d224918..8fb5ddd474da 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_gtk3))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_gtk3,vcl))
+
 # Silence deprecation warnings wholesale as long as vcl/unx/gtk3/*.cxx just
 # forward to vcl/unx/gtk/*.cxx:
 $(eval $(call gb_Library_add_cxxflags,vclplug_gtk3, \
@@ -53,7 +55,6 @@ $(eval $(call gb_Library_add_libs,vclplug_gtk3,\
 ))
 
 $(eval $(call gb_Library_use_libraries,vclplug_gtk3,\
-    vcl \
     svl \
     tl \
     utl \
diff --git a/vcl/Library_vclplug_gtk3_kde5.mk b/vcl/Library_vclplug_gtk3_kde5.mk
index 8dffad18c9de..2bc2a6d5c480 100644
--- a/vcl/Library_vclplug_gtk3_kde5.mk
+++ b/vcl/Library_vclplug_gtk3_kde5.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_gtk3_kde5))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_gtk3_kde5,vcl))
+
 # Silence deprecation warnings wholesale as long as vcl/unx/gtk3/*.cxx just
 # forward to vcl/unx/gtk/*.cxx:
 $(eval $(call gb_Library_add_cxxflags,vclplug_gtk3_kde5, \
@@ -59,7 +61,6 @@ $(eval $(call gb_Library_add_libs,vclplug_gtk3_kde5,\
 
 $(eval $(call gb_Library_use_libraries,vclplug_gtk3_kde5,\
     svl \
-    vcl \
     tl \
     utl \
     sot \
diff --git a/vcl/Library_vclplug_kf5.mk b/vcl/Library_vclplug_kf5.mk
index d10cecd167d5..1e7765a6d6ce 100644
--- a/vcl/Library_vclplug_kf5.mk
+++ b/vcl/Library_vclplug_kf5.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_kf5))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_kf5,vcl))
+
 $(eval $(call gb_Library_use_custom_headers,vclplug_kf5,vcl/unx/kf5))
 
 $(eval $(call gb_Library_set_include,vclplug_kf5,\
@@ -35,7 +37,6 @@ $(eval $(call gb_Library_use_sdk_api,vclplug_kf5))
 
 $(eval $(call gb_Library_use_libraries,vclplug_kf5,\
     vclplug_qt5 \
-    vcl \
     tl \
     utl \
     sot \
diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk
index f0d22298a0c8..f986f377a672 100644
--- a/vcl/Library_vclplug_osx.mk
+++ b/vcl/Library_vclplug_osx.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_osx))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_osx,vcl))
+
 $(eval $(call gb_Library_set_include,vclplug_osx,\
     $$(INCLUDE) \
     -I$(SRCDIR)/vcl/inc \
@@ -51,7 +53,6 @@ $(eval $(call gb_Library_use_libraries,vclplug_osx,\
     sal \
     salhelper \
     tl \
-    vcl \
 ))
 
 $(eval $(call gb_Library_use_externals,vclplug_osx,\
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 3aad76800ad6..58858bac6946 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_qt5))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_qt5,vcl))
+
 $(eval $(call gb_Library_use_custom_headers,vclplug_qt5,vcl/qt5))
 
 $(eval $(call gb_Library_set_include,vclplug_qt5,\
@@ -35,7 +37,6 @@ $(eval $(call gb_Library_add_defs,vclplug_qt5,\
 $(eval $(call gb_Library_use_sdk_api,vclplug_qt5))
 
 $(eval $(call gb_Library_use_libraries,vclplug_qt5,\
-    vcl \
     tl \
     utl \
     sot \
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index 38031387be4a..c386d1ff1397 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Library_Library,vclplug_win))
 
+$(eval $(call gb_Library_set_plugin_for,vclplug_win,vcl))
+
 $(eval $(call gb_Library_set_componentfile,vclplug_win,vcl/vclplug_win))
 
 $(eval $(call gb_Library_set_include,vclplug_win,\
@@ -52,7 +54,6 @@ $(eval $(call gb_Library_use_libraries,vclplug_win,\
     salhelper \
     tl \
     utl \
-    vcl \
 ))
 
 $(eval $(call gb_Library_use_externals,vclplug_win,\
commit 611d4db0beff31c28646b56b91c98780b4f1aa27
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 29 11:40:44 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:49 2020 +0100

    gbuild: cache static library dependencies
    
    This caches the list of static dependencies, so building a module
    will still be able to link executables statically after a full
    build.
    
    Change-Id: Iaa201da4d5b3796cf18b1288d6c8b5bb42339a9c

diff --git a/Makefile.gbuild b/Makefile.gbuild
index cd7fc973c287..c796662b35e7 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -20,6 +20,47 @@ include $(SRCDIR)/solenv/gbuild/gbuild.mk
 
 $(eval $(call gb_Module_make_global_targets,$(SRCDIR)/RepositoryModule_$(gb_Side).mk))
 
+ifneq (,$(DISABLE_DYNLOADING))
+ifeq ($(true),$(gb_FULLDEPS))
+ifeq (,$(gb_PARTIAL_BUILD))
+
+define gb_LinkTarget__add_depends
+$(call gb_LinkTarget__get_link_depends_var,$(call gb_Library_get_linktarget,$(1))) += $(2)
+
+endef
+
+define gb_LinkTarget__remove_mark
+$(call gb_LinkTarget__get_link_depends_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_link_depends,$(1)))
+
+endef
+
+define gb_LinkTarget__fill_static_libs
+$(if $(filter GBUILD_TOUCHED,$(call gb_Library__get_link_depends,$(1))),,
+	$(foreach lib,$(call gb_Library__get_link_depends,$(1)),
+		$(call gb_LinkTarget__fill_static_libs,$(lib))
+		$(foreach dep,$(call gb_Library__get_link_depends,$(lib)),
+			$(if $(filter $(dep),GBUILD_TOUCHED $(call gb_Library__get_link_depends,$(1))),,
+				$(eval $(call gb_LinkTarget__add_depends,$(1),$(dep))))))
+	$(eval $(call gb_LinkTarget__add_depends,$(1),GBUILD_TOUCHED)))
+endef
+
+define gb_LinkTarget__add_static_libs
+$(foreach lib,$(call gb_LinkTarget__get_link_depends,$(1)),
+	$(foreach dep,$(lib) $(call gb_Library__get_link_depends,$(lib)),
+		$(if $(filter $(dep),$(lib) $(call gb_LinkTarget__get_link_depends,$(1))),,
+			$(eval $(call gb_LinkTarget_use_libraries,$(1),$(dep))))
+))
+endef
+
+# gb_LinkTarget__fill_static_libs and gb_LinkTarget__remove_mark must run separate loops!
+$(foreach lib,$(gb_Library_KNOWNLIBS),$(eval $(call gb_LinkTarget__fill_static_libs,$(lib))))
+$(foreach lib,$(gb_Library_KNOWNLIBS),$(eval $(call gb_LinkTarget__remove_mark,$(call gb_Library_get_linktarget,$(lib)))))
+$(foreach exec,$(gb_Executable_KNOWN),$(eval $(call gb_LinkTarget__add_static_libs,$(call gb_Executable_get_linktarget,$(exec)))))
+
+endif # ! $(gb_PARTIAL_BUILD)
+endif # $(gb_FULLDEPS)
+endif # $(DISABLE_DYNLOADING)
+
 upload-symbols:
 	bin/upload_symbols.py $(WORKDIR)/symbols.zip $(BREAKPAD_SYMBOL_CONFIG) "$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)"
 
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 6cd8719f91b7..f350dbce7994 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -597,6 +597,7 @@ $(WORKDIR)/Clean/LinkTarget/% :
 		$(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \
 		$(call gb_LinkTarget_get_target,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_dep_target,$(LINKTARGET)) \
+		$(call gb_LinkTarget_get_gbuild_libs_target,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_headers_target,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_objects_list,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_pch_timestamp,$(LINKTARGETMAKEFILENAME)) \
@@ -673,12 +674,32 @@ $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_headers_target,
 
 endef
 
+define gb_LinkTarget__command_gbuild_libs
+$(call gb_Output_announce,LNK:$(2),$(true),DLK,1)
+mkdir -p $(dir $(1)) && \
+TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
+	$(call gb_LinkTarget__get_link_depends,$(2))) && \
+mv $${TEMPFILE} $(1)
+
+endef
+
+define gb_LinkTarget__add_linked_libs
+$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
+
+endef
+
 # it's not possible to use a pattern rule for files in INSTDIR because
 # it would inevitably conflict with the pattern rule for Package
 # (especially since external libraries are delivered via Package)
 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
 define gb_LinkTarget__command_impl
 	$(if $(gb_FULLDEPS),
+		$(if $(DISABLE_DYNLOADING),
+			$(if $(gb_PARTIAL_BUILD),
+				$(if $(filter Executable,$(TARGETTYPE)),$(eval $(call gb_LinkTarget__add_linked_libs,$(1),$(shell cat $(call gb_LinkTarget_get_gbuild_libs_target,$(2))))))
+			,
+	                        $(call gb_LinkTarget__command_gbuild_libs,$(call gb_LinkTarget_get_gbuild_libs_target,$(2)).tmp,$(2))
+	                        mv $(call gb_LinkTarget_get_gbuild_libs_target,$(2)).tmp $(call gb_LinkTarget_get_gbuild_libs_target,$(2))))
 		$(if $(findstring concat-deps,$(2)),,
 			$(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$(2)).tmp,$(2))
 			mv $(call gb_LinkTarget_get_dep_target,$(2)).tmp $(call gb_LinkTarget_get_dep_target,$(2))))
@@ -695,7 +716,19 @@ endef
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
 	$(call gb_LinkTarget__command_dep,$@,$*)
+
+ifneq (,$(DISABLE_DYNLOADING))
+ifeq (,$(gb_PARTIAL_BUILD))
+$(call gb_LinkTarget_get_dep_target,%) : $(call gb_LinkTarget_get_gbuild_libs_target,%)
+
+$(call gb_LinkTarget_get_gbuild_libs_target,%) : | $(dir $(call gb_LinkTarget_get_gbuild_libs_target,%)).dir
+	$(call gb_LinkTarget__command_gbuild_libs,$@,$*)
+
+$(dir $(call gb_LinkTarget_get_gbuild_libs_target,%))/.dir :
+	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+endif
 endif
+endif # $(gb_FULLDEPS)
 
 # Ok, this is some dark voodoo: When declaring a linktarget with
 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
@@ -851,7 +884,12 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS :=
+ifneq (,$(DISABLE_DYNLOADING))
+ifeq (,$(gb_PARTIAL_BUILD))
+$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_LinkTarget_get_gbuild_libs_target,$(1))
 endif
+endif
+endif # $(gb_FULLDEPS)
 
 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := cxx
 
@@ -860,7 +898,7 @@ $(if $(findstring $(INSTDIR),$(1)),$(call gb_LinkTarget__make_installed_rule,$(1
 
 $(call gb_PrecompiledHeader_generate_timestamp_rule,$(2))
 
-endef
+endef # gb_LinkTarget_LinkTarget
 
 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
 define gb_LinkTarget_set_soversion_script
@@ -1022,6 +1060,10 @@ $(call gb_Library_get_target,$(1)) :| $(call gb_Library_get_headers_target,$(1))
 
 endef
 
+gb_LinkTarget__get_link_depends_var = $(call gb_LinkTarget__get_workdir_linktargetname,$(1))<>ALL_STATIC_LIBS
+gb_LinkTarget__get_link_depends = $($(call gb_LinkTarget__get_link_depends_var,$(1)))
+gb_Library__get_link_depends = $($(call gb_LinkTarget__get_link_depends_var,$(call gb_Library_get_linktarget,$(1))))
+
 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
 define gb_LinkTarget__use_libraries
 
@@ -1040,6 +1082,8 @@ $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
 ifeq ($(DISABLE_DYNLOADING),)
 $(call gb_LinkTarget_get_target,$(1)) : \
 	$(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib)))
+else
+$(call gb_LinkTarget__get_link_depends_var,$(1)) += $(3)
 endif
 $(call gb_LinkTarget_get_headers_target,$(1)) : \
 	$(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 801d188be737..4d71a179959f 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -118,6 +118,8 @@ gb_LinkTarget_get_objects_list = \
  $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objectlist
 gb_LinkTarget_get_dep_target = \
  $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d
+gb_LinkTarget_get_gbuild_libs_target = \
+ $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).gbuildlibs
 gb_LinkTarget_get_clean_target = \
  $(WORKDIR)/Clean/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))
 gb_LinkTarget_get_target = $(lastword $(subst <>,  ,$(1)))
commit 784f26e4b02170295b11374b4c24db34dbba795e
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 29 11:57:02 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:49 2020 +0100

    Drop some duplicate code
    
    Change-Id: Iff627d34774d495bec9ebe5c499dd0fd43a1d819

diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 273415d9461e..8bd23682bb5d 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -52,10 +52,6 @@ static const char *lcl_DATA_ES = "localedata_es";
 static const char *lcl_DATA_EURO = "localedata_euro";
 static const char *lcl_DATA_OTHERS = "localedata_others";
 
-#endif
-
-#ifndef DISABLE_DYNLOADING
-
 const struct {
     const char* pLocale;
     const char* pLib;
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 1973249f5db4..8c3c2207480d 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -172,7 +172,6 @@ endef
 # copy pasta for forwarding: this could be (and was) done more elegantly, but
 # these here can be found by both git grep and ctags
 gb_Library_add_cobject = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
-gb_Library_add_cobject = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Library_add_cobjects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Library_add_cxxobject = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Library_add_cxxobjects = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
commit 35da2415181844e2b52ae255d818296f737d28c4
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Dec 24 22:47:22 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:49 2020 +0100

    Dummy
    
    Change-Id: Id4b8499dc2154466036f39150386d575a348a3ef

diff --git a/README.wasm b/README.wasm
index 3e201737bd24..cbc08a40a490 100644
--- a/README.wasm
+++ b/README.wasm
@@ -47,12 +47,13 @@ make -j<CORES> module-qtbase module-qtdeclarative
 
 Building with examples will break with some of them, but at that point Qt already works.
 
-Checking for target architecture... Project ERROR: target architecture detection binary not found.
+At some point Qt configure failed for me with:
+"Checking for target architecture... Project ERROR: target architecture detection binary not found."
 
 What seems to have fixed this was to run "emsdk activate 1.39.8" again.
 
 Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
-Use: emrun --serve_after_close to run Qt WASM demos
+Use "emrun --serve_after_close" to run Qt WASM demos
 
 Enabling multi-thread support in Firefox is a bit of work with older versions:
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1477743#c7
@@ -62,7 +63,7 @@ Enabling multi-thread support in Firefox is a bit of work with older versions:
 
 == Setup LO ==
 
-Currently autogen.sh is patched to use emconfigure. That basically sets various environment vars,
+autogen.sh is patched to use emconfigure. That basically sets various environment vars,
 especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
 configure (a.out).
 
@@ -80,7 +81,6 @@ QT5DIR=/dir/of/git_qt5/qtbase
 --disable-firebird-sdbc
 --disable-gio
 --disable-gstreamer-1-0
---disable-gtk3
 --disable-ldap
 --disable-lpsolve
 --disable-mariadb-sdbc
@@ -96,15 +96,14 @@ QT5DIR=/dir/of/git_qt5/qtbase
 --disable-scripting
 --disable-sdremote-bluetooth
 --enable-ccache
---enable-qt5
---without-fonts
 --without-helppack-integration
 --without-java
 --without-junit
 --without-system-dicts
+--with-fonts
 --with-theme=no
 
-Will also be encoded in configure.ac at some point, some already is.
+Many will also be encoded in configure.ac at some point, some already is.
 
 
 = Ideas for an UNO bridge implementation =
@@ -186,9 +185,6 @@ We're also using emconfigure at the moment. Originally I patched emscripten, bec
 woulden't create the correct a.out file for C++ configure tests. Later I found that
 the emconfigure sets EMMAKEN_JUST_CONFIGURE to work around the problem.
 
-But it sets many more environment variables with "em<tool>" variants. This can all be moved
-into LO configure later.
-
 ICU bug: https://github.com/emscripten-core/emscripten/issues/10129
 Alternative, probably: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Intl
 
diff --git a/configure.ac b/configure.ac
index 81ddcc15f43a..aedfedde6211 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2916,7 +2916,7 @@ fi
 if test -z "$enable_scripting"; then
     # Disable scripting for iOS unless specifically overridden
     # with --enable-scripting.
-    if test $_os != iOS; then
+    if test $_os != iOS -o $_os = Emscripten; then
         enable_scripting=yes
     fi
 fi
@@ -2930,7 +2930,7 @@ else
     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
 fi
 
-if test $_os = iOS -o $_os = Android; then
+if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
     # Disable dynamic_loading always for iOS and Android
     enable_dynamic_loading=no
 elif test -z "$enable_dynamic_loading"; then
@@ -5234,6 +5234,7 @@ if test "$cross_compiling" = "yes"; then
     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
     cd CONF-FOR-BUILD
 
+    # Handle host configuration, which affects the cross-toolset too
     sub_conf_opts=""
     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
@@ -5512,8 +5513,9 @@ if test "$USING_X11" != TRUE; then
 fi
 
 if test "$OS" = "EMSCRIPTEN"; then
-    enable_cairo_canvas=yes
     test_qt5=yes
+    enable_cairo_canvas=yes
+    enable_qt5=yes
 fi
 
 if test "$OS" = "HAIKU"; then
diff --git a/solenv/bin/run-configure b/solenv/bin/run-configure
index 9a0f2724f3a8..9758ff1d86c6 100755
--- a/solenv/bin/run-configure
+++ b/solenv/bin/run-configure
@@ -1,5 +1,9 @@
 #!/bin/sh
+
+# We could run emconfigure here, but LO's gbuild should have set up everything
+# correctly. If something breaks because of this, we likely have mre problems.
 if test "$OS" = "EMSCRIPTEN"; then
     export EMMAKEN_JUST_CONFIGURE=1
 fi
+
 exec "$@"
commit 1788edfd70afd3b1237c1a59569fd5c23680006b
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 22 12:47:03 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:49 2020 +0100

    Build mandelbrot WASM Qt example via gbuild
    
    All the flags are copied directly from the qmake example. The
    emscripten HTML doesn't work, but copying the Qt HTML and the
    qtloader.js correctly runs the example in the browser.
    
    This is all a bit messy, but it is mainly a know working app
    to verify any WASM development at this point, so we know the
    Gbuild configuration can build a WASM application.
    
    Change-Id: I1e5fcc64f452d524192f4ea6d975aafafbb9f5bb

diff --git a/README.wasm b/README.wasm
index 012d8c981539..3e201737bd24 100644
--- a/README.wasm
+++ b/README.wasm
@@ -5,6 +5,13 @@ $ 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 it's HTML
+and the qtloader.js from the Qt's example folder after build with:
+
+$ emrun --serve_after_close workdir/LinkTarget/Executable/mandelbrot.html
+
+REMINDER: always start new tabs in the browser, reload might fail / cache!
+
 
 = Setup for the LO WASM build (with Qt) =
 
diff --git a/Repository.mk b/Repository.mk
index 09e873eb3bc7..fbe24f3855bc 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -73,6 +73,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/RepositoryModule_host.mk b/RepositoryModule_host.mk
index dc9725700903..d25f3dd67e22 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -148,6 +148,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	uui \
 	vbahelper \
 	vcl \
+	wasm \
 	winaccessibility \
 	wizards \
 	writerfilter \
diff --git a/configure.ac b/configure.ac
index 06887bfc0678..81ddcc15f43a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12446,6 +12446,7 @@ then
 
     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
+    qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
 
     AC_MSG_CHECKING([for Qt5 headers])
     qt5_incdir="no"
@@ -12481,11 +12482,15 @@ then
         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
     fi
 
+    if test "$_os" = "Emscripten" -a ! -f "${qt5_platformsdir}"/libqwasm.a; then
+        AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir}])
+    fi
+
     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
     if test "$_os" = "Emscripten"; then
-        QT5_LIBS="$QT5_LIBS -lqtpcre2"
+        QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
     fi
 
     if test "$USING_X11" = TRUE; then
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 1c0456c646ec..941081614291 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -17,12 +17,19 @@ include $(GBUILDDIR)/platform/unxgcc.mk
 
 gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
 gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -s SAFE_HEAP=1
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=1 -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
+gb_EMSCRIPTEN_EXCEPT := -s DISABLE_EXCEPTION_CATCHING=0
 
-gb_CFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS)
-gb_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
-gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) --bind
+gb_LinkTarget_CFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS)
+gb_LinkTarget_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS) $(gb_EMSCRIPTEN_EXCEPT)
+
+# WASM is also optimized at link time, but ignores linker flags, so wants $(gb_COMPILEROPTFLAGS)
+gb_LINKEROPTFLAGS :=
+gb_LINKERSTRIPDEBUGFLAGS :=
+gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_LDFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_EXCEPT) $(gb_COMPILEROPTFLAGS)
 
 define gb_Library_get_rpath
 endef
@@ -30,9 +37,4 @@ endef
 define gb_Executable_get_rpath
 endef
 
-gb_LINKEROPTFLAGS :=
-gb_LINKERSTRIPDEBUGFLAGS :=
-
-#gb_CXX_LINKFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-
 # vim: set noet sw=4 ts=4
diff --git a/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk b/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk
new file mode 100644
index 000000000000..52b7447d22e9
--- /dev/null
+++ b/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk
@@ -0,0 +1,37 @@
+# -*- 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,wasm/qt5-mandelbrot))
+
+$(call gb_CustomTarget_get_target,wasm/qt5-mandelbrot) : \
+	$(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/renderthread.moc \
+	$(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/mandelbrotwidget.moc \
+
+qt5_mandelbrot_MOCDEFS_H := $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/moc_predefs.h
+qt5_mandelbrot_MOCDEFS_CXX := $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/moc_dummy.cxx
+qt5_mandelbrot_WORKDIR :=  $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/.dir
+
+$(qt5_mandelbrot_MOCDEFS_CXX): | $(qt5_mandelbrot_WORKDIR)
+	touch $@
+
+$(qt5_mandelbrot_MOCDEFS_H): $(qt5_mandelbrot_MOCDEFS_CXX) | $(qt5_mandelbrot_WORKDIR)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CXX,1)
+	$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CXX)
+	$(CXX) -pipe -O2 -std=gnu++11 -fno-exceptions $(gb_EMSCRIPTEN_CPPFLAGS) -dM -E -o $@ $<
+	$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
+
+$(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/%.moc : \
+		$(SRCDIR)/wasm/source/qt5-mandelbrot/%.h \
+		$(qt5_mandelbrot_MOCDEFS_H) | $(qt5_mandelbrot_WORKDIR)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1)
+	$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),MOC)
+	$(MOC5) --include $(qt5_mandelbrot_MOCDEFS_H) $(gb_EMSCRIPTEN_QTDEFS) $< -o $@
+	$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
+
+# vim: set noet sw=4:
diff --git a/wasm/Executable_wasm-qt5-mandelbrot.mk b/wasm/Executable_wasm-qt5-mandelbrot.mk
new file mode 100644
index 000000000000..7afaa81c0dc4
--- /dev/null
+++ b/wasm/Executable_wasm-qt5-mandelbrot.mk
@@ -0,0 +1,32 @@
+# -*- 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_Executable_Executable,wasm-qt5-mandelbrot))
+
+$(eval $(call gb_Executable_use_custom_headers,wasm-qt5-mandelbrot,wasm/qt5-mandelbrot))
+
+$(eval $(call gb_Executable_use_externals,wasm-qt5-mandelbrot,\
+    graphite \
+    freetype \
+    harfbuzz \
+    libpng \
+    qt5 \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,wasm-qt5-mandelbrot,\
+    wasm/source/qt5-mandelbrot/main \
+    wasm/source/qt5-mandelbrot/mandelbrotwidget \
+    wasm/source/qt5-mandelbrot/renderthread \
+))
+
+$(eval $(call gb_Executable_add_defs,wasm-qt5-mandelbrot,\
+    -DVCL_INTERNALS \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm/Makefile b/wasm/Makefile
new file mode 100644
index 000000000000..0c6f47b1790f
--- /dev/null
+++ b/wasm/Makefile
@@ -0,0 +1,13 @@
+# -*- 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/.
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm/Module_wasm.mk b/wasm/Module_wasm.mk
new file mode 100644
index 000000000000..0ef8c4c6aaf4
--- /dev/null
+++ b/wasm/Module_wasm.mk
@@ -0,0 +1,20 @@
+# -*- 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_Module_Module,wasm))
+
+ifeq ($(OS),EMSCRIPTEN)
+
+$(eval $(call gb_Module_add_targets,wasm,\
+    CustomTarget_wasm-qt5-mandelbrot_moc \
+    Executable_wasm-qt5-mandelbrot \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm/README b/wasm/README
new file mode 100644
index 000000000000..a23bd6a45ea9
--- /dev/null
+++ b/wasm/README
@@ -0,0 +1 @@
+See /README.wasm
diff --git a/wasm/source/qt5-mandelbrot/main.cxx b/wasm/source/qt5-mandelbrot/main.cxx
new file mode 100644
index 000000000000..037c63153cf2
--- /dev/null
+++ b/wasm/source/qt5-mandelbrot/main.cxx
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mandelbrotwidget.h"
+
+#include <QtWidgets/QApplication>
+#include <QtCore/QtPlugin>
+
+Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
+
+int main(int argc, char* argv[])
+{
+    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+    QApplication app(argc, argv);
+    MandelbrotWidget widget;
+    widget.show();
+    return app.exec();
+}
diff --git a/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx b/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx
new file mode 100644
index 000000000000..5886dd2664c0
--- /dev/null
+++ b/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mandelbrotwidget.h"
+#include "mandelbrotwidget.moc"
+
+#include <QtGui/QPainter>
+#include <QtGui/QKeyEvent>
+
+#include <math.h>
+
+const double DefaultCenterX = -0.637011;
+const double DefaultCenterY = -0.0395159;
+const double DefaultScale = 0.00403897;
+
+const double ZoomInFactor = 0.8;
+const double ZoomOutFactor = 1 / ZoomInFactor;
+const int ScrollStep = 20;
+
+MandelbrotWidget::MandelbrotWidget(QWidget* parent)
+    : QWidget(parent)
+    , centerX(DefaultCenterX)
+    , centerY(DefaultCenterY)
+    , pixmapScale(DefaultScale)
+    , curScale(DefaultScale)
+{
+    connect(&thread, &RenderThread::renderedImage, this, &MandelbrotWidget::updatePixmap);
+
+    setWindowTitle(tr("Mandelbrot"));
+#if QT_CONFIG(cursor)
+    setCursor(Qt::CrossCursor);
+#endif
+    resize(550, 400);
+}
+
+void MandelbrotWidget::paintEvent(QPaintEvent* /* event */)
+{
+    QPainter painter(this);
+    painter.fillRect(rect(), Qt::black);
+
+    if (pixmap.isNull())
+    {
+        painter.setPen(Qt::white);
+        painter.drawText(rect(), Qt::AlignCenter, tr("Rendering initial image, please wait..."));
+        return;
+    }
+
+    if (qFuzzyCompare(curScale, pixmapScale))
+    {
+        painter.drawPixmap(pixmapOffset, pixmap);
+    }
+    else
+    {
+        auto previewPixmap = qFuzzyCompare(pixmap.devicePixelRatioF(), qreal(1))
+                                 ? pixmap
+                                 : pixmap.scaled(pixmap.size() / pixmap.devicePixelRatioF(),
+                                                 Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        double scaleFactor = pixmapScale / curScale;
+        int newWidth = int(previewPixmap.width() * scaleFactor);
+        int newHeight = int(previewPixmap.height() * scaleFactor);
+        int newX = pixmapOffset.x() + (previewPixmap.width() - newWidth) / 2;
+        int newY = pixmapOffset.y() + (previewPixmap.height() - newHeight) / 2;
+
+        painter.save();
+        painter.translate(newX, newY);
+        painter.scale(scaleFactor, scaleFactor);
+
+        QRectF exposed = painter.transform().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1);
+        painter.drawPixmap(exposed, previewPixmap, exposed);
+        painter.restore();
+    }
+
+    QString text = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
+                      "Press and hold left mouse button to scroll.");
+    QFontMetrics metrics = painter.fontMetrics();
+    int textWidth = metrics.horizontalAdvance(text);
+
+    painter.setPen(Qt::NoPen);
+    painter.setBrush(QColor(0, 0, 0, 127));
+    painter.drawRect((width() - textWidth) / 2 - 5, 0, textWidth + 10, metrics.lineSpacing() + 5);
+    painter.setPen(Qt::white);
+    painter.drawText((width() - textWidth) / 2, metrics.leading() + metrics.ascent(), text);
+}
+
+void MandelbrotWidget::resizeEvent(QResizeEvent* /* event */)
+{
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
+
+void MandelbrotWidget::keyPressEvent(QKeyEvent* event)
+{
+    switch (event->key())
+    {
+        case Qt::Key_Plus:
+            zoom(ZoomInFactor);
+            break;
+        case Qt::Key_Minus:
+            zoom(ZoomOutFactor);
+            break;
+        case Qt::Key_Left:
+            scroll(-ScrollStep, 0);
+            break;
+        case Qt::Key_Right:
+            scroll(+ScrollStep, 0);
+            break;
+        case Qt::Key_Down:
+            scroll(0, -ScrollStep);
+            break;
+        case Qt::Key_Up:
+            scroll(0, +ScrollStep);
+            break;
+        default:
+            QWidget::keyPressEvent(event);
+    }
+}
+
+#if QT_CONFIG(wheelevent)
+void MandelbrotWidget::wheelEvent(QWheelEvent* event)
+{
+    const int numDegrees = event->angleDelta().y() / 8;
+    const double numSteps = numDegrees / double(15);
+    zoom(pow(ZoomInFactor, numSteps));
+}
+#endif
+
+void MandelbrotWidget::mousePressEvent(QMouseEvent* event)
+{
+    if (event->button() == Qt::LeftButton)
+        lastDragPos = event->pos();
+}
+
+void MandelbrotWidget::mouseMoveEvent(QMouseEvent* event)
+{
+    if (event->buttons() & Qt::LeftButton)
+    {
+        pixmapOffset += event->pos() - lastDragPos;
+        lastDragPos = event->pos();
+        update();
+    }
+}
+
+void MandelbrotWidget::mouseReleaseEvent(QMouseEvent* event)
+{
+    if (event->button() == Qt::LeftButton)
+    {
+        pixmapOffset += event->pos() - lastDragPos;
+        lastDragPos = QPoint();
+
+        const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatioF();
+        int deltaX = (width() - pixmapSize.width()) / 2 - pixmapOffset.x();
+        int deltaY = (height() - pixmapSize.height()) / 2 - pixmapOffset.y();
+        scroll(deltaX, deltaY);
+    }
+}
+
+void MandelbrotWidget::updatePixmap(const QImage& image, double scaleFactor)
+{
+    if (!lastDragPos.isNull())
+        return;
+
+    pixmap = QPixmap::fromImage(image);
+    pixmapOffset = QPoint();
+    lastDragPos = QPoint();
+    pixmapScale = scaleFactor;
+    update();
+}
+
+void MandelbrotWidget::zoom(double zoomFactor)
+{
+    curScale *= zoomFactor;
+    update();
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
+
+void MandelbrotWidget::scroll(int deltaX, int deltaY)
+{
+    centerX += deltaX * curScale;
+    centerY += deltaY * curScale;
+    update();
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
diff --git a/wasm/source/qt5-mandelbrot/mandelbrotwidget.h b/wasm/source/qt5-mandelbrot/mandelbrotwidget.h
new file mode 100644
index 000000000000..72e95568b522
--- /dev/null
+++ b/wasm/source/qt5-mandelbrot/mandelbrotwidget.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtGui/QPixmap>
+#include <QtWidgets/QWidget>
+
+#include "renderthread.h"
+
+class MandelbrotWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    MandelbrotWidget(QWidget* parent = nullptr);
+
+protected:
+    void paintEvent(QPaintEvent* event) override;
+    void resizeEvent(QResizeEvent* event) override;
+    void keyPressEvent(QKeyEvent* event) override;
+#if QT_CONFIG(wheelevent)
+    void wheelEvent(QWheelEvent* event) override;
+#endif
+    void mousePressEvent(QMouseEvent* event) override;
+    void mouseMoveEvent(QMouseEvent* event) override;
+    void mouseReleaseEvent(QMouseEvent* event) override;
+
+private slots:
+    void updatePixmap(const QImage& image, double scaleFactor);
+    void zoom(double zoomFactor);
+
+private:
+    void scroll(int deltaX, int deltaY);
+
+    RenderThread thread;
+    QPixmap pixmap;
+    QPoint pixmapOffset;
+    QPoint lastDragPos;
+    double centerX;
+    double centerY;
+    double pixmapScale;
+    double curScale;
+};
diff --git a/wasm/source/qt5-mandelbrot/renderthread.cxx b/wasm/source/qt5-mandelbrot/renderthread.cxx
new file mode 100644
index 000000000000..398e43ded15d
--- /dev/null
+++ b/wasm/source/qt5-mandelbrot/renderthread.cxx
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "renderthread.h"
+#include "renderthread.moc"
+
+#include <QtGui/QImage>
+#include <cmath>
+
+RenderThread::RenderThread(QObject* parent)
+    : QThread(parent)
+{
+    for (int i = 0; i < ColormapSize; ++i)
+        m_colormap[i] = rgbFromWaveLength(380.0 + (i * 400.0 / ColormapSize));
+}
+
+RenderThread::~RenderThread()
+{
+    m_mutex.lock();
+    m_abort = true;
+    m_condition.wakeOne();
+    m_mutex.unlock();
+
+    wait();
+}
+
+void RenderThread::render(double centerX, double centerY, double scaleFactor, QSize resultSize,
+                          double devicePixelRatio)
+{
+    QMutexLocker locker(&m_mutex);
+
+    m_centerX = centerX;
+    m_centerY = centerY;
+    m_scaleFactor = scaleFactor;
+    m_devicePixelRatio = devicePixelRatio;
+    m_resultSize = resultSize;
+
+    if (!isRunning())
+    {
+        start(LowPriority);
+    }
+    else
+    {
+        m_restart = true;
+        m_condition.wakeOne();
+    }
+}
+
+void RenderThread::run()
+{
+    forever
+    {
+        m_mutex.lock();
+        const double devicePixelRatio = m_devicePixelRatio;
+        const QSize resultSize = m_resultSize * devicePixelRatio;
+        const double requestedScaleFactor = m_scaleFactor;
+        const double scaleFactor = requestedScaleFactor / devicePixelRatio;
+        const double centerX = m_centerX;
+        const double centerY = m_centerY;
+        m_mutex.unlock();
+
+        int halfWidth = resultSize.width() / 2;
+        int halfHeight = resultSize.height() / 2;
+        QImage image(resultSize, QImage::Format_RGB32);
+        image.setDevicePixelRatio(devicePixelRatio);
+
+        const int NumPasses = 8;
+        int pass = 0;
+        while (pass < NumPasses)
+        {
+            const int MaxIterations = (1 << (2 * pass + 6)) + 32;
+            const int Limit = 4;
+            bool allBlack = true;
+
+            for (int y = -halfHeight; y < halfHeight; ++y)
+            {
+                if (m_restart)
+                    break;
+                if (m_abort)
+                    return;
+
+                auto scanLine = reinterpret_cast<uint*>(image.scanLine(y + halfHeight));
+                const double ay = centerY + (y * scaleFactor);
+
+                for (int x = -halfWidth; x < halfWidth; ++x)
+                {
+                    const double ax = centerX + (x * scaleFactor);
+                    double a1 = ax;
+                    double b1 = ay;
+                    int numIterations = 0;
+
+                    do
+                    {
+                        ++numIterations;
+                        const double a2 = (a1 * a1) - (b1 * b1) + ax;
+                        const double b2 = (2 * a1 * b1) + ay;
+                        if ((a2 * a2) + (b2 * b2) > Limit)
+                            break;
+
+                        ++numIterations;
+                        a1 = (a2 * a2) - (b2 * b2) + ax;
+                        b1 = (2 * a2 * b2) + ay;
+                        if ((a1 * a1) + (b1 * b1) > Limit)
+                            break;
+                    } while (numIterations < MaxIterations);
+
+                    if (numIterations < MaxIterations)
+                    {
+                        *scanLine++ = m_colormap[numIterations % ColormapSize];
+                        allBlack = false;
+                    }
+                    else
+                    {
+                        *scanLine++ = qRgb(0, 0, 0);
+                    }
+                }
+            }
+
+            if (allBlack && pass == 0)
+            {
+                pass = 4;
+            }
+            else
+            {
+                if (!m_restart)
+                    emit renderedImage(image, requestedScaleFactor);
+                ++pass;
+            }
+        }
+
+        m_mutex.lock();
+        if (!m_restart)
+            m_condition.wait(&m_mutex);
+        m_restart = false;
+        m_mutex.unlock();
+    }
+}
+
+uint RenderThread::rgbFromWaveLength(double wave)
+{
+    double r = 0;
+    double g = 0;
+    double b = 0;
+
+    if (wave >= 380.0 && wave <= 440.0)
+    {
+        r = -1.0 * (wave - 440.0) / (440.0 - 380.0);
+        b = 1.0;
+    }
+    else if (wave >= 440.0 && wave <= 490.0)
+    {
+        g = (wave - 440.0) / (490.0 - 440.0);
+        b = 1.0;
+    }
+    else if (wave >= 490.0 && wave <= 510.0)
+    {
+        g = 1.0;
+        b = -1.0 * (wave - 510.0) / (510.0 - 490.0);
+    }
+    else if (wave >= 510.0 && wave <= 580.0)
+    {
+        r = (wave - 510.0) / (580.0 - 510.0);
+        g = 1.0;
+    }
+    else if (wave >= 580.0 && wave <= 645.0)
+    {
+        r = 1.0;
+        g = -1.0 * (wave - 645.0) / (645.0 - 580.0);
+    }
+    else if (wave >= 645.0 && wave <= 780.0)
+    {
+        r = 1.0;
+    }
+
+    double s = 1.0;
+    if (wave > 700.0)
+        s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0);
+    else if (wave < 420.0)
+        s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0);
+
+    r = std::pow(r * s, 0.8);
+    g = std::pow(g * s, 0.8);
+    b = std::pow(b * s, 0.8);
+    return qRgb(int(r * 255), int(g * 255), int(b * 255));
+}
diff --git a/wasm/source/qt5-mandelbrot/renderthread.h b/wasm/source/qt5-mandelbrot/renderthread.h
new file mode 100644
index 000000000000..16c0d86fd46c
--- /dev/null
+++ b/wasm/source/qt5-mandelbrot/renderthread.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtCore/QMutex>
+#include <QtCore/QSize>
+#include <QtCore/QThread>
+#include <QtCore/QWaitCondition>
+
+QT_BEGIN_NAMESPACE
+class QImage;
+QT_END_NAMESPACE
+
+class RenderThread : public QThread
+{
+    Q_OBJECT
+
+public:
+    RenderThread(QObject* parent = nullptr);
+    ~RenderThread();
+
+    void render(double centerX, double centerY, double scaleFactor, QSize resultSize,
+                double devicePixelRatio);
+
+signals:
+    void renderedImage(const QImage& image, double scaleFactor);
+
+protected:
+    void run() override;
+
+private:
+    static uint rgbFromWaveLength(double wave);
+
+    QMutex m_mutex;
+    QWaitCondition m_condition;
+    double m_centerX;
+    double m_centerY;
+    double m_scaleFactor;
+    double m_devicePixelRatio;
+    QSize m_resultSize;
+    bool m_restart = false;
+    bool m_abort = false;
+
+    enum
+    {
+        ColormapSize = 512
+    };
+    uint m_colormap[ColormapSize];
+};
commit c0160e7ccea796a13a698b01128063864068988a
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 22 12:47:03 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:48 2020 +0100

    Refer from README.md to README.wasm
    
    Change-Id: I1e5fcc64f452d524192f4ea6d975aafafbb9f5bb

diff --git a/README.md b/README.md
index 4ed3b80b2fec..727bcef4f665 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,10 @@ run and compile LibreOffice, also used by the TDF builds:
     * Build: Xcode 9.3 and iPhone SDK 11.4
 * Android:
     * Build: NDK r19c and SDK 22.6.2
+* Emscripten / WASM:
+    * Runtime: a browser with SharedMemory support (threads + atomics)
+    * Build: Qt 5.15 with Qt supported Emscripten 1.39.8
+    * See README.wasm
 
 If you want to use Clang with the LibreOffice compiler plugins, the minimal
 version of Clang is 5.0.2. Since Xcode doesn't provide the compiler plugin
diff --git a/README.wasm b/README.wasm
index 596aeb137d12..012d8c981539 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,8 +1,7 @@
 = Status =
 
 $ make
-
-> instdir/program/ui-previewer.html
+$ emrun --serve_after_close instdir/program/ui-previewer.html
 
 The ui-previewer "binary" will "crash" with memory alignment problems.
 
commit 98e723b634141196f355799e1d81947728c3351b
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 22 10:58:27 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 31 00:56:48 2020 +0100

    Make builds without patching emscripten
    
    Ok - the last patch for emscripten was broken too. This is almost
    a "brown paperbag" bug for me now ;-(
    
    With this commit, no more patching for emscripten should be needed.
    
    There is a workaround in sc/source/core/data/attarray.cxx, which looks
    like a compiler bug (see README.wasm).
    
    Change-Id: Ife4d9089177bc31463a7636674411a2cf0e64d87

diff --git a/README.wasm b/README.wasm
index f7b71fe33db4..596aeb137d12 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,23 +1,21 @@
 = Status =
 
-$ make cross-toolset
-$ make vcl.all
+$ make
 
 > instdir/program/ui-previewer.html
 
-Plain make vcl.all may still have dependency problems. But a general
-make currently fails with a template problem in sc. The ui-previewer
-"binary" will "crash" with memory alignment problems.
+The ui-previewer "binary" will "crash" with memory alignment problems.
 
 
 = 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 zo a newer emscripten.
+change later to a newer emscripten.
 
 Qt WASM is not yet used with LO, just if you're wondering!
 
+
 == Setup emscripten ==
 
 https://emscripten.org/docs/getting_started/index.html
@@ -31,19 +29,6 @@ Example bashrc scriptlet:
 EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
 [ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
 
-Before cleaning up all configure calls, I patched git_emsdk/upstream/emscripten/emcc.py for cpp:
-
-+++ git_emsdk/upstream/emscripten/emcc.py
-@@ -707,7 +707,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
- 
-   # If this is a configure-type thing, do not compile to JavaScript, instead use clang
-   # to compile to a native binary (using our headers, so things make sense later)
--  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or 'conftest.c' in args) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
-+  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or ('conftest.' + ext in args for ext in ['c', 'cpp'])) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
-   CMAKE_CONFIG = 'CMakeFiles/cmTryCompileExec.dir' in ' '.join(args)# or 'CMakeCCompilerId' in ' '.join(args)
-   if CONFIGURE_CONFIG or CMAKE_CONFIG:
-     # XXX use this to debug configure stuff. ./configure's generally hide our
-
 
 == Setup Qt ==
 
@@ -140,6 +125,24 @@ hours. Maybe I'll open an Emscripten issue, if we really have to implement
 this.
 
 
+= Workaround for eventual clang WASM compiler bug =
+
+sc/source/core/data/attarray.cxx:378:44: error: call to member function 'erase' is ambiguous
+                        aNewCondFormatData.erase(nIndex);
+                        ~~~~~~~~~~~~~~~~~~~^~~~~
+include/o3tl/sorted_vector.hxx:86:15: note: candidate function
+    size_type erase( const Value& x )
+              ^
+include/o3tl/sorted_vector.hxx:97:10: note: candidate function
+    void erase( size_t index )
+
+This is currently patched by using x.erase(x.begin() + nIndex).
+
+There shouldn't be an ambiguity, because of "[WebAssembly] Change size_t to `unsigned long`."
+(https://reviews.llvm.org/rGdf07a35912d78781ed6a62a7c032bfef5085a4f5#change-IrS9f6jH6PFq),
+from "Jul 23 2018" which pre-dates the emscripten tag 1.39.8 from 02/14/2020 by ~1.5y.
+
+
 = Tools for problem diagnosis =
 
 * nm -s should list the symbols in the archive, based on the index generated by ranlib.
diff --git a/autogen.sh b/autogen.sh
index 54cc7e6262c8..bef1f7faf561 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -295,15 +295,21 @@ if (defined $ENV{NOCONFIGURE}) {
     push @args, "--srcdir=$src_path";
     push @args, "--enable-option-checking=$option_checking";
 
-    print "Running ./configure with '" . join (" ", @args), "'\n";
-
     # When running a shell script from Perl on WSL, weirdly named
     # environment variables like the "ProgramFiles(x86)" one don't get
     # imported by the shell. So export it as PROGRAMFILESX86 instead.
     my $building_for_linux = 0;
+    my $building_with_emscripten = 0;
     foreach my $arg (@args) {
         $building_for_linux = 1 if ($arg =~ /--host=x86_64.*linux/);
+        $building_with_emscripten = 1 if ($arg =~ /^--host=wasm.*-emscripten$/);
     }
+
+    unshift @args, "./configure";
+    unshift @args, "emconfigure" if ($building_with_emscripten);
+
+    print "Running '" . join (" ", @args), "'\n";
+
     if (`wslsys 2>/dev/null` ne "" && !$building_for_linux) {
         if (!$ENV{"ProgramFiles(x86)"}) {
             print STDERR "To build for Windows on WSL, you need to set the WSLENV environment variable in the Control Panel to 'ProgramFiles(x86)'\n";
@@ -313,7 +319,7 @@ if (defined $ENV{NOCONFIGURE}) {
         $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
     }
 
-    system ("emconfigure", "./configure", @args) && die "Error running configure";
+    system (@args) && die "Error running configure";
 }
 
 # Local Variables:
diff --git a/configure.ac b/configure.ac
index 693ef9fa6241..06887bfc0678 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1109,7 +1109,7 @@ haiku*)
     _os=Haiku
     ;;
 
-emscripten*)
+emscripten)
     build_gstreamer_1_0=no
     enable_lpsolve=no
     enable_report_builder=no
@@ -1282,10 +1282,24 @@ if test $_os != "WINNT"; then
 fi
 AC_SUBST(DLOPEN_LIBS)
 
-AC_ARG_ENABLE(ios-simulator,
-    AS_HELP_STRING([--enable-ios-simulator],
-        [build for iOS simulator])
-)
+dnl ===================================================================
+dnl Sanity checks for Emscripten SDK setup
+dnl ===================================================================
+
+if test "$_os" = "Emscripten"; then
+    EMSCRIPTEN_ERROR=0
+    if ! which emconfigure >/dev/null 2>&1; then
+        AC_MSG_WARN([emconfigure must be in your \$PATH])
+        EMSCRIPTEN_ERROR=1
+    fi
+    if test -z "$EMMAKEN_JUST_CONFIGURE"; then
+	AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
+        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
 
 ###############################################################################
 # Extensions switches --enable/--disable
@@ -1300,6 +1314,11 @@ AC_ARG_ENABLE(ios-simulator,
 # if you use --disable-extension-integration. Is that really the
 # case?
 
+AC_ARG_ENABLE(ios-simulator,
+    AS_HELP_STRING([--enable-ios-simulator],
+        [build for iOS simulator])
+)
+
 libo_FUZZ_ARG_ENABLE(extension-integration,
     AS_HELP_STRING([--disable-extension-integration],
         [Disable integration of the built extensions in the installer of the
@@ -2614,6 +2633,8 @@ AC_ARG_WITH(onedrive-client-secret,
         authentication on OneDrive. If either this or
         --with-onedrive-client-id is empty, the feature will be disabled]),
 )
+
+
 dnl ===================================================================
 dnl Do we want to use pre-build binary tarball for recompile
 dnl ===================================================================
diff --git a/external/apr/ExternalProject_apr.mk b/external/apr/ExternalProject_apr.mk
index 1c94480e5ab7..7f3a631e933e 100644
--- a/external/apr/ExternalProject_apr.mk
+++ b/external/apr/ExternalProject_apr.mk
@@ -30,7 +30,7 @@ $(call gb_ExternalProject_get_state_target,apr,build):
 	$(call gb_Trace_StartRange,apr,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
 		 $(if $(ENABLE_MACOSX_SANDBOX),ac_cv_func_fdatasync=no) \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--enable-static --disable-shared \
 			--with-pic \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
diff --git a/external/apr/ExternalProject_apr_util.mk b/external/apr/ExternalProject_apr_util.mk
index a311f32e8e01..a94b0e38d43b 100644
--- a/external/apr/ExternalProject_apr_util.mk
+++ b/external/apr/ExternalProject_apr_util.mk
@@ -31,7 +31,7 @@ else
 $(call gb_ExternalProject_get_state_target,apr_util,build):
 	$(call gb_Trace_StartRange,apr_util,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--enable-static --disable-shared \
 			--with-pic \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
diff --git a/external/breakpad/ExternalProject_breakpad.mk b/external/breakpad/ExternalProject_breakpad.mk
index 9e7e72485849..56a7be987837 100644
--- a/external/breakpad/ExternalProject_breakpad.mk
+++ b/external/breakpad/ExternalProject_breakpad.mk
@@ -21,7 +21,7 @@ else # !ifeq($(COM),MSC)
 $(call gb_ExternalProject_get_state_target,breakpad,build) :
 	$(call gb_Trace_StartRange,breakpad,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \
+		$(gb_RUN_CONFIGURE) ./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \
 		&& $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,breakpad,EXTERNAL)
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 59232c9d16be..1f9b2982c6d5 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -65,10 +65,10 @@ else
 $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_Trace_StartRange,cairo,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	./configure \
+	$(gb_RUN_CONFIGURE) ./configure \
 		$(if $(debug),STRIP=" ") \
 		$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="" EMMAKEN_JUST_CONFIGURE=1) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="") \
 		$(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
 		$(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
 		LIBS="$(ZLIB_LIBS)" \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index 00b61170ff77..03dffbd01312 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -34,7 +34,7 @@ else
 $(call gb_ExternalProject_get_state_target,pixman,build) :
 	$(call gb_Trace_StartRange,pixman,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
 		$(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
diff --git a/external/coinmp/ExternalProject_coinmp.mk b/external/coinmp/ExternalProject_coinmp.mk
index e1484e656619..9bd5a4cd2685 100644
--- a/external/coinmp/ExternalProject_coinmp.mk
+++ b/external/coinmp/ExternalProject_coinmp.mk
@@ -29,7 +29,7 @@ else
 $(call gb_ExternalProject_get_state_target,coinmp,build) :
 	$(call gb_Trace_StartRange,coinmp,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
-		./configure COIN_SKIP_PROJECTS="Data/Sample" \
+		$(gb_RUN_CONFIGURE) ./configure COIN_SKIP_PROJECTS="Data/Sample" \
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(DISABLE_DYNLOADING),--disable-shared) \
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
index 1c5ac725af59..63116af294d1 100644
--- a/external/cppunit/ExternalProject_cppunit.mk
+++ b/external/cppunit/ExternalProject_cppunit.mk
@@ -43,7 +43,7 @@ endif
 $(call gb_ExternalProject_get_state_target,cppunit,build) :
 	$(call gb_Trace_StartRange,cppunit,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-dependency-tracking \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
 			--disable-doxygen \
diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk
index 138b50afd0e0..11d1fcc57d4a 100644
--- a/external/curl/ExternalProject_curl.mk
+++ b/external/curl/ExternalProject_curl.mk
@@ -40,7 +40,7 @@ endif
 $(call gb_ExternalProject_get_state_target,curl,build):
 	$(call gb_Trace_StartRange,curl,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			$(if $(filter iOS MACOSX,$(OS)),\
 				--with-darwinssl,\
 				$(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \
diff --git a/external/epm/ExternalProject_epm.mk b/external/epm/ExternalProject_epm.mk
index 68a61a78a744..7b0dde219e4b 100644
--- a/external/epm/ExternalProject_epm.mk
+++ b/external/epm/ExternalProject_epm.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,epm,\
 $(call gb_ExternalProject_get_state_target,epm,build) :
 	$(call gb_Trace_StartRange,epm,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-fltk \
+		$(gb_RUN_CONFIGURE) ./configure --disable-fltk \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \
 		&& $(MAKE) \
 		&& touch $@ \
diff --git a/external/expat/ExternalProject_expat.mk b/external/expat/ExternalProject_expat.mk
index 4f4f0301c1bc..b69e6544f55f 100644
--- a/external/expat/ExternalProject_expat.mk
+++ b/external/expat/ExternalProject_expat.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,expat,\
 $(call gb_ExternalProject_get_state_target,expat,configure) :
 	$(call gb_Trace_StartRange,expat,EXTERNAL)
 	$(call gb_ExternalProject_run,configure,\
-		./configure --without-docbook \
+		$(gb_RUN_CONFIGURE) ./configure --without-docbook \

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list