[Libreoffice-commits] core.git: Branch 'feature/wasm' - 104 commits - accessibility/Library_acc.mk accessibility/source autogen.sh avmedia/source basctl/qa basctl/source basic/qa basic/source bin/find-can-be-private-symbols.classes.results bridges/Module_bridges.mk bridges/source canvas/Module_canvas.mk chart2/qa chart2/source compilerplugins/clang config_host.mk.in configure.ac connectivity/source cppu/source cpputools/Module_cpputools.mk cui/qa cui/source dbaccess/qa dbaccess/source desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/qa desktop/source desktop/test editeng/inc editeng/source embeddedobj/source embedserv/source emfio/source extensions/Module_extensions.mk extensions/source extensions/uiconfig external/boost external/cairo external/fontconfig external/icu external/liblangtag external/libxml2 external/neon external/openssl external/poppler external/postgresql external/python3 external/xmlsec filter/qa filter/source formula/qa fpicker/qa framework/source .gitignore helpc ontent2 icon-themes/colibre icon-themes/elementary icon-themes/elementary_svg idlc/inc idlc/source idl/inc idl/source include/editeng include/osl include/rtl include/sal include/sfx2 include/svl include/svx include/tools include/vcl include/xmloff lotuswordpro/inc lotuswordpro/source officecfg/registry pyuno/source README.wasm reportdesign/qa reportdesign/source RepositoryExternal.mk Repository.mk sal/osl sal/qa sal/rtl sax/qa sax/source sc/inc sc/qa scripting/Module_scripting.mk sc/source sc/uiconfig sdext/source sd/inc sd/qa sd/source sfx2/qa sfx2/source sfx2/uiconfig shell/Module_shell.mk solenv/bin solenv/clang-format solenv/gbuild sot/source starmath/qa stoc/source svl/Library_svl.mk svl/source svtools/qa svtools/source svx/Module_svx.mk svx/qa svx/source svx/uiconfig sw/CppunitTest_sw_uiwriter2.mk sw/CppunitTest_sw_uiwriter3.mk sw/CppunitTest_sw_uiwriter.mk sw/inc sw/Module_sw.mk sw/qa sw/source sw/uiconfig tools/qa tools/source unoidl/Executable_unoidl-read.mk unotest/source uui/qa vcl/CustomTarget_wasm_native.mk vcl/Executable_ui-previewer.mk vcl/inc vcl/jsdialog vcl/Library_vcl.mk vcl/Library_vclplug_qt5.mk vcl/Module_vcl.mk vcl/qa vcl/qt5 vcl/source vcl/unx vcl/wasm wizards/source writerfilter/source writerperfect/qa writerperfect/source xmloff/inc xmloff/source xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/qa xmlsecurity/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 21 01:37:17 UTC 2020


Rebased ref, commits from common ancestor:
commit 8c1198895dec678284fb7c61d17a0b3d76fe86cd
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Dec 21 02:01:35 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Mon Dec 21 02:34:46 2020 +0100

    The OpenSSL catchall
    
    I've read somewhere in the docs, that ccache usage is fine with
    Emscripten. This now builds the non-DESKTOP build, but activates
    some binaries, like the ui-previewer. I'm not sure yet, if I should
    build with or without DESKTOP.
    
    After enabling of exceptions, the ui-previewer now fails to link
    with "undefined symbol: typeinfo for SvStreamEOFException". And I
    found "make vcl.all" doesn't rebuild anything non-vcl, which I had
    assumed.
    
    Then this "toggles" DISABLE_OPENSSL to ENABLE_OPENSSL, like all the
    other feature flags. And it builds xmlsec with openssl, but there
    isn't yet an openssl xmlsecurity backend.
    
    Change-Id: Ibcc944f27f2ce53bc24e6605669b6593fd5e93c3

diff --git a/.gitignore b/.gitignore
index c37494bd71ce..8b5250e20d06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -179,3 +179,8 @@ LibreOffice.VC.VC.opendb
 
 # vim-ide-integration
 /compile_commands.json
+
+# Some emscripten configure artifacts
+/a.out
+/a.out.js
+/a.out.wasm
diff --git a/README.wasm b/README.wasm
index 46c84a1a1a4e..b1c3c8d1797a 100644
--- a/README.wasm
+++ b/README.wasm
@@ -39,10 +39,12 @@ make -j<CORES> module-qtbase module-qtdeclarative
 
 Building with examples will break with some of them, but at that point Qt already works.
 
-If you get a configure failure for Qt:
+I used to get a configure failure for Qt:
 
 Checking for target architecture... Project ERROR: target architecture detection binary not found.
 
+Originally I tried two patches to "fix" these:
+
 Edit git_emsdk/upstream/emscripten/emcc.py:
 @@ -760,8 +760,8 @@
      only_object = '-c' in cmd
@@ -56,11 +58,13 @@ Edit git_emsdk/upstream/emscripten/emcc.py:
          break
      if not target:
 
-The previous suggestion, which was to edit qtbase/config.tests/arch/write_info.pri
+qtbase/config.tests/arch/write_info.pri:
 -     ext = .wasm
 +     ext = .js.wasm
 
-produces errors when loading the generated html, because it can't find the wasm now.
+Both break the build in different ways.
+
+What seems to have fixed it instead 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
@@ -80,7 +84,6 @@ configure (a.out).
 QT5DIR=/dir/of/git_qt5/qtbase
 
 --host=wasm64-local-emscripten
---disable-ccache
 --disable-coinmp
 --disable-cups
 --disable-dbus
diff --git a/Repository.mk b/Repository.mk
index c3872fa9369d..29538c57469b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -1126,7 +1126,7 @@ $(eval $(call gb_Helper_register_mos,\
 	vcl \
 	wiz \
 	wpt \
-	$(if $(ENABLE_NSS),xsc) \
+	$(if $(ENABLE_NSS)$(ENABLE_OPENSSL),xsc) \
 ))
 
 # UI configuration
@@ -1173,7 +1173,7 @@ $(eval $(call gb_Helper_register_uiconfigs,\
 	uui \
 	vcl \
 	writerperfect \
-	$(if $(ENABLE_NSS),xmlsec) \
+	$(if $(ENABLE_NSS)$(ENABLE_OPENSSL),xmlsec) \
 ))
 
 ifeq ($(gb_GBUILDSELFTEST),t)
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 99dfcea22b40..050b56d83cf7 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1546,13 +1546,13 @@ endef
 
 endif # SYSTEM_HARFBUZZ
 
-ifeq ($(DISABLE_OPENSSL),TRUE)
+ifneq ($(ENABLE_OPENSSL),TRUE)
 
 gb_ExternalProject__use_openssl:=
 gb_LinkTarget__use_openssl_headers:=
 gb_LinkTarget__use_openssl:=
 
-else # !DISABLE_OPENSSL
+else # ENABLE_OPENSSL
 
 ifneq ($(SYSTEM_OPENSSL),)
 
@@ -1613,10 +1613,10 @@ endif
 endef
 
 endif # SYSTEM_OPENSSL
-endif # DISABLE_OPENSSL
+endif # ENABLE_OPENSSL
 
 
-ifeq ($(DISABLE_OPENSSL),TRUE)
+ifneq ($(ENABLE_OPENSSL),TRUE)
 
 define gb_LinkTarget__use_gnutls
 $(call gb_LinkTarget_set_include,$(1),\
@@ -1642,12 +1642,12 @@ $(call gb_LinkTarget_add_libs,$(1),$(LIBGCRYPT_LIBS))
 
 endef
 
-else # !DISABLE_OPENSSL
+else # ENABLE_OPENSSL
 
 gb_LinkTarget__use_gnutls:=
 gb_LinkTarget__use_libgcrypt:=
 
-endif # DISABLE_OPENSSL
+endif # ENABLE_OPENSSL
 
 
 ifneq ($(SYSTEM_CDR),)
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index f1249d47f99c..9c519da8c39a 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 #include <config_feature_desktop.h>
 
 #include <toolkit/awt/vclxwindows.hxx>
@@ -381,6 +382,7 @@ Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTa
 #if HAVE_FEATURE_SCRIPTING
     return new AccessibleTabBar( &_rTabBar );
 #else
+    (void)_rTabBar;
     return nullptr;
 #endif
 }
diff --git a/canvas/Module_canvas.mk b/canvas/Module_canvas.mk
index f62d7ef46299..d1645c804ff3 100644
--- a/canvas/Module_canvas.mk
+++ b/canvas/Module_canvas.mk
@@ -24,8 +24,8 @@ $(eval $(call gb_Module_add_targets,canvas,\
 	Library_canvastools \
 	Library_simplecanvas \
 	Library_vclcanvas \
-	$(if $(filter DESKTOP,$(BUILD_TYPE)), \
-		$(if $(DISABLE_GUI),,Executable_canvasdemo)) \
+	$(if $(and $(filter DESKTOP,$(BUILD_TYPE)),$(call gb_not,$(filter $(OS),EMSCRIPTEN)),\
+		$(call gb_not,$(DISABLE_GUI))),Executable_canvasdemo) \
 ))
 
 ifeq ($(ENABLE_CAIRO_CANVAS),TRUE)
diff --git a/config_host.mk.in b/config_host.mk.in
index 8afb776a9c32..05103d90c31b 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -123,7 +123,6 @@ export DEFAULT_BRAND_IMAGES=@DEFAULT_BRAND_IMAGES@
 export DICT_SYSTEM_DIR=@DICT_SYSTEM_DIR@
 export DISABLE_CVE_TESTS=@DISABLE_CVE_TESTS@
 export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@
-export DISABLE_OPENSSL=@DISABLE_OPENSSL@
 export DISABLE_PYTHON=@DISABLE_PYTHON@
 export DLOPEN_LIBS=@DLOPEN_LIBS@
 export DLLTOOL=@DLLTOOL@
@@ -180,6 +179,7 @@ export ENABLE_EXTENSION_UPDATE=@ENABLE_EXTENSION_UPDATE@
 export ENABLE_OOENV=@ENABLE_OOENV@
 export ENABLE_OPENGL_TRANSITIONS=@ENABLE_OPENGL_TRANSITIONS@
 export ENABLE_OPENGL_CANVAS=@ENABLE_OPENGL_CANVAS@
+export ENABLE_OPENSSL=@ENABLE_OPENSSL@
 export ENABLE_OPTIMIZED=@ENABLE_OPTIMIZED@
 export ENABLE_OPTIMIZED_DEBUG=@ENABLE_OPTIMIZED_DEBUG@
 export ENABLE_PCH=@ENABLE_PCH@
diff --git a/configure.ac b/configure.ac
index 53b038dfde91..b2277808bbf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1072,7 +1072,6 @@ linux-android*)
     build_gstreamer_1_0=no
     enable_lotuswordpro=no
     enable_mpl_subset=yes
-    enable_coinmp=yes
     enable_lpsolve=no
     enable_mariadb_sdbc=no
     enable_report_builder=no
@@ -1113,7 +1112,6 @@ haiku*)
 
 emscripten*)
     build_gstreamer_1_0=no
-    enable_coinmp=yes
     enable_lpsolve=no
     enable_report_builder=no
     with_theme="breeze"
@@ -2863,7 +2861,7 @@ dnl "desktop" one but a "mobile" one, we are always cross-compiling.
 dnl Note the direction of the implication; there is no assumption that
 dnl cross-compiling would imply a non-desktop OS.
 
-if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
+if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
     BUILD_TYPE="$BUILD_TYPE DESKTOP"
     AC_DEFINE(HAVE_FEATURE_DESKTOP)
     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
@@ -10659,10 +10657,11 @@ fi
 dnl ===================================================================
 dnl Check for system openssl
 dnl ===================================================================
-DISABLE_OPENSSL=
+ENABLE_OPENSSL=
 AC_MSG_CHECKING([whether to disable OpenSSL usage])
 if test "$enable_openssl" = "yes"; then
     AC_MSG_RESULT([no])
+    ENABLE_OPENSSL=TRUE
     if test "$_os" = Darwin ; then
         # OpenSSL is deprecated when building for 10.7 or later.
         #
@@ -10690,16 +10689,15 @@ if test "$enable_openssl" = "yes"; then
     fi
 else
     AC_MSG_RESULT([yes])
-    DISABLE_OPENSSL=TRUE
 
     # warn that although OpenSSL is disabled, system libraries may depend on it
     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
 fi
 
-AC_SUBST([DISABLE_OPENSSL])
+AC_SUBST([ENABLE_OPENSSL])
 
-if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
+if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
         enable_cipher_openssl_backend=no
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx
index ae89531763a1..782e129cd97a 100644
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ b/connectivity/source/drivers/odbc/OFunctions.cxx
@@ -112,6 +112,8 @@ bool LoadLibrary_ODBC3(OUString &_rPath)
 
     if ( !pODBCso )
         pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+#else
+    (void)_rPath;
 #endif
     if( !pODBCso)
         return false;
diff --git a/cpputools/Module_cpputools.mk b/cpputools/Module_cpputools.mk
index 5807e3c81f6f..de043ea9bf45 100644
--- a/cpputools/Module_cpputools.mk
+++ b/cpputools/Module_cpputools.mk
@@ -10,15 +10,14 @@
 $(eval $(call gb_Module_Module,cpputools))
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
+ifneq ($(OS),EMSCRIPTEN)
 
 $(eval $(call gb_Module_add_targets,cpputools,\
     Executable_sp2bv \
-))
-
-$(eval $(call gb_Module_add_targets,cpputools,\
     Executable_uno \
 ))
 
+endif
 endif
 
 # vim:set noet sw=4 ts=4:
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 33deef07a69a..fd4dc5ccaa33 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -30,8 +30,8 @@ $(eval $(call gb_Library_use_externals,sofficeapp, \
     icu_headers \
     icui18n \
     icuuc \
-    $(if $(filter-out iOS,$(OS)), \
-    curl \
+    $(if $(filter-out EMSCRIPTEN iOS,$(OS)), \
+        curl \
     )\
     $(if $(ENABLE_ONLINE_UPDATE_MAR),\
         orcus-parser \
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index 1c8bdb5691b3..31bbf9d3a472 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -106,6 +106,8 @@ else ifeq ($(OS),iOS)
 
 else ifeq ($(OS),HAIKU)
 
+else ifeq ($(OS),EMSCRIPTEN)
+
 else
 
 $(eval $(call gb_Module_add_targets,desktop,\
diff --git a/external/neon/Library_neon.mk b/external/neon/Library_neon.mk
index 4c034a3178fb..4a0e069b39fa 100644
--- a/external/neon/Library_neon.mk
+++ b/external/neon/Library_neon.mk
@@ -49,7 +49,7 @@ $(eval $(call gb_Library_add_generated_cobjects,neon,\
 ))
 
 
-ifneq ($(DISABLE_OPENSSL),TRUE)
+ifeq ($(ENABLE_OPENSSL),TRUE)
 $(eval $(call gb_Library_add_generated_cobjects,neon,\
 	UnpackedTarball/neon/src/ne_openssl \
 ))
@@ -77,7 +77,7 @@ $(eval $(call gb_Library_add_generated_cobjects,neon,\
 ))
 
 else
-ifneq ($(DISABLE_OPENSSL),TRUE)
+ifeq ($(ENABLE_OPENSSL),TRUE)
 $(eval $(call gb_Library_add_generated_cobjects,neon,\
 	UnpackedTarball/neon/src/ne_ntlm \
 ))
diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
index 0bb2ac7fef77..5918cfdcb096 100644
--- a/external/openssl/ExternalProject_openssl.mk
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -50,7 +50,7 @@ OPENSSL_PLATFORM := \
             $(if $(filter X86_64,$(CPUNAME)),darwin64-x86_64-cc)\
             $(if $(filter AARCH64,$(CPUNAME)),darwin64-arm64-cc)\
 	  ,\
-	    $(if $(filter EMSCRIPTEN,$(OS)),no-engine no-dso no-dgram no-sock no-srtp no-stdio no-err no-ocsp no-psk no-stdio no-ts no-asm) \
+	    $(if $(filter EMSCRIPTEN,$(OS)),no-engine no-dso no-dgram no-sock no-srtp no-err no-ocsp no-psk no-ts no-asm) \
           )\
         )\
       )\
diff --git a/external/postgresql/ExternalProject_postgresql.mk b/external/postgresql/ExternalProject_postgresql.mk
index 15ce2819b091..39515fbc977d 100644
--- a/external/postgresql/ExternalProject_postgresql.mk
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -39,7 +39,7 @@ ifeq ($(SYSTEM_ZLIB),)
 postgresql_LDFLAGS += $(ZLIB_LIBS)
 endif
 
-ifeq ($(DISABLE_OPENSSL),)
+ifeq ($(ENABLE_OPENSSL),TRUE)
 ifeq ($(SYSTEM_OPENSSL),)
 postgresql_CPPFLAGS += -I$(call gb_UnpackedTarball_get_dir,openssl)/include
 postgresql_LDFLAGS  += -L$(call gb_UnpackedTarball_get_dir,openssl)/ $(if $(filter $(OS),LINUX),-pthread)
@@ -64,7 +64,7 @@ $(call gb_ExternalProject_get_state_target,postgresql,build) :
 		./configure \
 			--without-readline --disable-shared --with-ldap \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
-			$(if $(DISABLE_OPENSSL),,--with-openssl \
+			$(if $(ENABLE_OPENSSL),--with-openssl \
 				$(if $(WITH_KRB5), --with-krb5) \
 				$(if $(WITH_GSSAPI),--with-gssapi)) \
 				$(if $(ENABLE_LDAP),,--with-ldap=no) \
diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index 5f1fd5ae70ea..68b8aab7b2f8 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -79,7 +79,7 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_elementtree.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	LO_lib/fcntl.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	LO_lib/grp.$(python3_EXTENSION_MODULE_SUFFIX).so \
-	$(if $(DISABLE_OPENSSL),, \
+	$(if $(ENABLE_OPENSSL), \
 		LO_lib/_hashlib.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	) \
 	LO_lib/_heapq.$(python3_EXTENSION_MODULE_SUFFIX).so \
@@ -107,7 +107,7 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_sha512.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	LO_lib/_socket.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	LO_lib/spwd.$(python3_EXTENSION_MODULE_SUFFIX).so \
-	$(if $(DISABLE_OPENSSL),, \
+	$(if $(ENABLE_OPENSSL), \
 		LO_lib/_ssl.$(python3_EXTENSION_MODULE_SUFFIX).so \
 	) \
 	LO_lib/_statistics.$(python3_EXTENSION_MODULE_SUFFIX).so \
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 63f7e0ca5b45..713e4bf9b1e6 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -100,7 +100,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 			--enable-shared \
 			$(if $(filter 1090 101000 101100 101200,$(MAC_OS_X_VERSION_MIN_REQUIRED)),ac_cv_func_utimensat=no) \
 		) \
-		$(if $(SYSTEM_OPENSSL)$(DISABLE_OPENSSL),,\
+		$(if $(ENABLE_OPENSSL),$(if $(SYSTEM_OPENSSL),,\
 			--with-openssl=$(call gb_UnpackedTarball_get_dir,openssl) \
 		) \
 		$(if $(filter LINUX,$(OS)), \
diff --git a/external/xmlsec/ExternalProject_xmlsec.mk b/external/xmlsec/ExternalProject_xmlsec.mk
index 8fb0ef56fa09..3db17c769c8c 100644
--- a/external/xmlsec/ExternalProject_xmlsec.mk
+++ b/external/xmlsec/ExternalProject_xmlsec.mk
@@ -9,9 +9,10 @@
 
 $(eval $(call gb_ExternalProject_ExternalProject,xmlsec))
 
-$(eval $(call gb_ExternalProject_use_external,xmlsec,libxml2))
-
-$(eval $(call gb_ExternalProject_use_external,xmlsec,nss3))
+$(eval $(call gb_ExternalProject_use_externals,xmlsec,\
+    libxml2 \
+    $(if $(ENABLE_NSS),nss3,$(if $(ENABLE_OPENSSL),openssl)) \
+))
 
 $(eval $(call gb_ExternalProject_register_targets,xmlsec,\
 	build \
@@ -44,11 +45,21 @@ $(call gb_ExternalProject_get_state_target,xmlsec,build) :
 			--with-pic --disable-shared --disable-crypto-dl --without-libxslt --without-gnutls --without-gcrypt --disable-apps --disable-docs \
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			CFLAGS="$(CFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS)) $(gb_VISIBILITY_FLAGS)" \
-			--without-openssl \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
-			$(if $(SYSTEM_NSS),,$(if $(filter MACOSX,$(OS_FOR_BUILD)),--disable-pkgconfig)) \
-			$(if $(SYSTEM_NSS),,NSPR_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" NSPR_LIBS="-L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib -lnspr4") \
-			$(if $(SYSTEM_NSS),,NSS_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss" NSS_LIBS="-L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib -lsmime3 -lnss3 -lnssutil3") \
+			$(if $(ENABLE_NSS), \
+				--without-openssl \
+				$(if $(SYSTEM_NSS),, \
+					$(if $(filter MACOSX,$(OS_FOR_BUILD)),--disable-pkgconfig) \
+					NSPR_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" NSPR_LIBS="-L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib -lnspr4" \
+					NSS_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss" NSS_LIBS="-L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib -lsmime3 -lnss3 -lnssutil3" \
+			), \
+				$(if $(ENABLE_OPENSSL), \
+					$(if $(SYSTEM_OPENSSL),, \
+						OPENSSL_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,openssl)/include" \
+						OPENSSL_LIBS="-L$(call gb_UnpackedTarball_get_dir,openssl) -lcrypto -lssl" \
+					), \
+					--without-openssl) \
+			) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(SYSBASE),CFLAGS="-I$(SYSBASE)/usr/include" \
 			LDFLAGS="-L$(SYSBASE)/usr/lib $(if $(filter-out LINUX FREEBSD,$(OS)),",-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN)) \
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 23b12f64c723..b8af059b4ff7 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,7 +13,6 @@ else
 gb_UnoApiHeadersTarget_select_variant = $(2)
 endif
 
-
 include $(GBUILDDIR)/platform/unxgcc.mk
 
 emscripten_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
@@ -24,6 +23,15 @@ gb_CFLAGS += $(emscripten_CPPFLAGS)
 gb_CXXFLAGS += $(emscripten_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
 gb_LinkTarget_LDFLAGS += $(emscripten_CPPFLAGS) --bind
 
+define gb_Library_get_rpath
+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/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index bde5c0fe0a76..616f7ac69af9 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -72,10 +72,13 @@ gb_LinkTarget_LDFLAGS += \
 	-Wl,--sysroot=$(SYSBASE)
 endif
 
+ifneq ($(DISABLE_DYNLOADING),TRUE)
 gb_LinkTarget_LDFLAGS += \
 	-Wl,-rpath-link,$(SYSBASE)/lib:$(SYSBASE)/usr/lib \
 	-Wl,-z,combreloc \
 
+endif
+
 ifeq ($(HAVE_LD_HASH_STYLE),TRUE)
 gb_LinkTarget_LDFLAGS += \
 	-Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index c766365d87ea..b26a5b1dae6d 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -153,6 +153,7 @@ $(eval $(call gb_Executable_use_libraries,ui-previewer,\
         t602filter \
         textconv_dict \
         textfd \
+        tl \
         tk \
         ucb1 \
         ucbhelper \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 220e69dfaeeb..a20abf962612 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -29,7 +29,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
         Package_opengl_denylist ) \
     $(if $(filter SKIA,$(BUILD_TYPE)), \
         Package_skia_denylist ) \
-    $(if $(filter DESKTOP,$(BUILD_TYPE)), \
+    $(if $(filter DESKTOP,$(BUILD_TYPE))$(filter EMSCRIPTEN,$(OS)), \
         StaticLibrary_vclmain \
         $(if $(ENABLE_MACOSX_SANDBOX),, \
             $(if $(DISABLE_GUI),, \
diff --git a/xmlsecurity/Library_xmlsecurity.mk b/xmlsecurity/Library_xmlsecurity.mk
index f50140edb303..31992a969b23 100644
--- a/xmlsecurity/Library_xmlsecurity.mk
+++ b/xmlsecurity/Library_xmlsecurity.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_use_system_win32_libs,xmlsecurity,\
 ))
 else
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE))$(filter ANDROID,$(OS)))
+ifneq ($(OS),EMSCRIPTEN)
 $(eval $(call gb_Library_add_defs,xmlsecurity,\
     -DXMLSEC_CRYPTO_NSS \
 ))
@@ -98,6 +99,7 @@ $(eval $(call gb_Library_use_externals,xmlsecurity,\
     nss3 \
     plc4 \
 ))
+endif
 endif # BUILD_TYPE=DESKTOP
 endif
 
diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk
index bd2cb6abef20..46282b286588 100644
--- a/xmlsecurity/Library_xsec_xmlsec.mk
+++ b/xmlsecurity/Library_xsec_xmlsec.mk
@@ -51,7 +51,7 @@ endif
 
 $(eval $(call gb_Library_use_externals,xsec_xmlsec,\
 	boost_headers \
-	gpgmepp \
+	$(if $(ENABLE_GPGMEPP),gpgmepp) \
 	libxml2 \
 	xmlsec \
 ))
@@ -65,9 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
 	xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl \
 	xmlsecurity/source/xmlsec/xmlsec_init \
 	xmlsecurity/source/xmlsec/xmlstreamio \
-	xmlsecurity/source/xmlsec/nss/ciphercontext \
-	xmlsecurity/source/xmlsec/nss/digestcontext \
-	xmlsecurity/source/xmlsec/nss/nssinitializer \
 ))
 
 ifeq ($(ENABLE_GPGMEPP),TRUE)
@@ -110,24 +107,14 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
 	xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl \
 ))
 
-else
-
-$(eval $(call gb_Library_add_defs,xsec_xmlsec,\
-	-DXMLSEC_CRYPTO_NSS \
-))
+else # !$(OS),WNT
 
-ifeq ($(SYSTEM_XMLSEC),)
-$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
-	$(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
-	$(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \
-))
-endif
-
-$(eval $(call gb_Library_use_externals,xsec_xmlsec,\
-	plc4 \
-))
+ifeq ($(ENABLE_NSS),TRUE)
 
 $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
+	xmlsecurity/source/xmlsec/nss/ciphercontext \
+	xmlsecurity/source/xmlsec/nss/digestcontext \
+	xmlsecurity/source/xmlsec/nss/nssinitializer \
 	xmlsecurity/source/xmlsec/nss/sanextension_nssimpl \
 	xmlsecurity/source/xmlsec/nss/secerror \
 	xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl \
@@ -137,17 +124,32 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
 	xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl \
 ))
 
-endif
+$(eval $(call gb_Library_add_defs,xsec_xmlsec,\
+	-DXMLSEC_CRYPTO_NSS \
+))
 
+$(eval $(call gb_Library_use_externals,xsec_xmlsec,\
+	plc4 \
+))
 # nss3 after static libs to appease --as-needed linkers
 $(eval $(call gb_Library_use_externals,xsec_xmlsec,\
 	nss3 \
 ))
 
+else # ! $(ENABLE_NSS)
+
+ifeq ($(ENABLE_OPENSSL),TRUE)
+$(eval $(call gb_Library_use_external,xsec_xmlsec,openssl))
+endif
+
+endif # !$(ENABLE_NSS)
+
 ifeq ($(OS),SOLARIS)
 $(eval $(call gb_Library_add_libs,xsec_xmlsec,\
 	-ldl \
 ))
 endif
 
+endif # !$(OS),WNT
+
 # vim: set noet sw=4 ts=4:
diff --git a/xmlsecurity/Module_xmlsecurity.mk b/xmlsecurity/Module_xmlsecurity.mk
index 1ce7364d4ce9..695674c25bfb 100644
--- a/xmlsecurity/Module_xmlsecurity.mk
+++ b/xmlsecurity/Module_xmlsecurity.mk
@@ -9,11 +9,9 @@
 
 $(eval $(call gb_Module_Module,xmlsecurity))
 
-ifeq ($(ENABLE_NSS),TRUE)
-
 $(eval $(call gb_Module_add_targets,xmlsecurity,\
 	Library_xmlsecurity \
-	Library_xsec_xmlsec \
+	$(if $(ENABLE_NSS)$(ENABLE_OPENSSL),Library_xsec_xmlsec) \
 	UIConfig_xmlsec \
 ))
 
@@ -37,13 +35,9 @@ $(eval $(call gb_Module_add_screenshot_targets,xmlsecurity,\
 ))
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
-
 $(eval $(call gb_Module_add_targets,xmlsecurity,\
     Executable_pdfverify \
 ))
-
-endif
-
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/xmlsecurity/source/xmlsec/xmlsec_init.cxx b/xmlsecurity/source/xmlsec/xmlsec_init.cxx
index 7e8c58ddeec3..410408ed2ebe 100644
--- a/xmlsecurity/source/xmlsec/xmlsec_init.cxx
+++ b/xmlsecurity/source/xmlsec/xmlsec_init.cxx
@@ -17,7 +17,8 @@
 #include <xmlsec/xmlstreamio.hxx>
 #ifdef XMLSEC_CRYPTO_MSCRYPTO
 #include <xmlsec/mscng/crypto.h>
-#else
+#endif
+#ifdef XMLSEC_CRYPTO_NSS
 #include <xmlsec/nss/crypto.h>
 #endif
 
@@ -36,7 +37,8 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec()
         xmlSecShutdown();
         throw RuntimeException();
     }
-#else
+#endif
+#ifdef XMLSEC_CRYPTO_NSS
     if( xmlSecNssInit() < 0 ) {
         xmlSecShutdown();
         throw RuntimeException();
@@ -47,7 +49,8 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec()
     if( xmlEnableStreamInputCallbacks() < 0 ) {
 #ifdef XMLSEC_CRYPTO_MSCRYPTO
         xmlSecMSCngShutdown();
-#else
+#endif
+#ifdef XMLSEC_CRYPTO_NSS
         xmlSecNssShutdown();
 #endif
         xmlSecShutdown() ;
@@ -60,7 +63,8 @@ XSECXMLSEC_DLLPUBLIC void deInitXmlSec()
     xmlDisableStreamInputCallbacks();
 #ifdef XMLSEC_CRYPTO_MSCRYPTO
     xmlSecMSCngShutdown();
-#else
+#endif
+#ifdef XMLSEC_CRYPTO_NSS
     xmlSecNssShutdown();
 #endif
     xmlSecShutdown();
commit 021ca38fabb01750b91d0971ab8ea93bdebc28e2
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Dec 20 12:00:17 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Dec 20 19:55:24 2020 +0100

    Drop cairo debugging stuff and update README.wasm
    
    Change-Id: Ica8e115ee19c7777f520fe2c41a88efa07de8b13

diff --git a/README.wasm b/README.wasm
index d6180cab09da..46c84a1a1a4e 100644
--- a/README.wasm
+++ b/README.wasm
@@ -71,7 +71,6 @@ Enabling multi-thread support in Firefox is a bit of work with older versions:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
 
 
-
 == Setup LO ==
 
 Currently autogen.sh is patched to use emconfigure. That basically sets various environment vars,
@@ -119,6 +118,36 @@ QT5DIR=/dir/of/git_qt5/qtbase
 Will also be encoded in configure.ac at some point, some already is.
 
 
+= Ideas for an UNO bridge implementation =
+
+My post to Discord #emscripten: "I'm looking for a way to do an abstract call
+from one WASM C++ object to an other WASM C++ object, so like FFI / WebIDL,
+just within WASM. All my code is C++ and normally I have bridge code, with
+assembler to implement the function call /RTTI and exception semantics of the
+specified platform. Code is at
+https://cgit.freedesktop.org/libreoffice/core/tree/bridges/source/cpp_uno.
+I've read a bit about call_indirect and stuff, but I don't have yet a good
+idea, how I could implement this (and  there is an initial feature/wasm branch
+for the interested). I probably need some fixed lookup table, like on iOS,
+because AFAIK you can't dynamically generate code in WASM. So any pointers or
+ideas for an implementation? I can disassemble some minimalistic WASM example
+and read clang code for WASM_EmscriptenInvoke, but if there were some
+standalone code or documentation I'm missing, that would be nice to know."
+
+We basically would go the same way then the other backends. Write the bridge in
+C++, which is probably largely boilerplate code, but the function call in WAT
+(https://github.com/WebAssembly/wabt) based on the LLVM WASM calling
+conventions in WASM_EmscriptenInvoke. I didn't get a reply to that question for
+hours. Maybe I'll open an Emscripten issue, if we really have to implement
+this.
+
+
+= Tools for problem diagnosis =
+
+* nm -s should list the symbols in the archive, based on the index generated by ranlib.
+  If you get linking errors that archive has no index.
+
+
 = Mixed information, links, problems, TODO =
 
 More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 08e83086a1cc..eb32338fe74b 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -64,8 +64,7 @@ else
 $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_Trace_StartRange,cairo,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	env | sort && \
-	dash -x ./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) \
commit c20e6158179cdb0f0db9c5ece3b3d5f2d15195c2
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Dec 18 16:44:29 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Dec 20 19:55:24 2020 +0100

    Next catchall
    
    Before my rebase, this used to link a ui-previewer "executable".
    I have this major problem with the static linkage of the binary,
    which now has to list ~150 dependencies.
    
    While it linked withhout any more symbol errors, it (obviously)
    won't run, because the LO mainloop can't drive the browser
    mainloop.
    
    It currently fails in cairo with pthread detection, which did
    somehow work before. Also exception handling isn't yet correctly
    supported in the build - I think of providing an emscripten
    settings.js instead of adding the info to all external builds.
    
    Change-Id: I757634bb2f819022e537f3f4dd55ddabdc742454

diff --git a/README.wasm b/README.wasm
index 401ad6a345ef..d6180cab09da 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,3 +1,11 @@
+= Status =
+
+$ make cross-toolset
+$ make vcl.all
+
+> instdir/program/ui-previewer.html
+
+
 = Setup for the LO WASM build (with Qt) =
 
 We're using Qt 5.15 with the officially supported emscripten v1.39.8.
@@ -20,6 +28,50 @@ EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
 [ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
 
 
+== Setup Qt ==
+
+https://doc.qt.io/qt-5/wasm.html
+
+I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
+
+./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
+make -j<CORES> module-qtbase module-qtdeclarative
+
+Building with examples will break with some of them, but at that point Qt already works.
+
+If you get a configure failure for Qt:
+
+Checking for target architecture... Project ERROR: target architecture detection binary not found.
+
+Edit git_emsdk/upstream/emscripten/emcc.py:
+@@ -760,8 +760,8 @@
+     only_object = '-c' in cmd
+     for i in reversed(range(len(cmd) - 1)): # Last -o directive should take precedence, if multiple are specified
+       if cmd[i] == '-o':
+-        if not only_object:
+-          cmd[i + 1] += '.js'
++#        if not only_object:
++#          cmd[i + 1] += '.js'
+         target = cmd[i + 1]
+         break
+     if not target:
+
+The previous suggestion, which was to edit qtbase/config.tests/arch/write_info.pri
+-     ext = .wasm
++     ext = .js.wasm
+
+produces errors when loading the generated html, because it can't find the wasm now.
+
+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
+
+Enabling multi-thread support in Firefox is a bit of work with older versions:
+- https://bugzilla.mozilla.org/show_bug.cgi?id=1477743#c7
+- https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
+- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
+
+
+
 == Setup LO ==
 
 Currently autogen.sh is patched to use emconfigure. That basically sets various environment vars,
@@ -42,6 +94,7 @@ QT5DIR=/dir/of/git_qt5/qtbase
 --disable-gio
 --disable-gstreamer-1-0
 --disable-gtk3
+--disable-ldap
 --disable-lpsolve
 --disable-mariadb-sdbc
 --disable-nss
@@ -66,29 +119,6 @@ QT5DIR=/dir/of/git_qt5/qtbase
 Will also be encoded in configure.ac at some point, some already is.
 
 
-== Setup Qt ==
-
-https://doc.qt.io/qt-5/wasm.html
-
-I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
-
-./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
-make -j<CORES> module-qtbase module-qtdeclarative
-
-Building with examples will break with some of them, but at that point Qt already works.
-
-If you get a configure failure for Qt:
-
-Checking for target architecture... Project ERROR: target architecture detection binary not found.
-
-Edit qtbase/config.tests/arch/write_info.pri
--     ext = .wasm
-+     ext = .js.wasm
-
-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
-
-
 = Mixed information, links, problems, TODO =
 
 More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
@@ -141,6 +171,10 @@ This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#h
 
 This didn't help much yet: https://github.com/emscripten-ports
 
+Emscripten supports standalone WASI binaries: https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone
+WASM dynamic dispatch: https://fitzgeraldnick.com/2018/04/26/how-does-dynamic-dispatch-work-in-wasm.html
+WASM dlload: https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/
+
 https://www.qt.io/qt-examples-for-webassembly
 http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
 http://qtandeverything.blogspot.com/2020/
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 126e43b1cd31..1c7fb1789b8e 100644
--- a/bridges/Module_bridges.mk
+++ b/bridges/Module_bridges.mk
@@ -9,6 +9,7 @@
 
 $(eval $(call gb_Module_Module,bridges))
 
+ifneq ($(OS),EMSCRIPTEN)
 $(eval $(call gb_Module_add_targets,bridges,\
 	Library_cpp_uno \
 	$(if $(ENABLE_JAVA),\
@@ -22,7 +23,6 @@ $(eval $(call gb_Module_add_targets,bridges,\
 	) \
 ))
 
-ifneq ($(OS), EMSCRIPTEN)
 ifeq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 ifeq ($(strip $(bridges_SELECTED_BRIDGE)),)
 $(call gb_Output_error,no bridge selected for build: bailing out)
diff --git a/config_host.mk.in b/config_host.mk.in
index 791f88f964b2..8afb776a9c32 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -477,6 +477,16 @@ export PERL=@PERL@
 export PKGFORMAT=@PKGFORMAT@
 export PKGMK=@PKGMK@
 export PKG_CONFIG=@PKG_CONFIG@
+ifneq (@PKG_CONFIG_PATH@,)
+export PKG_CONFIG_PATH=@PKG_CONFIG_PATH@
+else
+unexport PKG_CONFIG_PATH
+endif
+ifneq (@PKG_CONFIG_LIBDIR@,)
+export PKG_CONFIG_LIBDIR=@PKG_CONFIG_LIBDIR@
+else
+unexport PKG_CONFIG_LIBDIR
+endif
 export PLATFORMID=@PLATFORMID@
 export POPPLER_CFLAGS=$(gb_SPACE)@POPPLER_CFLAGS@
 export POPPLER_LIBS=$(gb_SPACE)@POPPLER_LIBS@
diff --git a/configure.ac b/configure.ac
index 6d78e12ce74f..53b038dfde91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6106,6 +6106,8 @@ AC_SUBST(LD)
 AC_SUBST(NM)
 AC_SUBST(OBJDUMP)
 AC_SUBST(PKG_CONFIG)
+AC_SUBST(PKG_CONFIG_PATH)
+AC_SUBST(PKG_CONFIG_LIBDIR)
 AC_SUBST(RANLIB)
 AC_SUBST(READELF)
 AC_SUBST(STRIP)
@@ -12501,6 +12503,9 @@ then
     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"
+    fi
 
     if test "$USING_X11" = TRUE; then
         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 93a6a1bb588f..161dde10c5a9 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1012,6 +1012,7 @@ void EnvironmentsData::getRegisteredEnvironments(
 bool loadEnv(OUString const  & cLibStem,
                     uno_Environment * pEnv)
 {
+#ifndef __EMSCRIPTEN__
 #ifdef DISABLE_DYNLOADING
     uno_initEnvironmentFunc fpInit;
 
@@ -1051,6 +1052,11 @@ bool loadEnv(OUString const  & cLibStem,
 
     (*fpInit)( pEnv ); // init of environment
     return true;
+#else
+    (void)cLibStem;
+    (void)pEnv;
+    return false;
+#endif
 }
 
 }
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 1e8655a99b58..937db9b882fd 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -328,12 +328,14 @@ static void setNegativeBridge( const OUString & rBridgeName )
 
 static uno_ext_getMappingFunc selectMapFunc( const OUString & rBridgeName )
 {
+#if 0
     if (rBridgeName.equalsAscii( CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno" ))
         return CPPU_ENV_uno_ext_getMapping;
 #if HAVE_FEATURE_JAVA
     if (rBridgeName.equalsAscii( "java" "_uno" ))
         return java_uno_ext_getMapping;
 #endif
+#endif
 
 #if 0
     // I don't think the affine or log bridges will be needed on any
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk
index 43a32560e64c..c3f87aca815c 100644
--- a/extensions/Module_extensions.mk
+++ b/extensions/Module_extensions.mk
@@ -13,7 +13,7 @@ $(eval $(call gb_Module_add_l10n_targets,extensions,\
 	AllLangMoTarget_pcr \
 ))
 
-ifneq ($(filter-out iOS ANDROID,$(OS)),)
+ifneq ($(filter-out EMSCRIPTEN iOS ANDROID,$(OS)),)
 $(eval $(call gb_Module_add_targets,extensions,\
 	Library_abp \
 	Library_scn \
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index c8d4ac05d858..08e83086a1cc 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -64,10 +64,11 @@ else
 $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_Trace_StartRange,cairo,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	./configure \
+	env | sort && \
+	dash -x ./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) -pthread") \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="" EMMAKEN_JUST_CONFIGURE=1) \
 		$(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/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
index 2462a1fb93fe..84c88a68a87d 100644
--- a/external/icu/icu4c-emscripten-cross.patch.1
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -10,7 +10,7 @@
  		]
 --- /dev/null
 +++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
-@@ -0,0 +1,85 @@
+@@ -0,0 +1,86 @@
 +## Emscripten-specific setup
 +## Copyright (c) 1999-2013, International Business Machines Corporation and
 +## others. All Rights Reserved.
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index 8bf9f528ee9e..97de6db76b1d 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -11,7 +11,10 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,poppler))
 
 $(eval $(call gb_StaticLibrary_use_unpacked,poppler,poppler))
 
-$(eval $(call gb_StaticLibrary_use_external,poppler,libjpeg))
+$(eval $(call gb_StaticLibrary_use_externals,poppler,\
+    fontconfig \
+    libjpeg \
+))
 
 $(eval $(call gb_StaticLibrary_set_warnings_disabled,poppler))
 
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index fb0e0aa47282..8b1f1dccced4 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -286,6 +286,7 @@ int macxp_resolveAlias(char *path, int buflen);
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
 #   define  pthread_testcancel()
 #   define  NO_PTHREAD_PRIORITY
+#   define INIT_GROUPS(name, gid) false
 #endif
 
 #if !defined(_WIN32)  && \
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index e6d66355c27e..d5279665e8ff 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -9,11 +9,13 @@
 
 $(eval $(call gb_Module_Module,shell))
 
+ifneq (EMSCRIPTEN,$(OS))
 ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
 $(eval $(call gb_Module_add_targets,shell,\
 	Executable_lngconvex \
 ))
 endif
+endif
 
 ifeq ($(gb_Side),host)
 
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2cfccbfa705b..27b8a7b12fc1 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -320,18 +320,6 @@ core_constructor_list = [
     "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
-# starmath/util/sm.component
-    "Math_FormulaDocument_get_implementation",
-    "Math_XMLContentExporter_get_implementation",
-    "Math_XMLExporter_get_implementation",
-    "Math_XMLImporter_get_implementation",
-    "Math_XMLMetaExporter_get_implementation",
-    "Math_XMLOasisMetaExporter_get_implementation",
-    "Math_XMLOasisMetaImporter_get_implementation",
-    "Math_XMLOasisSettingsExporter_get_implementation",
-    "Math_XMLOasisSettingsImporter_get_implementation",
-    "Math_XMLSettingsExporter_get_implementation",
-    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
 # svl/source/fsstor/fsstorage.component
     "svl_FSStorageFactory_get_implementation",
 # svtools/util/svt.component
@@ -567,6 +555,17 @@ math_constructor_list = [
 # starmath/util/sm.component
     "Math_XMLOasisMetaExporter_get_implementation",
     "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_FormulaDocument_get_implementation",
+    "Math_XMLContentExporter_get_implementation",
+    "Math_XMLExporter_get_implementation",
+    "Math_XMLImporter_get_implementation",
+    "Math_XMLMetaExporter_get_implementation",
+    "Math_XMLOasisMetaExporter_get_implementation",
+    "Math_XMLOasisMetaImporter_get_implementation",
+    "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_XMLOasisSettingsImporter_get_implementation",
+    "Math_XMLSettingsExporter_get_implementation",
+    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
     ]
 
 calc_factory_list = [
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index a1d2813edaf9..23b12f64c723 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,12 +13,17 @@ else
 gb_UnoApiHeadersTarget_select_variant = $(2)
 endif
 
-gb_LinkTarget_LDFLAGS += -s TOTAL_MEMORY=1GB
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
-gb_CFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_CXXFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_CXX_LINKFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+emscripten_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+
+gb_Executable_EXT := .html
+
+gb_CFLAGS += $(emscripten_CPPFLAGS)
+gb_CXXFLAGS += $(emscripten_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
+gb_LinkTarget_LDFLAGS += $(emscripten_CPPFLAGS) --bind
+
+#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/vcl/CustomTarget_wasm_native.mk b/vcl/CustomTarget_wasm_native.mk
new file mode 100644
index 000000000000..1bd829634030
--- /dev/null
+++ b/vcl/CustomTarget_wasm_native.mk
@@ -0,0 +1,24 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,vcl/wasm))
+
+wasm_WORKDIR := $(call gb_CustomTarget_get_workdir,vcl/wasm)
+
+$(call gb_CustomTarget_get_target,vcl/wasm): \
+	$(wasm_WORKDIR)/native-code.cxx
+
+$(wasm_WORKDIR)/native-code.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) > $@
+
+# vim: set noet sw=4:
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index acee26cd15d3..c766365d87ea 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -12,30 +12,37 @@ $(eval $(call gb_Executable_Executable,ui-previewer))
 $(eval $(call gb_Executable_use_externals,ui-previewer,\
     boost_headers \
     $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        boost_filesystem \
+        boost_iostreams \
+        boost_system \
+        cairo \
         dtoa \
-        icuuc \
-        icui18n \
+        expat \
+        fontconfig \
+        freetype \
+        graphite \
+        harfbuzz \
+        hunspell \
+        hyphen \
         icudata \
-        libpng \
+        icui18n \
+        icuuc \
+        lcms2 \
+        libexttextcat \
         libjpeg \
-        harfbuzz \
-        libxml2 \
-        graphite \
         liblangtag \
-        qt5 \
-        cairo \
-        fontconfig \
-        lcms2 \
-        freetype \
+        libnumbertext \
+        libpng \
+        librdf \
+        libxml2 \
+        libxslt \
+        mdds_headers \
+        mythes \
         openssl \
-        expat \
-        orcus-parser \
         orcus \
+        orcus-parser \
         qrcodegen \
-        boost_filesystem \
-        boost_iostreams \
-        boost_system \
-        mdds_headers \
+        qt5 \
     ) \
 ))
 
@@ -45,7 +52,10 @@ $(eval $(call gb_Executable_use_api,ui-previewer,\
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
-    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),boost_locale) \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        boost_locale \
+        ulingu \
+    ) \
     vclmain \
 ))
 
@@ -61,36 +71,112 @@ $(eval $(call gb_Executable_use_libraries,ui-previewer,\
         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 \
-        gcc3_uno \
+        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 \
         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) \
     ) \
 ))
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 69bba379be42..2066dfe5a3ea 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -579,6 +579,10 @@ $(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 \
     expat \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 2a910a9ced3f..220e69dfaeeb 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -123,6 +123,12 @@ $(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 \
commit 5562c08905eeb0c95b8984bfd5cb250632b750f7
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Dec 16 02:08:15 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Dec 20 19:55:23 2020 +0100

    Next catchall
    
    This is the "fail to link vcl/Executable_ui-previewer" commit. I
    was hoping to link this executable this evening, but there are
    some remaining mysteries to solve.
    
    I'm missing bridge functions, pcre2 (seems to be from boost regex,
    somehow?), the constructor lists from native-code.py and generally
    still broken dependencies.
    
    What does work is the linking of the Qt5 WASM library, after I
    re-build it inside my chroot, as my Debian has glibc 2.28, while
    my Ubuntu 18.04 chroot has 2.27, so all the native tooling
    wouldn't work. But no new build failures, so just some time.
    
    One main problem is the static linking of executables. For so,
    you have rpath and dependencies, which will get all the correct
    dependencies, but this exists for static archives. I still had
    to fix many externals with -pthread, so growing that list took
    a while anyway, but eventually this should and could be done
    by gbuild. Question is, how hard is it to implement.
    
    I don't know if sal/osl/unx/system.hxx is correct at all, but
    at least it compiles.
    
    I tried to update the REAME with all new infos I find.
    
    Change-Id: I64ecd4f923296eb4aeb42ff4b114c87b58503962

diff --git a/README.wasm b/README.wasm
index be6cc4ff0ecf..401ad6a345ef 100644
--- a/README.wasm
+++ b/README.wasm
@@ -26,36 +26,42 @@ Currently autogen.sh is patched to use emconfigure. That basically sets various
 especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
 configure (a.out).
 
+QT5DIR=/dir/of/git_qt5/qtbase
+
 --host=wasm64-local-emscripten
+--disable-ccache
+--disable-coinmp
 --disable-cups
+--disable-dbus
 --disable-dconf
+--disable-dynamic-loading
+--disable-extension-integration
+--disable-extensions
+--disable-extension-update
+--disable-firebird-sdbc
 --disable-gio
---disable-dbus
---disable-sdremote-bluetooth
 --disable-gstreamer-1-0
---disable-odk
---disable-postgresql-sdbc
---disable-firebird-sdbc
+--disable-gtk3
+--disable-lpsolve
 --disable-mariadb-sdbc
 --disable-nss
+--disable-odk
+--disable-online-update
+--disable-opencl
+--disable-pdfimport
+--disable-postgresql-sdbc
 --disable-python
 --disable-randr
---disable-pdfimport
 --disable-report-builder
---disable-lpsolve
---disable-coinmp
+--disable-scripting
+--disable-sdremote-bluetooth
+--enable-qt5
 --without-fonts
+--without-helppack-integration
 --without-java
 --without-junit
---without-helppack-integration
 --without-system-dicts
 --with-theme=no
---disable-cairo-canvas
---disable-scripting
---disable-dynamic-loading
---disable-ccache
---disable-gtk3
---enable-qt5
 
 Will also be encoded in configure.ac at some point, some already is.
 
@@ -87,10 +93,19 @@ Use: emrun --serve_after_close to run Qt WASM demos
 
 More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
 
+WASM needs -pthread at compile, not just link time for atomics support. Alternativel< you can provide
+-s USE_PTHREADS=1, but both don't seem to work relyable, so best provide both.
+https://github.com/emscripten-core/emscripten/issues/10370
+
+The output file must have the prefix .o, otherwise the WASM files will get a
+node.js shebang (!) and ranlib won't be able to index the library (link errors).
+
 Qt with threads has further memory limit. From Qt configure:
 Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
 Project MESSAGE: Setting TOTAL_MEMORY to 1GB
 
+You can actually allocate 4GB: https://bugzilla.mozilla.org/show_bug.cgi?id=1392234
+
 LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
 the browser event loop. like VCL does with the system event loop in the various VCL backends.
 Changing this will need some major work (basically dropping Application::Execute).
diff --git a/Repository.mk b/Repository.mk
index 5311a5d1b84b..c3872fa9369d 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -470,6 +470,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(filter iOS MACOSX,$(OS)), \
 		MacOSXSpell \
 	) \
+	$(if $(filter $(OS),EMSCRIPTEN),vclplug_qt5) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,postgresqlsdbc, \
@@ -916,7 +917,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 		$(if $(ENABLE_SCRIPTING_BEANSHELL),scripting_ScriptsBeanShell) \
 		$(if $(ENABLE_SCRIPTING_JAVASCRIPT),scripting_ScriptsJavaScript) \
 	) \
-	$(if $(DISABLE_SCRIPTING),,scripting_scriptbindinglib) \
+	$(if $(filter SCRIPTING,$(BUILD_TYPE)),scripting_scriptbindinglib) \
 	$(if $(filter $(OS),MACOSX),sysui_osxicons) \
 	wizards_basicshare \
 	wizards_basicsrvaccess2base \
diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk
index caf3d612330b..6e4c90eba50d 100644
--- a/accessibility/Library_acc.mk
+++ b/accessibility/Library_acc.mk
@@ -63,10 +63,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\
     accessibility/source/extended/accessibleiconchoicectrlentry \
     accessibility/source/extended/accessiblelistbox \
     accessibility/source/extended/accessiblelistboxentry \
-    accessibility/source/extended/accessibletabbar \
-    accessibility/source/extended/accessibletabbarbase \
-    accessibility/source/extended/accessibletabbarpage \
-    accessibility/source/extended/accessibletabbarpagelist \
     accessibility/source/extended/accessibletablistbox \
     accessibility/source/extended/accessibletablistboxtable \
     accessibility/source/extended/textwindowaccessibility \
@@ -110,4 +106,13 @@ $(eval $(call gb_Library_add_exception_objects,acc,\
     accessibility/source/standard/vclxaccessibletoolboxitem \
 ))
 
+ifneq ($(filter SCRIPTING,$(BUILD_TYPE)),)
+$(eval $(call gb_Library_add_exception_objects,acc,\
+    accessibility/source/extended/accessibletabbar \
+    accessibility/source/extended/accessibletabbarbase \
+    accessibility/source/extended/accessibletabbarpage \
+    accessibility/source/extended/accessibletabbarpagelist \
+))
+endif
+
 # vim:set noet sw=4 ts=4:
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index a4648485c2dc..f1249d47f99c 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -378,7 +378,11 @@ Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl(
 
 Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTabBar ) const
 {
+#if HAVE_FEATURE_SCRIPTING
     return new AccessibleTabBar( &_rTabBar );
+#else
+    return nullptr;
+#endif
 }
 
 Reference< XAccessibleContext > AccessibleFactory::createAccessibleTextWindowContext(
diff --git a/configure.ac b/configure.ac
index 4c7cfd58496e..6d78e12ce74f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -807,6 +807,8 @@ dnl Sequential to keep the logic very simple
 dnl These values may be checked and reset later.
 dnl ===================================================================
 #defaults unless the os test overrides this:
+test_cmis=yes
+test_curl=yes
 test_randr=yes
 test_xrender=yes
 test_cups=yes
@@ -960,6 +962,7 @@ darwin*|macos*) # macOS
 ;;
 
 ios*) # iOS
+    test_cmis=no
     test_randr=no
     test_xrender=no
     test_freetype=no
@@ -1114,12 +1117,13 @@ emscripten*)
     enable_lpsolve=no
     enable_report_builder=no
     with_theme="breeze"
+    test_cmis=no
     test_cups=no
+    test_curl=no
     test_dbus=no
     test_fontconfig=no
     test_freetype=no
     test_gtk=no
-    test_kde4=no
     test_randr=no
     test_xrender=no
     enable_postgresql_sdbc=no
@@ -5214,7 +5218,7 @@ if test "$cross_compiling" = "yes"; then
     (
     unset COM USING_X11 OS CPUNAME
     unset CC CXX SYSBASE CFLAGS
-    unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
+    unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
@@ -5505,6 +5509,11 @@ if test "$USING_X11" != TRUE; then
     enable_cairo_canvas=no
 fi
 
+if test "$OS" = "EMSCRIPTEN"; then
+    enable_cairo_canvas=yes
+    test_qt5=yes
+fi
+
 if test "$OS" = "HAIKU"; then
     enable_cairo_canvas=yes
     test_kf5=yes
@@ -7085,7 +7094,7 @@ dnl ===================================================================
 dnl Check for system libcmis
 dnl ===================================================================
 # libcmis requires curl and we can't build curl for iOS
-if test $_os != iOS; then
+if test "$test_cmis" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
     ENABLE_LIBCMIS=TRUE
 else
@@ -9993,7 +10002,7 @@ if test "$with_system_curl" = "auto"; then
     with_system_curl="$with_system_libs"
 fi
 
-if test "$with_system_curl" = "yes"; then
+if test "$test_curl" = "yes" -a "$with_system_curl" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_CURL=TRUE
 
@@ -10025,6 +10034,8 @@ if test "$with_system_curl" = "yes"; then
     fi
 
     ENABLE_CURL=TRUE
+elif test "$test_curl" = "no"; then
+    AC_MSG_RESULT([none])
 else
     AC_MSG_RESULT([internal])
     SYSTEM_CURL=
@@ -12426,7 +12437,11 @@ then
     fi
 
     qt5_test_include="QtWidgets/qapplication.h"
-    qt5_test_library="libQt5Widgets.so"
+    if test "$_os" = "Emscripten"; then
+        qt5_test_library="libQt5Widgets.a"
+    else
+        qt5_test_library="libQt5Widgets.so"
+    fi
 
     dnl Check for qmake5
     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 832a7314b440..56fc111beef4 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -53,6 +53,9 @@
 #include <orcus/config.hpp>
 #include <orcus/pstring.hpp>
 
+#ifdef PAGE_SIZE
+#undef PAGE_SIZE
+#endif
 #define PAGE_SIZE 30
 
 using namespace css;
diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 046f7e6da1b2..adae48e37b3f 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,boost,3))
 
 $(eval $(call gb_UnpackedTarball_add_patches,boost,\
 	$(foreach patch,$(boost_patches),external/boost/$(patch)) \
+    external/boost/boost-emscripten-noshm.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/boost/boost-emscripten-noshm.patch.0 b/external/boost/boost-emscripten-noshm.patch.0
new file mode 100644
index 000000000000..f9d27b0b6e11
--- /dev/null
+++ b/external/boost/boost-emscripten-noshm.patch.0
@@ -0,0 +1,11 @@
+--- boost/interprocess/detail/workaround.hpp.orig	2020-12-15 06:31:51.037665526 +0100
++++ boost/interprocess/detail/workaround.hpp	2020-12-15 06:32:39.741281893 +0100
+@@ -31,7 +31,7 @@
+    //////////////////////////////////////////////////////
+    //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
+    //////////////////////////////////////////////////////
+-   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__)
++   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !defined(__EMSCRIPTEN__)
+       #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+    #endif
+ 
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 41e7621c789f..c8d4ac05d858 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -67,11 +67,12 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 	./configure \
 		$(if $(debug),STRIP=" ") \
 		$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-		$(if $(filter-out ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) -pthread") \
+		$(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)" \
 		$(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \
-		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
+		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman -pthread" \
 		pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \
 			$(if $(filter LINUX,$(OS)),-Wl$(COMMA)-z$(COMMA)origin \
 					-Wl$(COMMA)-rpath$(COMMA)\\\$$\$$ORIGIN) \
@@ -84,7 +85,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 		$(if $(SYSTEM_FONTCONFIG),,FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)") \
 		$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
-		$(if $(filter ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
+		$(if $(filter EMSCRIPTEN ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
 		$(if $(filter iOS,$(OS)),--enable-quartz --enable-quartz-font) \
 		--disable-valgrind \
 		$(if $(filter iOS,$(OS)),--disable-ft,--enable-ft --enable-fc) \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index fec943762df8..00b61170ff77 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -39,6 +39,7 @@ $(call gb_ExternalProject_get_state_target,pixman,build) :
 		$(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 		$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS="-pthread") \
 		&& $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,pixman,EXTERNAL)
diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk
index b82c7657395b..14190675427a 100644
--- a/external/fontconfig/ExternalProject_fontconfig.mk
+++ b/external/fontconfig/ExternalProject_fontconfig.mk
@@ -21,7 +21,7 @@ $(eval $(call gb_ExternalProject_register_targets,fontconfig,\
 $(call gb_ExternalProject_get_state_target,fontconfig,build) :
 	$(call gb_Trace_StartRange,fontconfig,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
+		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS) $(if $(filter EMSCRIPTEN,$(OS)),-pthread)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
 		./configure \
 			--disable-shared \
 			--disable-silent-rules \
@@ -29,6 +29,7 @@ $(call gb_ExternalProject_get_state_target,fontconfig,build) :
 			--with-expat-includes=$(call gb_UnpackedTarball_get_dir,expat)/lib \
 			--with-expat-lib=$(gb_StaticLibrary_WORKDIR) \
 			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+			$(if $(filter EMSCRIPTEN,$(OS)),ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no) \
 		&& $(MAKE) -C src \
 	)
 	$(call gb_Trace_EndRange,fontconfig,EXTERNAL)
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 015d286b1414..0c8a7047ec01 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -73,7 +73,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 		./configure \
 			--disable-layout --disable-samples \
 			$(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \
-			$(if $(filter ENSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter EMSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--with-data-packaging=static --enable-static --disable-shared --disable-dyload,\
@@ -81,6 +81,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\
 				--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \
 				--disable-tools --disable-extras) \
+			AR="$(AR)" RANLIB="$(RANLIB)" \
 		&& $(MAKE) $(if $(CROSS_COMPILING),DATASUBDIR=data) $(if $(verbose),VERBOSE=1) \
 		$(if $(filter MACOSX,$(OS)), \
 			&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl \
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
index 5935a0169f53..2462a1fb93fe 100644
--- a/external/icu/icu4c-emscripten-cross.patch.1
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -10,7 +10,7 @@
  		]
 --- /dev/null
 +++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
-@@ -0,0 +1,89 @@
+@@ -0,0 +1,85 @@
 +## Emscripten-specific setup
 +## Copyright (c) 1999-2013, International Business Machines Corporation and
 +## others. All Rights Reserved.
@@ -52,18 +52,15 @@
 +## Shared object suffix
 +SO = so
 +## Non-shared intermediate object suffix
-+STATIC_O = ao
++STATIC_O = o
 +
 +## Compilation rules
++# WASM needs -pthread for atomics support
 +%.$(STATIC_O): $(srcdir)/%.c
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -o $@ $<)
-+%.o: $(srcdir)/%.c
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -o $@ $<)
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -pthread -o $@ $<)
 +
 +%.$(STATIC_O): $(srcdir)/%.cpp
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -o $@ $<)
-+%.o: $(srcdir)/%.cpp
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -o $@ $<)
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -pthread -o $@ $<)
 +
 +
 +## Dependency rules
diff --git a/external/liblangtag/ExternalProject_liblangtag.mk b/external/liblangtag/ExternalProject_liblangtag.mk
index 51dc4f4b0c68..b45615e86ff0 100644
--- a/external/liblangtag/ExternalProject_liblangtag.mk
+++ b/external/liblangtag/ExternalProject_liblangtag.mk
@@ -29,7 +29,7 @@ $(call gb_ExternalProject_get_state_target,liblangtag,build):
 			--enable-shared --disable-static) \
 		$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 		$(if $(filter TRUE,$(HAVE_GCC_BUILTIN_ATOMIC)),"lt_cv_has_atomic=yes","lt_cv_has_atomic=no") \
-		CFLAGS='$(CFLAGS) \
+		CFLAGS='$(CFLAGS) -pthread \
 				$(if $(ENABLE_OPTIMIZED), \
 					$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
 				$(if $(call gb_Module__symbols_enabled,liblangtag),$(gb_DEBUGINFO_FLAGS))' \
diff --git a/include/sal/alloca.h b/include/sal/alloca.h
index bb4c3e0e0c05..05fe1b715f33 100644
--- a/include/sal/alloca.h
+++ b/include/sal/alloca.h
@@ -21,7 +21,7 @@
 #define INCLUDED_SAL_ALLOCA_H
 
 #if defined(__sun) || defined(LINUX) || defined(AIX) || defined(ANDROID) || defined(HAIKU)         \
-    || defined(MACOSX) || defined(IOS)
+    || defined(MACOSX) || defined(IOS) || defined(EMSCRIPTEN)
 
 #ifndef INCLUDED_ALLOCA_H
 #include <alloca.h>
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index a8b0e10cd163..fb0e0aa47282 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -269,13 +269,32 @@ int macxp_resolveAlias(char *path, int buflen);
 #   define  NO_PTHREAD_RTL
 #endif
 
+#ifdef EMSCRIPTEN
+#   ifndef ETIME
+#       define  ETIME ETIMEDOUT
+#   endif
+#   include <pthread.h>
+#   include <sys/file.h>
+#   include <sys/ioctl.h>
+#   include <sys/uio.h>
+#   include <sys/un.h>
+#   include <netinet/tcp.h>
+#   include <dlfcn.h>
+#   include <endian.h>
+#   include <sys/time.h>
+#   define  IORESOURCE_TRANSFER_BSD
+#   define  IOCHANNEL_TRANSFER_BSD_RENO
+#   define  pthread_testcancel()
+#   define  NO_PTHREAD_PRIORITY
+#endif
+
 #if !defined(_WIN32)  && \
     !defined(LINUX)   && !defined(NETBSD) && !defined(FREEBSD) && \
     !defined(AIX)     && \
     !defined(__sun) && !defined(MACOSX) && \
     !defined(OPENBSD) && !defined(DRAGONFLY) && \
     !defined(IOS) && !defined(ANDROID) && \
-    !defined(HAIKU)
+    !defined(HAIKU) && !defined(EMSCRIPTEN)
 #   error "Target platform not specified!"
 #endif
 
diff --git a/scripting/Module_scripting.mk b/scripting/Module_scripting.mk
index 1d603d585a11..1d974e8e7c26 100644
--- a/scripting/Module_scripting.mk
+++ b/scripting/Module_scripting.mk
@@ -31,7 +31,7 @@ $(eval $(call gb_Module_add_targets,scripting,\
 		$(if $(ENABLE_SCRIPTING_BEANSHELL),Package_ScriptsBeanShell) \
 		$(if $(ENABLE_SCRIPTING_JAVASCRIPT),Package_ScriptsJavaScript) \
 	) \
-	$(if $(DISABLE_SCRIPTING),,Package_scriptbindinglib) \
+	Package_scriptbindinglib \
 	$(if $(DISABLE_PYTHON),,\
 		Package_scriptproviderforpython \
 		Package_ScriptsPython \
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 7495a32626aa..a1d2813edaf9 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,6 +13,12 @@ else
 gb_UnoApiHeadersTarget_select_variant = $(2)
 endif
 
+gb_LinkTarget_LDFLAGS += -s TOTAL_MEMORY=1GB
+
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+gb_CFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+gb_CXXFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+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/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
deleted file mode 100644
index 7495a32626aa..000000000000
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- 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/.
-#
-
-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
-
-# vim: set noet sw=4 ts=4
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 5f4a06445225..d5b23ae31875 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -140,7 +140,7 @@ endif
 gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden
 gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX)
 
-gb_LinkTarget_LDFLAGS += -fstack-protector-strong
+gb_LinkTarget_LDFLAGS += $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong)
 
 ifneq ($(gb_ENABLE_PCH),)
 ifeq ($(COM_IS_CLANG),TRUE)
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 7ef9d0b4015e..bde5c0fe0a76 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -135,7 +135,7 @@ $(call gb_Helper_abbreviate_dirs,\
 		    $(T_LIBS) \
 		    $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
-		    , \
+		, \
 		    -Wl$(COMMA)--start-group \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		    $(T_LIBS) \
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index 20339da7c58e..fed54a9185ca 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -47,7 +47,7 @@ $(eval $(call gb_Module_add_screenshot_targets,svx,\
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,svx,\
-    Executable_gengal \
+    $(if $(filter-out EMSCRIPTEN,$(OS)),Executable_gengal) \
     $(if $(filter-out MACOSX WNT,$(OS)), \
 		Package_gengal) \
 ))
diff --git a/unoidl/Executable_unoidl-read.mk b/unoidl/Executable_unoidl-read.mk
index b134c30b1a72..037097df1ba6 100644
--- a/unoidl/Executable_unoidl-read.mk
+++ b/unoidl/Executable_unoidl-read.mk
@@ -21,4 +21,8 @@ $(eval $(call gb_Executable_use_libraries,unoidl-read, \
     sal \
 ))
 
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_Executable_use_external,unoidl-read,dtoa))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index bee97cbac14b..acee26cd15d3 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -9,7 +9,35 @@
 
 $(eval $(call gb_Executable_Executable,ui-previewer))
 
-$(eval $(call gb_Executable_use_external,ui-previewer,boost_headers))
+$(eval $(call gb_Executable_use_externals,ui-previewer,\
+    boost_headers \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        dtoa \
+        icuuc \
+        icui18n \
+        icudata \
+        libpng \
+        libjpeg \
+        harfbuzz \
+        libxml2 \
+        graphite \
+        liblangtag \
+        qt5 \
+        cairo \
+        fontconfig \
+        lcms2 \
+        freetype \
+        openssl \
+        expat \
+        orcus-parser \
+        orcus \
+        qrcodegen \
+        boost_filesystem \
+        boost_iostreams \
+        boost_system \
+        mdds_headers \
+    ) \
+))
 
 $(eval $(call gb_Executable_use_api,ui-previewer,\
     offapi \
@@ -17,17 +45,54 @@ $(eval $(call gb_Executable_use_api,ui-previewer,\
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),boost_locale) \
     vclmain \
 ))
 
 $(eval $(call gb_Executable_use_libraries,ui-previewer,\
-	comphelper \
-	cppu \
-	cppuhelper \
-	sal \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
     tl \
     ucbhelper \
     vcl \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)), \
+        acc \
+        avmedia \
+        basegfx \
+        cui \
+        dbtools \
+        drawinglayer \
+        editeng \
+        emfio \
+        epoxy \
+        fwk \
+        gcc3_uno \
+        gie \
+        graphicfilter \
+        i18nlangtag \
+        i18nutil \
+        lng \
+        reg \
+        salhelper \
+        sax \
+        sfx \
+        sot \
+        store \
+        svl \
+        svt \
+        svx \
+        svxcore \
+        tk \
+        ucbhelper \
+        unoidl \
+        utl \
+        xmlreader \
+        xo \
+        xof \
+        $(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
+    ) \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,ui-previewer,\
@@ -40,12 +105,12 @@ $(eval $(call gb_Executable_add_defs,ui-previewer,\
 
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 $(eval $(call gb_Executable_add_libs,ui-previewer,\
-	-lm $(DLOPEN_LIBS) \
+    -lm $(DLOPEN_LIBS) \
     -lX11 \
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
-	glxtest \
+    glxtest \
 ))
 endif
 
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index ff8c4182af2f..69bba379be42 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -569,6 +569,24 @@ $(eval $(call gb_Library_use_externals,vcl,\
 ))
 endif
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+    vcl/unx/generic/printer/jobdata \
+    vcl/unx/generic/printer/ppdparser \
+    vcl/null/printerinfomanager \
+    vcl/wasm/salplug \
+    $(vcl_headless_code) \
+    $(vcl_headless_freetype_code) \
+))
+
+$(eval $(call gb_Library_use_externals,vcl,\
+    cairo \
+    expat \
+    fontconfig \
+    freetype \
+))
+endif
+
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 $(eval $(call gb_Library_add_libs,vcl,\
     -lm $(DLOPEN_LIBS) \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 25cbfe9f60ba..3aad76800ad6 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -80,8 +80,6 @@ $(eval $(call gb_Library_add_libs,vclplug_qt5,\
 endif
 
 $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
-    vcl/qt5/Qt5AccessibleEventListener \
-    vcl/qt5/Qt5AccessibleWidget \
     vcl/qt5/Qt5Bitmap \
     vcl/qt5/Qt5Clipboard \
     vcl/qt5/Qt5Data \
@@ -110,8 +108,15 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Transferable \
     vcl/qt5/Qt5VirtualDevice \
     vcl/qt5/Qt5Widget \
+))
+
+ifneq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
+    vcl/qt5/Qt5AccessibleEventListener \
+    vcl/qt5/Qt5AccessibleWidget \
     vcl/qt5/Qt5XAccessible \
 ))
+endif
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,vclplug_qt5,\
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 8bfc67c1e2ef..2a910a9ced3f 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -78,12 +78,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
     Library_vclplug_kf5 \
 ))
 endif
-ifneq ($(ENABLE_QT5),)
-$(eval $(call gb_Module_add_targets,vcl,\
-    CustomTarget_qt5_moc \
-    Library_vclplug_qt5 \
-))
-endif
 ifneq ($(ENABLE_GTK3_KDE5),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_gtk3_kde5_moc \
@@ -122,6 +116,13 @@ $(eval $(call gb_Module_add_targets,vcl,\
 endif
 endif
 
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+    CustomTarget_qt5_moc \
+    Library_vclplug_qt5 \
+))
+endif
+
 ifneq ($(ENABLE_FUZZERS),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_nativecore \
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 97eff04fe77a..2f6bfb4b5fcd 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -562,7 +562,7 @@ void* Qt5Instance::CreateGStreamerSink(const SystemChildWindow* pWindow)
 
     return pVideosink;
 #else
-    (void*)pWindow;
+    Q_UNUSED(pWindow);
     return nullptr;
 #endif
 }
diff --git a/vcl/qt5/Qt5MainWindow.cxx b/vcl/qt5/Qt5MainWindow.cxx
index 45d726ba22be..89879864a9bc 100644
--- a/vcl/qt5/Qt5MainWindow.cxx
+++ b/vcl/qt5/Qt5MainWindow.cxx
@@ -19,7 +19,9 @@ Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
     : QMainWindow(nullptr, f)
     , m_rFrame(rFrame)
 {
+#ifndef EMSCRIPTEN
     QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
+#endif
 }
 
 void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
diff --git a/vcl/wasm/salplug.cxx b/vcl/wasm/salplug.cxx
new file mode 100644
index 000000000000..b5ba480dd104
--- /dev/null
+++ b/vcl/wasm/salplug.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "saldatabasic.hxx"
+#include "printerinfomanager.hxx"
+
+extern "C" SalInstance* create_SalInstance();
+
+void SalAbort(const OUString& /* rErrorText */, bool /* bDumpCore */)
+{
+    //    NSLog(@"SalAbort: %s", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+    static OUString aEnv("wasm");
+    return aEnv;
+}
+
+SalInstance* CreateSalInstance() { return create_SalInstance(); }
+
+void DestroySalInstance(SalInstance* pInst)
+{
+    pInst->ReleaseYieldMutexAll();
+    delete pInst;
+}
+
+SalData::SalData()
+    : m_pInstance(nullptr)
+    , m_pPIManager(nullptr)
+{
+}
+
+SalData::~SalData() COVERITY_NOEXCEPT_FALSE { psp::PrinterInfoManager::release(); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit fcee3eab476a0ce0e7e2ab1a085dcdd5f9f47d93
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Dec 11 17:27:59 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sun Dec 20 19:55:23 2020 +0100

    WASM catchall commit
    
    The current state is incompatible with upstream, especially the
    emconfigure change.
    
    Please also read README.wasm
    
    Change-Id: I668b4128491c467b94ea1c13ee695b08dce32968

diff --git a/README.wasm b/README.wasm
new file mode 100644
index 000000000000..be6cc4ff0ecf
--- /dev/null
+++ b/README.wasm
@@ -0,0 +1,144 @@
+= 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.
+
+Qt WASM is not yet used with LO, just if you're wondering!
+
+== Setup emscripten ==
+
+https://emscripten.org/docs/getting_started/index.html
+
+git clone https://github.com/emscripten-core/emsdk.git
+./emsdk install 1.39.8
+./emsdk activate --embedded 1.39.8
+
+Example bashrc scriptlet:
+
+EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
+[ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
+
+
+== Setup LO ==
+
+Currently 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).
+
+--host=wasm64-local-emscripten
+--disable-cups
+--disable-dconf
+--disable-gio
+--disable-dbus
+--disable-sdremote-bluetooth
+--disable-gstreamer-1-0
+--disable-odk
+--disable-postgresql-sdbc
+--disable-firebird-sdbc
+--disable-mariadb-sdbc
+--disable-nss
+--disable-python
+--disable-randr
+--disable-pdfimport
+--disable-report-builder
+--disable-lpsolve
+--disable-coinmp
+--without-fonts
+--without-java
+--without-junit
+--without-helppack-integration
+--without-system-dicts
+--with-theme=no
+--disable-cairo-canvas
+--disable-scripting
+--disable-dynamic-loading
+--disable-ccache
+--disable-gtk3
+--enable-qt5
+
+Will also be encoded in configure.ac at some point, some already is.
+
+
+== Setup Qt ==
+
+https://doc.qt.io/qt-5/wasm.html
+
+I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
+
+./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
+make -j<CORES> module-qtbase module-qtdeclarative
+
+Building with examples will break with some of them, but at that point Qt already works.
+
+If you get a configure failure for Qt:
+
+Checking for target architecture... Project ERROR: target architecture detection binary not found.
+
+Edit qtbase/config.tests/arch/write_info.pri
+-     ext = .wasm
++     ext = .js.wasm
+
+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
+
+
+= Mixed information, links, problems, TODO =
+
+More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
+
+Qt with threads has further memory limit. From Qt configure:
+Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
+Project MESSAGE: Setting TOTAL_MEMORY to 1GB
+
+LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
+the browser event loop. like VCL does with the system event loop in the various VCL backends.
+Changing this will need some major work (basically dropping Application::Execute).
+
+But with the know problems with exceptions and threads, this might change:
+- https://github.com/emscripten-core/emscripten/pull/11518
+- https://github.com/emscripten-core/emscripten/issues/11503
+- https://github.com/emscripten-core/emscripten/issues/11233
+- https://github.com/emscripten-core/emscripten/issues/12035
+
+We're also using emconfigure at the moment. Originally I patched emscripten, because it
+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
+
+There is a wasm64, but that still uses 32bit pointers!
+
+Old outdated docs: https://wiki.documentfoundation.org/Development/Emscripten
+Reverted patch: https://cgit.freedesktop.org/libreoffice/core/commit/?id=0e21f6619c72f1e17a7b0a52b6317810973d8a3e
+
+Generally https://emscripten.org/docs/porting:
+- https://emscripten.org/docs/porting/guidelines/api_limitations.html#api-limitations
+- https://emscripten.org/docs/porting/files/file_systems_overview.html#file-system-overview
+- https://emscripten.org/docs/porting/pthreads.html
+- https://emscripten.org/docs/porting/emscripten-runtime-environment.html
+
+This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-an-event-loop
+
+This didn't help much yet: https://github.com/emscripten-ports
+
+https://www.qt.io/qt-examples-for-webassembly
+http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
+http://qtandeverything.blogspot.com/2020/
+https://emscripten.org/docs/api_reference/Filesystem-API.html
+https://discuss.python.org/t/add-a-webassembly-wasm-runtime/3957/12
+http://git.savannah.gnu.org/cgit/config.git
+https://webassembly.org/specs/
+https://developer.chrome.com/docs/native-client/
+https://emscripten.org/docs/getting_started/downloads.html
+https://github.com/openpgpjs/openpgpjs/blob/master/README.md#getting-started
+https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
+https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md
+https://www.ip6.li/de/security/x.509_kochbuch/openssl-fuer-webassembly-compilieren
+https://emscripten.org/docs/introducing_emscripten/about_emscripten.html#about-emscripten-porting-code
+https://emscripten.org/docs/compiling/Building-Projects.html
+
diff --git a/autogen.sh b/autogen.sh
index 1779de77e6f3..54cc7e6262c8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -313,7 +313,7 @@ if (defined $ENV{NOCONFIGURE}) {
         $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
     }
 
-    system ("./configure", @args) && die "Error running configure";
+    system ("emconfigure", "./configure", @args) && die "Error running configure";
 }
 
 # Local Variables:
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 3016bf2c404f..126e43b1cd31 100644
--- a/bridges/Module_bridges.mk
+++ b/bridges/Module_bridges.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_Module_add_targets,bridges,\
 	) \
 ))
 
+ifneq ($(OS), EMSCRIPTEN)
 ifeq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 ifeq ($(strip $(bridges_SELECTED_BRIDGE)),)
 $(call gb_Output_error,no bridge selected for build: bailing out)
@@ -29,5 +30,6 @@ else ifneq ($(words $(bridges_SELECTED_BRIDGE)),1)
 $(call gb_Output_error,multiple bridges selected for build: $(bridges_SELECTED_BRIDGE))
 endif
 endif
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/config_host.mk.in b/config_host.mk.in
index add0c176ebc6..791f88f964b2 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -328,6 +328,7 @@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@
 export KRB5_LIBS=@KRB5_LIBS@
 export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@
 export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@
+export LD=@LD@
 export LD_GC_SECTIONS=@LD_GC_SECTIONS@
 export LD_PLUGIN=@LD_PLUGIN@
 @x_LDFLAGS@ export LDFLAGS=@LDFLAGS@
@@ -640,6 +641,7 @@ export USE_XINERAMA=@USE_XINERAMA@
 export UPDATE_CONFIG=@UPDATE_CONFIG@
 export UUIDGEN=@UUIDGEN@
 export VALGRIND_CFLAGS=$(gb_SPACE)@VALGRIND_CFLAGS@
+export VCL_PLUGIN_INFO=@VCL_PLUGIN_INFO@
 export VCVER=@VCVER@
 export DEVENV=@DEVENV@
 export VISIO_CFLAGS=$(gb_SPACE)@VISIO_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 29d553b7c198..4c7cfd58496e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,6 +1108,27 @@ haiku*)
     _os=Haiku
     ;;
 
+emscripten*)
+    build_gstreamer_1_0=no
+    enable_coinmp=yes
+    enable_lpsolve=no
+    enable_report_builder=no
+    with_theme="breeze"
+    test_cups=no
+    test_dbus=no
+    test_fontconfig=no
+    test_freetype=no
+    test_gtk=no
+    test_kde4=no
+    test_randr=no
+    test_xrender=no
+    enable_postgresql_sdbc=no
+    enable_firebird_sdbc=no
+    enable_mariadb_sdbc=no
+    with_system_zlib=no
+    _os=Emscripten
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -1806,6 +1827,13 @@ libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
          Requires --enable-openssl.]))
 
+AC_ARG_ENABLE(nss,
+    AS_HELP_STRING([--disable-nss],
+        [Disable using NSS. If disabled,
+         components will either use GNUTLS or openssl. Work in progress,
+         use only if you are hacking on it.]),
+,enable_nss=yes)
+
 AC_ARG_ENABLE(library-bin-tar,
     AS_HELP_STRING([--enable-library-bin-tar],
         [Enable the building and reused of tarball of binary build for some 'external' libraries.
@@ -4093,6 +4121,8 @@ if test "$COM_IS_CLANG" = TRUE; then
         [my_apple_clang=yes],[my_apple_clang=])
     if test "$my_apple_clang" = yes; then
         AC_MSG_RESULT([assumed yes (Apple Clang)])
+    elif test "$_os" = Emscripten; then
+        AC_MSG_RESULT([assumed yes (Emscripten Clang)])
     else
         if test "$_os" = WINNT; then
             dnl In which case, assume clang-cl:
@@ -5041,6 +5071,25 @@ solaris*)
     SOLARINC="$SOLARINC -I/usr/local/include"
     ;;
 
+emscripten*)
+    COM=GCC
+    USING_X11=
+    OS=EMSCRIPTEN
+    RTL_OS=Emscripten
+    P_SEP=:
+
+    case "$host_cpu" in
+    wasm32|wasm64)
+        ;;
+    *)
+        AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
+        ;;
+    esac
+    CPUNAME=INTEL
+    RTL_ARCH=x86
+    PLATFORMID=linux_x86
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -5167,7 +5216,8 @@ if test "$cross_compiling" = "yes"; then
     unset CC CXX SYSBASE CFLAGS
     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
-    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
+    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
+    unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
     if test -n "$CC_FOR_BUILD"; then
         export CC="$CC_FOR_BUILD"
         CC_BASE=`first_arg_basename "$CC"`
@@ -5212,6 +5262,7 @@ if test "$cross_compiling" = "yes"; then
         --disable-gstreamer-1-0 \
         --disable-gtk3 \
         --disable-mariadb-sdbc \
+        --disable-nss \
         --disable-online-update \
         --disable-opencl \
         --disable-pdfimport \
@@ -5234,7 +5285,9 @@ if test "$cross_compiling" = "yes"; then
     PERMITTED_BUILD_TARGETS="
         AVMEDIA
         BOOST
+        CAIRO
         CLUCENE
+        CURL
         DBCONNECTIVITY
         DESKTOP
         DYNLOADING
@@ -6040,6 +6093,7 @@ if test "$_os" != "WINNT"; then
 fi
 AC_SUBST(AR)
 AC_SUBST(DLLTOOL)
+AC_SUBST(LD)
 AC_SUBST(NM)
 AC_SUBST(OBJDUMP)
 AC_SUBST(PKG_CONFIG)
@@ -9124,6 +9178,9 @@ if test "$with_system_libxml" = "auto"; then
     WINNT|iOS|Android)
         with_system_libxml="$with_system_libs"
         ;;
+    Emscripten)
+        with_system_libxml=no
+        ;;
     *)
         if test "$enable_fuzzers" != "yes"; then
             with_system_libxml=yes
@@ -10110,7 +10167,7 @@ AC_SUBST(SYSTEM_OPENLDAP)
 dnl ===================================================================
 dnl Check for system NSS
 dnl ===================================================================
-if test "$enable_fuzzers" != "yes"; then
+if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
     AC_DEFINE(HAVE_FEATURE_NSS)
     ENABLE_NSS="TRUE"
@@ -11275,6 +11332,8 @@ if test -z "$build_vcl_plugins"; then
     build_vcl_plugins="none"
 fi
 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
+VCL_PLUGIN_INFO=$R
+AC_SUBST([VCL_PLUGIN_INFO])
 
 dnl ===================================================================
 dnl check for dbus support
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 3ded08562211..015d286b1414 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -73,8 +73,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 		./configure \
 			--disable-layout --disable-samples \
 			$(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \
-			$(if $(filter iOS ANDROID,$(OS)),--disable-dyload) \
-			$(if $(filter ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter ENSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--with-data-packaging=static --enable-static --disable-shared --disable-dyload,\
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 435382fa7988..a59d6e8b97d7 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/icu4c-windows-cygwin-cross.patch.1 \
 	external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \
 	$(if $(filter-out ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \
+	external/icu/icu4c-emscripten-cross.patch.1 \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
new file mode 100644
index 000000000000..5935a0169f53
--- /dev/null
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -0,0 +1,102 @@
+--- icu/source/acinclude.m4.orig	2020-04-22 22:04:20.000000000 +0200
++++ icu/source/acinclude.m4	2020-11-04 06:10:29.993070072 +0100
+@@ -84,6 +84,7 @@
+ *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
+ *-*-nto*)	icu_cv_host_frag=mh-qnx ;;
+ *-ncr-*)	icu_cv_host_frag=mh-mpras ;;
++wasm*-*-emscripten*)	icu_cv_host_frag=mh-emscripten ;;
+ *) 		icu_cv_host_frag=mh-unknown ;;
+ esac
+ 		]
+--- /dev/null
++++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
+@@ -0,0 +1,89 @@
++## Emscripten-specific setup
++## Copyright (c) 1999-2013, International Business Machines Corporation and
++## others. All Rights Reserved.
++## Commands to generate dependency files
++GEN_DEPS.c=  $(CC) -E -MM $(DEFS) $(CPPFLAGS)
++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
++ 
++## Flags for position independent code
++SHAREDLIBCFLAGS = -fPIC
++SHAREDLIBCXXFLAGS = -fPIC
++SHAREDLIBCPPFLAGS = -DPIC
++
++## Additional flags when building libraries and with threads
++THREADSCPPFLAGS = -D_REENTRANT
++LIBCPPFLAGS =
++
++## Compiler switch to embed a runtime search path
++LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN
++LD_RPATH_PRE = -Wl,-rpath,
++
++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH:
++ENABLE_RPATH=YES
++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN'
++
++## These are the library specific LDFLAGS
++#LDFLAGSICUDT=-nodefaultlibs -nostdlib
++# Debian change: linking icudata as data only causes too many problems.
++LDFLAGSICUDT=
++
++## Compiler switch to embed a library name
++# The initial tab in the next line is to prevent icu-config from reading it.
++	LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
++#SH# # We can't depend on MIDDLE_SO_TARGET being set.
++#SH# LD_SONAME=
++
++## Shared library options
++LD_SOOPTIONS= -Wl,-Bsymbolic-functions
++
++## Shared object suffix
++SO = so
++## Non-shared intermediate object suffix
++STATIC_O = ao
++
++## Compilation rules
++%.$(STATIC_O): $(srcdir)/%.c
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -o $@ $<)
++%.o: $(srcdir)/%.c
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -o $@ $<)
++
++%.$(STATIC_O): $(srcdir)/%.cpp
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -o $@ $<)
++%.o: $(srcdir)/%.cpp
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -o $@ $<)
++
++
++## Dependency rules
++%.d: $(srcdir)/%.c
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++%.d: $(srcdir)/%.cpp
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++## Versioned libraries rules
++
++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
++	$(RM) $@ && ln -s ${<F} $@
++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
++	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
++
++##  Bind internal references
++
++# LDflags that pkgdata will use
++BIR_LDFLAGS= -Wl,-Bsymbolic
++
++# Dependencies [i.e. map files] for the final library
++BIR_DEPS=
++
++## Remove shared library 's'
++STATIC_PREFIX_WHEN_USED =
++STATIC_PREFIX =
++
++## without assembly
++PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc -w
diff --git a/external/libxml2/ExternalProject_libxml2.mk b/external/libxml2/ExternalProject_libxml2.mk
index 778befade47f..5f19036983ac 100644
--- a/external/libxml2/ExternalProject_libxml2.mk
+++ b/external/libxml2/ExternalProject_libxml2.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_ExternalProject_register_targets,libxml2,\
 	build \
 ))
 
+ifeq ($(OS),EMSCRIPTEN)

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list