[Libreoffice-commits] core.git: Branch 'feature/wasm' - 60 commits - accessibility/Library_acc.mk accessibility/source autogen.sh basic/source bridges/Module_bridges.mk canvas/Module_canvas.mk config_host.mk.in configure.ac connectivity/source cppu/source cpputools/Module_cpputools.mk cui/source dbaccess/source dbaccess/uiconfig desktop/Library_sofficeapp.mk desktop/Module_desktop.mk extensions/Module_extensions.mk external/apr external/boost external/breakpad external/cairo external/coinmp external/cppunit external/curl external/epm external/expat external/firebird external/fontconfig external/freetype external/gpgmepp external/harfbuzz external/hunspell external/hyphen external/icu external/lcms2 external/libabw external/libassuan external/libatomic_ops external/libcdr external/libebook external/libeot external/libepubgen external/libetonyek external/libexttextcat external/libffi external/libfreehand external/libgpg-error external/libjpeg-turbo external/liblangtag external/libmspub external/lib mwaw external/libnumbertext external/libodfgen external/liborcus external/libpagemaker external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwpg external/libwps external/libxml2 external/libxslt external/libzmf external/mythes external/neon external/nss external/openldap external/openssl external/poppler external/postgresql external/python3 external/redland external/serf external/xmlsec .gitignore helpcontent2 i18npool/source icon-themes/elementary icon-themes/elementary_svg include/oox include/osl include/rtl include/sal include/tools include/vcl include/xmloff instsetoo_native/ooenv ios/CustomTarget_iOS_link.mk ios/DISCLAIMER_WARNING ios/.gitignore ios/LibreOfficeLight ios/Module_ios.mk ios/README ios/source onlineupdate/source oox/source README.wasm reportdesign/source RepositoryExternal.mk Repository.mk RepositoryModule_build.mk sal/osl sc/qa scripting/Module_scripting.mk sc/source sc/uiconfig sc/UIConfig_scalc.mk sd/source sd/u iconfig shell/Module_shell.mk solenv/bin solenv/clang-format solenv/gbuild starmath/source stoc/source svl/Library_svl.mk svx/Executable_gengal.mk svx/Module_svx.mk svx/source sw/qa sw/source tools/source unoidl/Executable_unoidl-read.mk vcl/CustomTarget_wasm_native.mk vcl/Executable_ui-previewer.mk vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_qt5.mk vcl/Module_vcl.mk vcl/qa vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/wasm wizards/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
Tue Dec 22 10:34:04 UTC 2020


Rebased ref, commits from common ancestor:
commit 5beb57fafcc1d6cd26bdff4936e4f5f1e55cf2f8
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 22 10:58:27 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Dec 22 11:27:37 2020 +0100

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

diff --git a/README.wasm b/README.wasm
index f7b71fe33db4..596aeb137d12 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,23 +1,21 @@
 = Status =
 
-$ make cross-toolset
-$ make vcl.all
+$ make
 
 > instdir/program/ui-previewer.html
 
-Plain make vcl.all may still have dependency problems. But a general
-make currently fails with a template problem in sc. The ui-previewer
-"binary" will "crash" with memory alignment problems.
+The ui-previewer "binary" will "crash" with memory alignment problems.
 
 
 = Setup for the LO WASM build (with Qt) =
 
 We're using Qt 5.15 with the officially supported emscripten v1.39.8.
 But there are several potential problems with threads and exceptions, so this will likely
-change later zo a newer emscripten.
+change later to a newer emscripten.
 
 Qt WASM is not yet used with LO, just if you're wondering!
 
+
 == Setup emscripten ==
 
 https://emscripten.org/docs/getting_started/index.html
@@ -31,19 +29,6 @@ Example bashrc scriptlet:
 EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
 [ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
 
-Before cleaning up all configure calls, I patched git_emsdk/upstream/emscripten/emcc.py for cpp:
-
-+++ git_emsdk/upstream/emscripten/emcc.py
-@@ -707,7 +707,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
- 
-   # If this is a configure-type thing, do not compile to JavaScript, instead use clang
-   # to compile to a native binary (using our headers, so things make sense later)
--  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or 'conftest.c' in args) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
-+  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or ('conftest.' + ext in args for ext in ['c', 'cpp'])) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
-   CMAKE_CONFIG = 'CMakeFiles/cmTryCompileExec.dir' in ' '.join(args)# or 'CMakeCCompilerId' in ' '.join(args)
-   if CONFIGURE_CONFIG or CMAKE_CONFIG:
-     # XXX use this to debug configure stuff. ./configure's generally hide our
-
 
 == Setup Qt ==
 
@@ -140,6 +125,24 @@ hours. Maybe I'll open an Emscripten issue, if we really have to implement
 this.
 
 
+= Workaround for eventual clang WASM compiler bug =
+
+sc/source/core/data/attarray.cxx:378:44: error: call to member function 'erase' is ambiguous
+                        aNewCondFormatData.erase(nIndex);
+                        ~~~~~~~~~~~~~~~~~~~^~~~~
+include/o3tl/sorted_vector.hxx:86:15: note: candidate function
+    size_type erase( const Value& x )
+              ^
+include/o3tl/sorted_vector.hxx:97:10: note: candidate function
+    void erase( size_t index )
+
+This is currently patched by using x.erase(x.begin() + nIndex).
+
+There shouldn't be an ambiguity, because of "[WebAssembly] Change size_t to `unsigned long`."
+(https://reviews.llvm.org/rGdf07a35912d78781ed6a62a7c032bfef5085a4f5#change-IrS9f6jH6PFq),
+from "Jul 23 2018" which pre-dates the emscripten tag 1.39.8 from 02/14/2020 by ~1.5y.
+
+
 = Tools for problem diagnosis =
 
 * nm -s should list the symbols in the archive, based on the index generated by ranlib.
diff --git a/autogen.sh b/autogen.sh
index 54cc7e6262c8..bef1f7faf561 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -295,15 +295,21 @@ if (defined $ENV{NOCONFIGURE}) {
     push @args, "--srcdir=$src_path";
     push @args, "--enable-option-checking=$option_checking";
 
-    print "Running ./configure with '" . join (" ", @args), "'\n";
-
     # When running a shell script from Perl on WSL, weirdly named
     # environment variables like the "ProgramFiles(x86)" one don't get
     # imported by the shell. So export it as PROGRAMFILESX86 instead.
     my $building_for_linux = 0;
+    my $building_with_emscripten = 0;
     foreach my $arg (@args) {
         $building_for_linux = 1 if ($arg =~ /--host=x86_64.*linux/);
+        $building_with_emscripten = 1 if ($arg =~ /^--host=wasm.*-emscripten$/);
     }
+
+    unshift @args, "./configure";
+    unshift @args, "emconfigure" if ($building_with_emscripten);
+
+    print "Running '" . join (" ", @args), "'\n";
+
     if (`wslsys 2>/dev/null` ne "" && !$building_for_linux) {
         if (!$ENV{"ProgramFiles(x86)"}) {
             print STDERR "To build for Windows on WSL, you need to set the WSLENV environment variable in the Control Panel to 'ProgramFiles(x86)'\n";
@@ -313,7 +319,7 @@ if (defined $ENV{NOCONFIGURE}) {
         $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
     }
 
-    system ("emconfigure", "./configure", @args) && die "Error running configure";
+    system (@args) && die "Error running configure";
 }
 
 # Local Variables:
diff --git a/configure.ac b/configure.ac
index af9944041109..5e2502e9014e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1110,7 +1110,7 @@ haiku*)
     _os=Haiku
     ;;
 
-emscripten*)
+emscripten)
     build_gstreamer_1_0=no
     enable_lpsolve=no
     enable_report_builder=no
@@ -1283,10 +1283,24 @@ if test $_os != "WINNT"; then
 fi
 AC_SUBST(DLOPEN_LIBS)
 
-AC_ARG_ENABLE(ios-simulator,
-    AS_HELP_STRING([--enable-ios-simulator],
-        [build for iOS simulator])
-)
+dnl ===================================================================
+dnl Sanity checks for Emscripten SDK setup
+dnl ===================================================================
+
+if test "$_os" = "Emscripten"; then
+    EMSCRIPTEN_ERROR=0
+    if ! which emconfigure >/dev/null 2>&1; then
+        AC_MSG_WARN([emconfigure must be in your \$PATH])
+        EMSCRIPTEN_ERROR=1
+    fi
+    if test -z "$EMMAKEN_JUST_CONFIGURE"; then
+	AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
+        EMSCRIPTEN_ERROR=1
+    fi
+    if test $EMSCRIPTEN_ERROR -ne 0; then
+        AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
+    fi
+fi
 
 ###############################################################################
 # Extensions switches --enable/--disable
@@ -1301,6 +1315,11 @@ AC_ARG_ENABLE(ios-simulator,
 # if you use --disable-extension-integration. Is that really the
 # case?
 
+AC_ARG_ENABLE(ios-simulator,
+    AS_HELP_STRING([--enable-ios-simulator],
+        [build for iOS simulator])
+)
+
 libo_FUZZ_ARG_ENABLE(extension-integration,
     AS_HELP_STRING([--disable-extension-integration],
         [Disable integration of the built extensions in the installer of the
@@ -2620,6 +2639,8 @@ AC_ARG_WITH(onedrive-client-secret,
         authentication on OneDrive. If either this or
         --with-onedrive-client-id is empty, the feature will be disabled]),
 )
+
+
 dnl ===================================================================
 dnl Do we want to use pre-build binary tarball for recompile
 dnl ===================================================================
diff --git a/external/apr/ExternalProject_apr.mk b/external/apr/ExternalProject_apr.mk
index 1c94480e5ab7..7f3a631e933e 100644
--- a/external/apr/ExternalProject_apr.mk
+++ b/external/apr/ExternalProject_apr.mk
@@ -30,7 +30,7 @@ $(call gb_ExternalProject_get_state_target,apr,build):
 	$(call gb_Trace_StartRange,apr,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
 		 $(if $(ENABLE_MACOSX_SANDBOX),ac_cv_func_fdatasync=no) \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--enable-static --disable-shared \
 			--with-pic \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
diff --git a/external/apr/ExternalProject_apr_util.mk b/external/apr/ExternalProject_apr_util.mk
index a311f32e8e01..a94b0e38d43b 100644
--- a/external/apr/ExternalProject_apr_util.mk
+++ b/external/apr/ExternalProject_apr_util.mk
@@ -31,7 +31,7 @@ else
 $(call gb_ExternalProject_get_state_target,apr_util,build):
 	$(call gb_Trace_StartRange,apr_util,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--enable-static --disable-shared \
 			--with-pic \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
diff --git a/external/breakpad/ExternalProject_breakpad.mk b/external/breakpad/ExternalProject_breakpad.mk
index 9e7e72485849..56a7be987837 100644
--- a/external/breakpad/ExternalProject_breakpad.mk
+++ b/external/breakpad/ExternalProject_breakpad.mk
@@ -21,7 +21,7 @@ else # !ifeq($(COM),MSC)
 $(call gb_ExternalProject_get_state_target,breakpad,build) :
 	$(call gb_Trace_StartRange,breakpad,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \
+		$(gb_RUN_CONFIGURE) ./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \
 		&& $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,breakpad,EXTERNAL)
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 59232c9d16be..1f9b2982c6d5 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -65,10 +65,10 @@ else
 $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_Trace_StartRange,cairo,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	./configure \
+	$(gb_RUN_CONFIGURE) ./configure \
 		$(if $(debug),STRIP=" ") \
 		$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="" EMMAKEN_JUST_CONFIGURE=1) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="") \
 		$(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
 		$(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
 		LIBS="$(ZLIB_LIBS)" \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index 00b61170ff77..03dffbd01312 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -34,7 +34,7 @@ else
 $(call gb_ExternalProject_get_state_target,pixman,build) :
 	$(call gb_Trace_StartRange,pixman,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
 		$(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
diff --git a/external/coinmp/ExternalProject_coinmp.mk b/external/coinmp/ExternalProject_coinmp.mk
index e1484e656619..9bd5a4cd2685 100644
--- a/external/coinmp/ExternalProject_coinmp.mk
+++ b/external/coinmp/ExternalProject_coinmp.mk
@@ -29,7 +29,7 @@ else
 $(call gb_ExternalProject_get_state_target,coinmp,build) :
 	$(call gb_Trace_StartRange,coinmp,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
-		./configure COIN_SKIP_PROJECTS="Data/Sample" \
+		$(gb_RUN_CONFIGURE) ./configure COIN_SKIP_PROJECTS="Data/Sample" \
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(DISABLE_DYNLOADING),--disable-shared) \
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
index 1c5ac725af59..63116af294d1 100644
--- a/external/cppunit/ExternalProject_cppunit.mk
+++ b/external/cppunit/ExternalProject_cppunit.mk
@@ -43,7 +43,7 @@ endif
 $(call gb_ExternalProject_get_state_target,cppunit,build) :
 	$(call gb_Trace_StartRange,cppunit,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-dependency-tracking \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
 			--disable-doxygen \
diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk
index 138b50afd0e0..11d1fcc57d4a 100644
--- a/external/curl/ExternalProject_curl.mk
+++ b/external/curl/ExternalProject_curl.mk
@@ -40,7 +40,7 @@ endif
 $(call gb_ExternalProject_get_state_target,curl,build):
 	$(call gb_Trace_StartRange,curl,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			$(if $(filter iOS MACOSX,$(OS)),\
 				--with-darwinssl,\
 				$(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \
diff --git a/external/epm/ExternalProject_epm.mk b/external/epm/ExternalProject_epm.mk
index 68a61a78a744..7b0dde219e4b 100644
--- a/external/epm/ExternalProject_epm.mk
+++ b/external/epm/ExternalProject_epm.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,epm,\
 $(call gb_ExternalProject_get_state_target,epm,build) :
 	$(call gb_Trace_StartRange,epm,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-fltk \
+		$(gb_RUN_CONFIGURE) ./configure --disable-fltk \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \
 		&& $(MAKE) \
 		&& touch $@ \
diff --git a/external/expat/ExternalProject_expat.mk b/external/expat/ExternalProject_expat.mk
index 4f4f0301c1bc..b69e6544f55f 100644
--- a/external/expat/ExternalProject_expat.mk
+++ b/external/expat/ExternalProject_expat.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,expat,\
 $(call gb_ExternalProject_get_state_target,expat,configure) :
 	$(call gb_Trace_StartRange,expat,EXTERNAL)
 	$(call gb_ExternalProject_run,configure,\
-		./configure --without-docbook \
+		$(gb_RUN_CONFIGURE) ./configure --without-docbook \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 			$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
 	,,expat_configure.log)
diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk
index 0a1706031746..16da68b97866 100644
--- a/external/firebird/ExternalProject_firebird.mk
+++ b/external/firebird/ExternalProject_firebird.mk
@@ -66,7 +66,7 @@ $(call gb_ExternalProject_get_state_target,firebird,build):
 		" \
 		&& export LIBREOFFICE_ICU_LIB="$(call gb_UnpackedTarball_get_dir,icu)/source/lib" \
 		&& export MSVC_USE_INDIVIDUAL_PDBS=TRUE \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--without-editline \
 			--with-wire-compress=no \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk
index 14190675427a..fdcb80a38363 100644
--- a/external/fontconfig/ExternalProject_fontconfig.mk
+++ b/external/fontconfig/ExternalProject_fontconfig.mk
@@ -22,7 +22,7 @@ $(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 EMSCRIPTEN,$(OS)),-pthread)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-shared \
 			--disable-silent-rules \
 			$(if $(filter ANDROID,$(OS)),--with-arch=arm) \
diff --git a/external/freetype/ExternalProject_freetype.mk b/external/freetype/ExternalProject_freetype.mk
index 3f4a719d5663..8b49abbab13a 100644
--- a/external/freetype/ExternalProject_freetype.mk
+++ b/external/freetype/ExternalProject_freetype.mk
@@ -25,7 +25,7 @@ else
 $(call gb_ExternalProject_get_state_target,freetype,build) :
 	$(call gb_Trace_StartRange,freetype,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-shared \
 			--without-zlib \
 			--without-bzip2 \
diff --git a/external/gpgmepp/ExternalProject_gpgmepp.mk b/external/gpgmepp/ExternalProject_gpgmepp.mk
index 1ba51cfb3bce..92348e426c80 100644
--- a/external/gpgmepp/ExternalProject_gpgmepp.mk
+++ b/external/gpgmepp/ExternalProject_gpgmepp.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_
 	$(call gb_ExternalProject_run,build, \
 		$(gb_WIN_GPG_cross_setup_exports) \
 		&& autoreconf \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 		   --disable-shared \
 		   --disable-languages \
 		   --disable-gpgconf-test \
@@ -48,7 +48,7 @@ $(call gb_ExternalProject_get_state_target,gpgmepp,build):
 	$(call gb_Trace_StartRange,gpgmepp,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		autoreconf \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 		   --disable-gpgconf-test \
 		   --disable-gpg-test \
 		   --disable-gpgsm-test \
diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk b/external/harfbuzz/ExternalProject_harfbuzz.mk
index 7219d402df3c..caf6bcd5f922 100644
--- a/external/harfbuzz/ExternalProject_harfbuzz.mk
+++ b/external/harfbuzz/ExternalProject_harfbuzz.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
 		$(if $(SYSTEM_ICU),,ICU_CONFIG=$(SRCDIR)/external/icu/cross-bin/icu-config) \
 		GRAPHITE2_CFLAGS="$(GRAPHITE_CFLAGS)" \
 		GRAPHITE2_LIBS="$(GRAPHITE_LIBS)" \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--enable-static \
 			--disable-shared \
 			--disable-gtk-doc \
diff --git a/external/hunspell/ExternalProject_hunspell.mk b/external/hunspell/ExternalProject_hunspell.mk
index 43da1c254e34..09a0680367fb 100644
--- a/external/hunspell/ExternalProject_hunspell.mk
+++ b/external/hunspell/ExternalProject_hunspell.mk
@@ -24,7 +24,7 @@ endif
 $(call gb_ExternalProject_get_state_target,hunspell,build):
 	$(call gb_Trace_StartRange,hunspell,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-shared --disable-nls --with-pic \
+		$(gb_RUN_CONFIGURE) ./configure --disable-shared --disable-nls --with-pic \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
 			$(if $(filter AIX,$(OS)),CFLAGS="-D_LINUX_SOURCE_COMPAT") \
 			$(if $(hunspell_CPPFLAGS),CPPFLAGS='$(hunspell_CPPFLAGS)') \
diff --git a/external/hyphen/ExternalProject_hyphen.mk b/external/hyphen/ExternalProject_hyphen.mk
index 21cef66d85d0..63d167f7804b 100644
--- a/external/hyphen/ExternalProject_hyphen.mk
+++ b/external/hyphen/ExternalProject_hyphen.mk
@@ -18,7 +18,7 @@ $(eval $(call gb_ExternalProject_register_targets,hyphen,\
 $(call gb_ExternalProject_get_state_target,hyphen,build):
 	$(call gb_Trace_StartRange,hyphen,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-shared \
+		$(gb_RUN_CONFIGURE) ./configure --disable-shared \
 			$(if $(filter-out iOS,$(OS)),--with-pic) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) gio_can_sniff=no) \
 		&& $(MAKE) \
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 0c8a7047ec01..59a98581bc01 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -25,7 +25,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 			gb_ICU_XFLAGS="-FS $(SOLARINC) $(gb_DEBUGINFO_FLAGS) $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD -Gy)" \
 		&& CFLAGS="$${gb_ICU_XFLAGS}" CPPFLAGS="$(SOLARINC)" CXXFLAGS="$${gb_ICU_XFLAGS}" \
 			INSTALL=`cygpath -m /usr/bin/install` $(if $(MSVC_USE_DEBUG_RUNTIME),LDFLAGS="-DEBUG") \
-			./configure \
+			$(gb_RUN_CONFIGURE) ./configure \
 				$(if $(MSVC_USE_DEBUG_RUNTIME),--enable-debug --disable-release) \
 				$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 					--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \
@@ -70,7 +70,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 		CPPFLAGS=$(icu_CPPFLAGS) CFLAGS=$(icu_CFLAGS) \
 		CXXFLAGS=$(icu_CXXFLAGS) LDFLAGS=$(icu_LDFLAGS) \
 		PYTHONWARNINGS="default" \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-layout --disable-samples \
 			$(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \
 			$(if $(filter EMSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
diff --git a/external/lcms2/ExternalProject_lcms2.mk b/external/lcms2/ExternalProject_lcms2.mk
index 4bed4a5b705d..35dce1bcc03e 100644
--- a/external/lcms2/ExternalProject_lcms2.mk
+++ b/external/lcms2/ExternalProject_lcms2.mk
@@ -27,7 +27,7 @@ else
 $(call gb_ExternalProject_get_state_target,lcms2,build):
 	$(call gb_Trace_StartRange,lcms2,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --without-jpeg --without-tiff --with-pic \
+		$(gb_RUN_CONFIGURE) ./configure --without-jpeg --without-tiff --with-pic \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 			$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
 			CPPFLAGS=" $(SOLARINC)" \
diff --git a/external/libabw/ExternalProject_libabw.mk b/external/libabw/ExternalProject_libabw.mk
index 50e66fdb76ca..a21835062b90 100644
--- a/external/libabw/ExternalProject_libabw.mk
+++ b/external/libabw/ExternalProject_libabw.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,libabw,build) :
 	$(call gb_Trace_StartRange,libabw,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libassuan/ExternalProject_libassuan.mk b/external/libassuan/ExternalProject_libassuan.mk
index e4e24aeac7fd..8ee96826cd69 100644
--- a/external/libassuan/ExternalProject_libassuan.mk
+++ b/external/libassuan/ExternalProject_libassuan.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,libassuan,build): $(call gb_Executabl
 	$(call gb_ExternalProject_run,build,\
 	  $(gb_WIN_GPG_cross_setup_exports) \
 	  && autoreconf \
-	  && ./configure \
+	  && $(gb_RUN_CONFIGURE) ./configure \
 		--enable-static \
 		--disable-shared \
 		--disable-doc \
@@ -44,7 +44,7 @@ $(call gb_ExternalProject_get_state_target,libassuan,build):
 	$(call gb_Trace_StartRange,libassuan,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		autoreconf \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 		   --disable-doc \
 		   GPG_ERROR_CFLAGS="$(GPG_ERROR_CFLAGS)" \
 		   GPG_ERROR_LIBS="$(GPG_ERROR_LIBS)" \
diff --git a/external/libatomic_ops/ExternalProject_libatomic_ops.mk b/external/libatomic_ops/ExternalProject_libatomic_ops.mk
index 20cefa39b4fe..47f2da68c005 100644
--- a/external/libatomic_ops/ExternalProject_libatomic_ops.mk
+++ b/external/libatomic_ops/ExternalProject_libatomic_ops.mk
@@ -19,7 +19,7 @@ $(call gb_ExternalProject_get_state_target,libatomic_ops,build) :
 	$(call gb_Trace_StartRange,libatomic_ops,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),CFLAGS="$(CFLAGS) $(gb_VISIBILITY_FLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS))" CXXFLAGS="$(CXXFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS))") \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 		&& $(MAKE) \
 	)
diff --git a/external/libcdr/ExternalProject_libcdr.mk b/external/libcdr/ExternalProject_libcdr.mk
index b3e78f469cbf..48a21afd24a4 100644
--- a/external/libcdr/ExternalProject_libcdr.mk
+++ b/external/libcdr/ExternalProject_libcdr.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,libcdr,build) :
 	$(call gb_Trace_StartRange,libcdr,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libebook/ExternalProject_libebook.mk b/external/libebook/ExternalProject_libebook.mk
index 8ee2c7293e11..15c9689b3cbd 100644
--- a/external/libebook/ExternalProject_libebook.mk
+++ b/external/libebook/ExternalProject_libebook.mk
@@ -28,7 +28,7 @@ $(call gb_ExternalProject_get_state_target,libebook,build) :
 	$(call gb_Trace_StartRange,libebook,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libeot/ExternalProject_libeot.mk b/external/libeot/ExternalProject_libeot.mk
index 75e8054a0a4c..98c7d2eb403d 100644
--- a/external/libeot/ExternalProject_libeot.mk
+++ b/external/libeot/ExternalProject_libeot.mk
@@ -18,7 +18,7 @@ $(call gb_ExternalProject_get_state_target,libeot,build) :
 	$(call gb_ExternalProject_run,build,\
 		touch Makefile.in \
 		&& export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libepubgen/ExternalProject_libepubgen.mk b/external/libepubgen/ExternalProject_libepubgen.mk
index 54a9a3d68bdc..096f0f6e534b 100644
--- a/external/libepubgen/ExternalProject_libepubgen.mk
+++ b/external/libepubgen/ExternalProject_libepubgen.mk
@@ -24,7 +24,7 @@ $(call gb_ExternalProject_get_state_target,libepubgen,build) :
 	$(call gb_Trace_StartRange,libepubgen,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libetonyek/ExternalProject_libetonyek.mk b/external/libetonyek/ExternalProject_libetonyek.mk
index 0eabfe5f4ffb..14773214be48 100644
--- a/external/libetonyek/ExternalProject_libetonyek.mk
+++ b/external/libetonyek/ExternalProject_libetonyek.mk
@@ -29,7 +29,7 @@ $(call gb_ExternalProject_get_state_target,libetonyek,build) :
 	$(call gb_Trace_StartRange,libetonyek,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/libexttextcat/ExternalProject_libexttextcat.mk b/external/libexttextcat/ExternalProject_libexttextcat.mk
index 1d729a103b33..e73948e68fb2 100644
--- a/external/libexttextcat/ExternalProject_libexttextcat.mk
+++ b/external/libexttextcat/ExternalProject_libexttextcat.mk
@@ -16,7 +16,7 @@ $(eval $(call gb_ExternalProject_register_targets,libexttextcat,\
 $(call gb_ExternalProject_get_state_target,libexttextcat,build):
 	$(call gb_Trace_StartRange,libexttextcat,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-shared --with-pic \
+		$(gb_RUN_CONFIGURE) ./configure --disable-shared --with-pic \
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			$(if $(ENABLE_WERROR),--enable-werror,--disable-werror) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
diff --git a/external/libffi/ExternalProject_libffi.mk b/external/libffi/ExternalProject_libffi.mk
index c9c89828768c..621867ef6120 100644
--- a/external/libffi/ExternalProject_libffi.mk
+++ b/external/libffi/ExternalProject_libffi.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,libffi,build):
 	$(call gb_Trace_StartRange,libffi,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export LIB="$(ILIB)" && \
-		MAKE=$(MAKE) ./configure \
+		MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--enable-option-checking=fatal \
 			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 			$(if $(filter LINUX,$(OS)), \
diff --git a/external/libfreehand/ExternalProject_libfreehand.mk b/external/libfreehand/ExternalProject_libfreehand.mk
index be3a478485aa..09f8187a08a3 100644
--- a/external/libfreehand/ExternalProject_libfreehand.mk
+++ b/external/libfreehand/ExternalProject_libfreehand.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,libfreehand,build) :
 	$(call gb_Trace_StartRange,libfreehand,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libgpg-error/ExternalProject_libgpg-error.mk b/external/libgpg-error/ExternalProject_libgpg-error.mk
index 736079c77aec..0bcd9d5f7bbc 100644
--- a/external/libgpg-error/ExternalProject_libgpg-error.mk
+++ b/external/libgpg-error/ExternalProject_libgpg-error.mk
@@ -20,7 +20,7 @@ $(call gb_ExternalProject_get_state_target,libgpg-error,build): $(call gb_Execut
 	$(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		$(gb_WIN_GPG_cross_setup_exports) \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--enable-static \
 			--disable-shared \
 			--disable-rpath \
@@ -35,7 +35,7 @@ else
 $(call gb_ExternalProject_get_state_target,libgpg-error,build):
 	$(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		MAKE=$(MAKE) ./configure \
+		MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--disable-rpath \
 			--disable-languages \
 			--disable-doc \
diff --git a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
index a5cd4c57ddc7..c5e0556748b4 100644
--- a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
+++ b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,libjpeg-turbo,build) : $(call gb_Exte
 $(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) :
 	$(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL)
 	$(call gb_ExternalProject_run,configure,\
-		MAKE=$(MAKE) ./configure \
+		MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--build=$(BUILD_PLATFORM) \
 			--host=$(HOST_PLATFORM) \
 			--with-pic \
diff --git a/external/liblangtag/ExternalProject_liblangtag.mk b/external/liblangtag/ExternalProject_liblangtag.mk
index b45615e86ff0..7c52820286cb 100644
--- a/external/liblangtag/ExternalProject_liblangtag.mk
+++ b/external/liblangtag/ExternalProject_liblangtag.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_ExternalProject_register_targets,liblangtag,\
 $(call gb_ExternalProject_get_state_target,liblangtag,build):
 	$(call gb_Trace_StartRange,liblangtrag,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		MAKE=$(MAKE) ./configure --disable-modules --disable-test --disable-introspection --with-pic \
+		MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure --disable-modules --disable-test --disable-introspection --with-pic \
 		$(if $(or $(DISABLE_DYNLOADING),$(filter MSC,$(COM))), \
 			--disable-shared --enable-static, \
 			--enable-shared --disable-static) \
diff --git a/external/libmspub/ExternalProject_libmspub.mk b/external/libmspub/ExternalProject_libmspub.mk
index 21121f091279..82bc4132f23b 100644
--- a/external/libmspub/ExternalProject_libmspub.mk
+++ b/external/libmspub/ExternalProject_libmspub.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,libmspub,build) :
 	$(call gb_Trace_StartRange,libmspub,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libmwaw/ExternalProject_libmwaw.mk b/external/libmwaw/ExternalProject_libmwaw.mk
index 067de69002bd..0fc2cc4e3958 100644
--- a/external/libmwaw/ExternalProject_libmwaw.mk
+++ b/external/libmwaw/ExternalProject_libmwaw.mk
@@ -23,7 +23,7 @@ $(call gb_ExternalProject_get_state_target,libmwaw,build) :
 	$(call gb_Trace_StartRange,libmwaw,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/libnumbertext/ExternalProject_libnumbertext.mk b/external/libnumbertext/ExternalProject_libnumbertext.mk
index f4dbe5f655c3..3094351aebf2 100644
--- a/external/libnumbertext/ExternalProject_libnumbertext.mk
+++ b/external/libnumbertext/ExternalProject_libnumbertext.mk
@@ -28,7 +28,7 @@ $(call gb_ExternalProject_get_state_target,libnumbertext,build):
 	$(call gb_Trace_StartRange,libnumbertext,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		LIBS="$(gb_STDLIBS) $(LIBS)" \
-		$(SHELL) ./configure --disable-shared --with-pic \
+		$(SHELL) $(gb_RUN_CONFIGURE) ./configure --disable-shared --with-pic \
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			$(if $(ENABLE_WERROR),--enable-werror,--disable-werror) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
diff --git a/external/libodfgen/ExternalProject_libodfgen.mk b/external/libodfgen/ExternalProject_libodfgen.mk
index 679598542b30..bdc341768241 100644
--- a/external/libodfgen/ExternalProject_libodfgen.mk
+++ b/external/libodfgen/ExternalProject_libodfgen.mk
@@ -23,7 +23,7 @@ $(call gb_ExternalProject_get_state_target,libodfgen,build) :
 	$(call gb_Trace_StartRange,libodfgen,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk
index c2a8cdcbe4a3..e7dd23b7d5ba 100644
--- a/external/liborcus/ExternalProject_liborcus.mk
+++ b/external/liborcus/ExternalProject_liborcus.mk
@@ -99,7 +99,7 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
 		$(if $(liborcus_LDFLAGS),LDFLAGS='$(liborcus_LDFLAGS)') \
 		MDDS_CFLAGS='$(MDDS_CFLAGS)' \
 		MDDS_LIBS=' ' \
-		MAKE=$(MAKE) ./configure \
+		MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/libpagemaker/ExternalProject_libpagemaker.mk b/external/libpagemaker/ExternalProject_libpagemaker.mk
index 34254b872713..ca74086b5a2a 100644
--- a/external/libpagemaker/ExternalProject_libpagemaker.mk
+++ b/external/libpagemaker/ExternalProject_libpagemaker.mk
@@ -24,7 +24,7 @@ $(call gb_ExternalProject_get_state_target,libpagemaker,build) :
 	$(call gb_Trace_StartRange,libpagemaker,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libqxp/ExternalProject_libqxp.mk b/external/libqxp/ExternalProject_libqxp.mk
index f1b63f6bfa38..f428693126aa 100644
--- a/external/libqxp/ExternalProject_libqxp.mk
+++ b/external/libqxp/ExternalProject_libqxp.mk
@@ -25,7 +25,7 @@ $(call gb_ExternalProject_get_state_target,libqxp,build) :
 	$(call gb_Trace_StartRange,libqxp,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/librevenge/ExternalProject_librevenge.mk b/external/librevenge/ExternalProject_librevenge.mk
index 7c3e36761e22..9bc9141b1fc5 100644
--- a/external/librevenge/ExternalProject_librevenge.mk
+++ b/external/librevenge/ExternalProject_librevenge.mk
@@ -23,7 +23,7 @@ $(call gb_ExternalProject_get_state_target,librevenge,build) :
 	$(call gb_Trace_StartRange,librevenge,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--disable-shared --enable-static, \
diff --git a/external/libstaroffice/ExternalProject_libstaroffice.mk b/external/libstaroffice/ExternalProject_libstaroffice.mk
index 8aad471e5d24..3d264a75498a 100644
--- a/external/libstaroffice/ExternalProject_libstaroffice.mk
+++ b/external/libstaroffice/ExternalProject_libstaroffice.mk
@@ -23,7 +23,7 @@ $(call gb_ExternalProject_get_state_target,libstaroffice,build) :
 	$(call gb_Trace_StartRange,libstaroffice,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/libvisio/ExternalProject_libvisio.mk b/external/libvisio/ExternalProject_libvisio.mk
index 0911fcd87c7c..b1bda8770ead 100644
--- a/external/libvisio/ExternalProject_libvisio.mk
+++ b/external/libvisio/ExternalProject_libvisio.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,libvisio,build) :
 	$(call gb_Trace_StartRange,libvisio,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/libwpd/ExternalProject_libwpd.mk b/external/libwpd/ExternalProject_libwpd.mk
index c3b810c6acd7..bae99dcdfbc2 100644
--- a/external/libwpd/ExternalProject_libwpd.mk
+++ b/external/libwpd/ExternalProject_libwpd.mk
@@ -24,7 +24,7 @@ $(call gb_ExternalProject_get_state_target,libwpd,build) :
 	$(call gb_Trace_StartRange,libwpd,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--disable-shared --enable-static, \
diff --git a/external/libwpg/ExternalProject_libwpg.mk b/external/libwpg/ExternalProject_libwpg.mk
index 01f31c55d771..e6dd423b92c2 100644
--- a/external/libwpg/ExternalProject_libwpg.mk
+++ b/external/libwpg/ExternalProject_libwpg.mk
@@ -24,7 +24,7 @@ $(call gb_ExternalProject_get_state_target,libwpg,build) :
 	$(call gb_Trace_StartRange,libwpg,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--disable-shared --enable-static, \
diff --git a/external/libwps/ExternalProject_libwps.mk b/external/libwps/ExternalProject_libwps.mk
index 0bcfc5ceb72d..12e3c8719a47 100644
--- a/external/libwps/ExternalProject_libwps.mk
+++ b/external/libwps/ExternalProject_libwps.mk
@@ -46,7 +46,7 @@ $(call gb_ExternalProject_get_state_target,libwps,build) :
 	$(call gb_Trace_StartRange,libwps,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
 				--enable-static --disable-shared \
diff --git a/external/libxml2/ExternalProject_libxml2.mk b/external/libxml2/ExternalProject_libxml2.mk
index 5f19036983ac..77d040b4b2c5 100644
--- a/external/libxml2/ExternalProject_libxml2.mk
+++ b/external/libxml2/ExternalProject_libxml2.mk
@@ -35,7 +35,7 @@ else # OS!=WNT
 $(call gb_ExternalProject_get_state_target,libxml2,build):
 	$(call gb_Trace_StartRange,libxml2,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --disable-ipv6 --without-python --without-zlib --with-sax1 \
+		$(gb_RUN_CONFIGURE) ./configure --disable-ipv6 --without-python --without-zlib --with-sax1 \
 			--without-lzma \
 			$(if $(debug),--with-run-debug) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
diff --git a/external/libxslt/ExternalProject_libxslt.mk b/external/libxslt/ExternalProject_libxslt.mk
index 0602c320ea7d..21c53f340714 100644
--- a/external/libxslt/ExternalProject_libxslt.mk
+++ b/external/libxslt/ExternalProject_libxslt.mk
@@ -32,7 +32,7 @@ else # OS!=WNT
 $(call gb_ExternalProject_get_state_target,libxslt,build):
 	$(call gb_Trace_StartRange,libxslt,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure --without-crypto --without-python \
+		$(gb_RUN_CONFIGURE) ./configure --without-crypto --without-python \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
 			LDFLAGS="$(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN" -Wl$(COMMA)-noinhibit-exec) \
diff --git a/external/libzmf/ExternalProject_libzmf.mk b/external/libzmf/ExternalProject_libzmf.mk
index c6593899f2c0..695cb2ee5d34 100644
--- a/external/libzmf/ExternalProject_libzmf.mk
+++ b/external/libzmf/ExternalProject_libzmf.mk
@@ -27,7 +27,7 @@ $(call gb_ExternalProject_get_state_target,libzmf,build) :
 	$(call gb_Trace_StartRange,libzmf,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
-		&& MAKE=$(MAKE) ./configure \
+		&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
diff --git a/external/mythes/ExternalProject_mythes.mk b/external/mythes/ExternalProject_mythes.mk
index b352e9b594d3..298607f0aa73 100644
--- a/external/mythes/ExternalProject_mythes.mk
+++ b/external/mythes/ExternalProject_mythes.mk
@@ -18,7 +18,7 @@ $(eval $(call gb_ExternalProject_register_targets,mythes,\
 $(call gb_ExternalProject_get_state_target,mythes,build):
 	$(call gb_Trace_StartRange,mythes,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		LIBS="$(gb_STDLIBS) $(LIBS)" ./configure --disable-shared --with-pic \
+		LIBS="$(gb_STDLIBS) $(LIBS)" $(gb_RUN_CONFIGURE) ./configure --disable-shared --with-pic \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) gio_can_sniff=no) \
 		&& $(MAKE) \
 	)
diff --git a/external/openldap/ExternalProject_openldap.mk b/external/openldap/ExternalProject_openldap.mk
index 46e9168f5a91..8a102d0028a9 100644
--- a/external/openldap/ExternalProject_openldap.mk
+++ b/external/openldap/ExternalProject_openldap.mk
@@ -29,7 +29,7 @@ endif
 $(call gb_ExternalProject_get_state_target,openldap,build) :
 	$(call gb_Trace_StartRange,openldap,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-slapd \
 			--with-pic \
 			--with-tls=moznss \
diff --git a/external/postgresql/ExternalProject_postgresql.mk b/external/postgresql/ExternalProject_postgresql.mk
index 39515fbc977d..f37b0fdffb99 100644
--- a/external/postgresql/ExternalProject_postgresql.mk
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -61,7 +61,7 @@ endif
 $(call gb_ExternalProject_get_state_target,postgresql,build) :
 	$(call gb_Trace_StartRange,postgresql,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--without-readline --disable-shared --with-ldap \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(ENABLE_OPENSSL),--with-openssl \
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 713e4bf9b1e6..092557da65d4 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -84,7 +84,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 				ac_cv_func_clock_gettime=no \
 			) \
 		) \
-		./configure \
+		$(gb_RUN_CONFIGURE) ./configure \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 		$(if $(ENABLE_VALGRIND),--with-valgrind) \
 		$(if $(ENABLE_DBGUTIL),--with-pydebug) \
diff --git a/external/redland/ExternalProject_raptor.mk b/external/redland/ExternalProject_raptor.mk
index 4bc91c375b85..ea14077f3029 100644
--- a/external/redland/ExternalProject_raptor.mk
+++ b/external/redland/ExternalProject_raptor.mk
@@ -25,7 +25,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build):
 			$(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
 			$(if $(SYSBASE),$(if $(filter LINUX SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
 		CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include)" \
-		./configure --disable-gtk-doc \
+		$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
 			 --enable-parsers="rdfxml ntriples turtle trig guess rss-tag-soup" \
 			--with-www=xml \
 			--without-xslt-config \
diff --git a/external/redland/ExternalProject_rasqal.mk b/external/redland/ExternalProject_rasqal.mk
index 0e765e098eb9..5348e37294a9 100644
--- a/external/redland/ExternalProject_rasqal.mk
+++ b/external/redland/ExternalProject_rasqal.mk
@@ -30,7 +30,7 @@ $(call gb_ExternalProject_get_state_target,rasqal,build):
 		PKG_CONFIG="" \
 		RAPTOR2_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,raptor)/src" \
 		RAPTOR2_LIBS="-L$(call gb_UnpackedTarball_get_dir,raptor)/src/.libs -lraptor2" \
-		./configure --disable-gtk-doc \
+		$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
 			--with-regex-library=posix \
 			--with-decimal=none \
 			--with-uuid-library=internal \
diff --git a/external/redland/ExternalProject_redland.mk b/external/redland/ExternalProject_redland.mk
index f6101f0d288e..f908b550625b 100644
--- a/external/redland/ExternalProject_redland.mk
+++ b/external/redland/ExternalProject_redland.mk
@@ -33,7 +33,7 @@ $(call gb_ExternalProject_get_state_target,redland,build):
 		RAPTOR2_LIBS="-L$(call gb_UnpackedTarball_get_dir,raptor)/src/.libs -lraptor2 $(LIBXML_LIBS)" \
 		RASQAL_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,rasqal)/src" \
 		RASQAL_LIBS="-L$(call gb_UnpackedTarball_get_dir,rasqal)/src/.libs -lrasqal" \
-		./configure --disable-gtk-doc \
+		$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
 			--disable-modular \
 			--without-threads \
 			--without-bdb --without-sqlite --without-mysql \
diff --git a/external/serf/ExternalProject_serf.mk b/external/serf/ExternalProject_serf.mk
index 043045654956..abca0613c41a 100644
--- a/external/serf/ExternalProject_serf.mk
+++ b/external/serf/ExternalProject_serf.mk
@@ -37,7 +37,7 @@ else
 $(call gb_ExternalProject_get_state_target,serf,build):
 	$(call gb_Trace_StartRange,serf,EXTERNAL)
 	+$(call gb_ExternalProject_run,build,\
-		./configure SERF_LIBS= \
+		$(gb_RUN_CONFIGURE) ./configure SERF_LIBS= \
 			--enable-option-checking=fatal \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
 			$(if $(SYSTEM_APR),,--with-apr=$(call gb_UnpackedTarball_get_dir,apr)/apr-1-config) \
diff --git a/external/xmlsec/ExternalProject_xmlsec.mk b/external/xmlsec/ExternalProject_xmlsec.mk
index 3db17c769c8c..84ee1f29471a 100644
--- a/external/xmlsec/ExternalProject_xmlsec.mk
+++ b/external/xmlsec/ExternalProject_xmlsec.mk
@@ -41,7 +41,7 @@ $(call gb_ExternalProject_get_state_target,xmlsec,build) :
 		$(if $(filter iOS MACOSX,$(OS_FOR_BUILD)),ACLOCAL="aclocal -I $(SRCDIR)/m4/mac") \
 		$(if $(filter AIX,$(OS)),ACLOCAL="aclocal -I /opt/freeware/share/aclocal") \
 		autoreconf \
-		&& ./configure \
+		&& $(gb_RUN_CONFIGURE) ./configure \
 			--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)" \
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index c9fd30332c83..3bcd271eda26 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -375,7 +375,7 @@ void ScAttrArray::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 n
                     if(itr != rCondFormatData.end())
                     {
                         ScCondFormatIndexes aNewCondFormatData(rCondFormatData);
-                        aNewCondFormatData.erase(nIndex);
+                        aNewCondFormatData.erase(aNewCondFormatData.begin() + nIndex);
                         ScCondFormatItem aItem( std::move(aNewCondFormatData) );
                         pPatternAttr->GetItemSet().Put( aItem );
                         SetPatternArea( nTempStartRow, nTempEndRow, std::move(pPatternAttr), true );
diff --git a/solenv/bin/run-configure b/solenv/bin/run-configure
new file mode 100755
index 000000000000..9a0f2724f3a8
--- /dev/null
+++ b/solenv/bin/run-configure
@@ -0,0 +1,5 @@
+#!/bin/sh
+if test "$OS" = "EMSCRIPTEN"; then
+    export EMMAKEN_JUST_CONFIGURE=1
+fi
+exec "$@"
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 7c4df81bf257..4c7c7baf4700 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -191,6 +191,7 @@ include $(SRCDIR)/RepositoryExternal.mk
 $(eval $(call gb_Helper_collect_knownlibs))
 
 gb_Library_DLLPOSTFIX := lo
+gb_RUN_CONFIGURE :=
 
 # Include platform/cpu/compiler specific config/definitions
 
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 614d320c6b2c..1c0456c646ec 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -15,6 +15,7 @@ endif
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
 gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -s SAFE_HEAP=1
 
 gb_Executable_EXT := .html
commit 00a57edd54ce6fbdcb3660c4df80ba9061335a04
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Dec 21 17:31:23 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Dec 22 00:14:08 2020 +0100

    Catchall again
    
    As described, I think I found the origin of the problem with an
    emcc.py patch I wrote in the beginning to fix configure with cpp
    tests. This compiles LO up to some point in Calc with a template
    failure. I've made an extra patch from the galeries changes.
    
    The binary is essentially broken. While the alignment is checked
    by LO configure, the result instantly crashes with memory
    alignement errors somewhere. There seems to be a problem with
    inline Exceptions, so I just converted SvStreamEOFException to
    non-inline as a workaround.
    
    Change-Id: I3333a04cdb765da3efc4aa511e265a3863d5c9cd

diff --git a/README.wasm b/README.wasm
index b1c3c8d1797a..f7b71fe33db4 100644
--- a/README.wasm
+++ b/README.wasm
@@ -5,6 +5,10 @@ $ make vcl.all
 
 > instdir/program/ui-previewer.html
 
+Plain make vcl.all may still have dependency problems. But a general
+make currently fails with a template problem in sc. The ui-previewer
+"binary" will "crash" with memory alignment problems.
+
 
 = Setup for the LO WASM build (with Qt) =
 
@@ -27,6 +31,19 @@ Example bashrc scriptlet:
 EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
 [ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
 
+Before cleaning up all configure calls, I patched git_emsdk/upstream/emscripten/emcc.py for cpp:
+
++++ git_emsdk/upstream/emscripten/emcc.py
+@@ -707,7 +707,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
+ 
+   # If this is a configure-type thing, do not compile to JavaScript, instead use clang
+   # to compile to a native binary (using our headers, so things make sense later)
+-  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or 'conftest.c' in args) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
++  CONFIGURE_CONFIG = (os.environ.get('EMMAKEN_JUST_CONFIGURE') or ('conftest.' + ext in args for ext in ['c', 'cpp'])) and not os.environ.get('EMMAKEN_JUST_CONFIGURE_RECURSE')
+   CMAKE_CONFIG = 'CMakeFiles/cmTryCompileExec.dir' in ' '.join(args)# or 'CMakeCCompilerId' in ' '.join(args)
+   if CONFIGURE_CONFIG or CMAKE_CONFIG:
+     # XXX use this to debug configure stuff. ./configure's generally hide our
+
 
 == Setup Qt ==
 
@@ -39,32 +56,9 @@ make -j<CORES> module-qtbase module-qtdeclarative
 
 Building with examples will break with some of them, but at that point Qt already works.
 
-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
-     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:
-
-qtbase/config.tests/arch/write_info.pri:
--     ext = .wasm
-+     ext = .js.wasm
-
-Both break the build in different ways.
-
-What seems to have fixed it instead was to run "emsdk activate 1.39.8" again.
+What seems to have fixed this was to run "emsdk activate 1.39.8" again.
 
 Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
 Use: emrun --serve_after_close to run Qt WASM demos
@@ -110,6 +104,7 @@ QT5DIR=/dir/of/git_qt5/qtbase
 --disable-report-builder
 --disable-scripting
 --disable-sdremote-bluetooth
+--enable-ccache
 --enable-qt5
 --without-fonts
 --without-helppack-integration
diff --git a/Repository.mk b/Repository.mk
index 29538c57469b..8914c9ceae9e 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -470,7 +470,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(filter iOS MACOSX,$(OS)), \
 		MacOSXSpell \
 	) \
-	$(if $(filter $(OS),EMSCRIPTEN),vclplug_qt5) \
+	$(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,postgresqlsdbc, \
@@ -553,9 +553,13 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \
 	) \
 	log_uno_uno \
 	unsafe_uno_uno \
-	$(if $(filter MSC,$(COM)), \
-        $(if $(filter INTEL,$(CPUNAME)),msci, \
-		$(if $(filter ARM64,$(CPUNAME)),msca,mscx)),gcc3)_uno \
+    $(if $(filter EMSCRIPTEN,$(OS)),, \
+        $(if $(filter MSC,$(COM)), \
+            $(if $(filter INTEL,$(CPUNAME)),msci_uno) \
+            $(if $(filter X86_64,$(CPUNAME)),mscx_uno) \
+            $(if $(filter ARM64,$(CPUNAME)),msca_uno) \
+	, gcc3_uno) \
+    ) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,PRIVATELIBS_URE,ure, \
@@ -905,7 +909,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 	sfx2_emojiconfig \
 	$(call gb_Helper_optional,DESKTOP,\
 		$(if $(filter-out WNT,$(OS)),$(if $(ENABLE_MACOSX_SANDBOX),,shell_senddoc))) \
-	$(call gb_Helper_optional,DESKTOP,$(if $(filter-out MACOSX WNT,$(OS)),svx_gengal)) \
+	$(call gb_Helper_optional,DESKTOP,$(if $(filter-out EMSCRIPTEN MACOSX WNT,$(OS)),svx_gengal)) \
 	$(if $(USING_X11),vcl_fontunxppds) \
 	$(if $(filter $(OS),MACOSX),vcl_osxres) \
 	xmloff_dtd \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 050b56d83cf7..cd575faa11a5 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1363,6 +1363,8 @@ $(call gb_LinkTarget_add_libs,$(1),$(FONTCONFIG_LIBS))
 
 endef
 
+gb_ExternalProject__use_fontconfig :=
+
 else
 
 define gb_LinkTarget__use_fontconfig
@@ -1378,6 +1380,11 @@ $(call gb_LinkTarget_add_libs,$(1),\
 
 endef
 
+define gb_ExternalProject__use_fontconfig
+$(call gb_ExternalProject_use_external_project,$(1),fontconfig)
+
+endef
+
 endif # SYSTEM_FONTCONFIG
 
 ifneq ($(SYSTEM_GRAPHITE),)
diff --git a/RepositoryModule_build.mk b/RepositoryModule_build.mk
index 09bad286cffe..3ea89f432c41 100644
--- a/RepositoryModule_build.mk
+++ b/RepositoryModule_build.mk
@@ -56,38 +56,38 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
 	unotools \
 	ure \
 	xmlreader \
+	$(if $(WITH_GALLERY_BUILD), \
+		avmedia \
+		basic \
+		canvas \
+		configmgr \
+		connectivity \
+		cppcanvas \
+		drawinglayer \
+		editeng \
+		emfio \
+		filter \
+		framework \
+		linguistic \
+		officecfg \
+		package \
+		postprocess \
+		sfx2 \
+		shell \
+		sot \
+		svgio \
+		svl \
+		svtools \
+		svx \
+		toolkit \
+		ucb \
+		unoxml \
+		uui \
+		vcl \
+		xmloff \
+		xmlscript \
+	) \
 	$(call gb_Helper_optional_for_host,DESKTOP, \
-		$(if $(WITH_GALLERY_BUILD), \
-			avmedia \
-			basic \
-			canvas \
-			configmgr \
-			connectivity \
-			cppcanvas \
-			drawinglayer \
-			editeng \
-			emfio \
-			filter \
-			framework \
-			linguistic \
-			officecfg \
-			package \
-			postprocess \
-			sfx2 \
-			shell \
-			sot \
-			svgio \
-			svl \
-			svtools \
-			svx \
-			toolkit \
-			ucb \
-			unoxml \
-			uui \
-			vcl \
-			xmloff \
-			xmlscript \
-		) \
 		helpcompiler \
 		xmlhelp \
 	) \
diff --git a/configure.ac b/configure.ac
index 894c6b0fdc84..af9944041109 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1129,6 +1129,8 @@ emscripten*)
     enable_mariadb_sdbc=no
     with_system_zlib=no
     _os=Emscripten
+
+    BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
     ;;
 
 *)
@@ -2935,10 +2937,10 @@ AC_SUBST(SYSBASE)
 dnl ===================================================================
 dnl  Sort out various gallery compilation options
 dnl ===================================================================
+WITH_GALLERY_BUILD=TRUE
 AC_MSG_CHECKING([how to build and package galleries])
 if test -n "${with_galleries}"; then
     if test "$with_galleries" = "build"; then
-        WITH_GALLERY_BUILD=TRUE
         AC_MSG_RESULT([build from source images internally])
     elif test "$with_galleries" = "no"; then
         WITH_GALLERY_BUILD=
@@ -2948,7 +2950,6 @@ if test -n "${with_galleries}"; then
     fi
 else
     if test $_os != iOS -a $_os != Android; then
-        WITH_GALLERY_BUILD=TRUE
         AC_MSG_RESULT([internal src images for desktop])
     else
         WITH_GALLERY_BUILD=
@@ -4420,7 +4421,7 @@ fi
 AC_SUBST(USE_LD)
 
 HAVE_LD_BSYMBOLIC_FUNCTIONS=
-if test "$GCC" = "yes"; then
+if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
     bsymbolic_functions_ldflags_save=$LDFLAGS
     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
@@ -5240,6 +5241,7 @@ if test "$cross_compiling" = "yes"; then
     fi
     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
+    test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no"
     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
 
     # Don't bother having configure look for stuff not needed for the build platform anyway
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index eb32338fe74b..59232c9d16be 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_ExternalProject_ExternalProject,cairo))
 $(eval $(call gb_ExternalProject_use_external_project,cairo,pixman))
 
 $(eval $(call gb_ExternalProject_use_externals,cairo,\
+	fontconfig \
 	freetype \
 	libpng \
 	zlib \
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 2032b30f1d74..7b0a160a3f1c 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -676,6 +676,7 @@ public:
 class TOOLS_DLLPUBLIC SvStreamEOFException : public std::exception
 {
 public:
+    SvStreamEOFException();
     virtual const char * what() const throw() override;
 };
 
diff --git a/solenv/gbuild/extensions/pre_BuildTools.mk b/solenv/gbuild/extensions/pre_BuildTools.mk
index c45be554a128..9327cbe41714 100644
--- a/solenv/gbuild/extensions/pre_BuildTools.mk
+++ b/solenv/gbuild/extensions/pre_BuildTools.mk
@@ -19,6 +19,7 @@ gb_BUILD_TOOLS = \
 		gencoll_rule \
 		genconv_dict \
 		gendict \
+		$(if $(WITH_GALLERY_BUILD),gengal) \
 		genindex_data \
 		helpex \
 		idxdict \
@@ -33,7 +34,6 @@ gb_BUILD_TOOLS = \
 		unoidl-write \
 		xrmex \
 		$(call gb_Helper_optional_for_host,DESKTOP, \
-			gengal \
 			HelpIndexer \
 			HelpLinker \
 			lngconvex \
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index b8af059b4ff7..614d320c6b2c 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -15,13 +15,13 @@ endif
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
-emscripten_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -s SAFE_HEAP=1
 
 gb_Executable_EXT := .html
 
-gb_CFLAGS += $(emscripten_CPPFLAGS)
-gb_CXXFLAGS += $(emscripten_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
-gb_LinkTarget_LDFLAGS += $(emscripten_CPPFLAGS) --bind
+gb_CFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS)
+gb_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
+gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) --bind
 
 define gb_Library_get_rpath
 endef
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index d5b23ae31875..9c91f61e3b99 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -106,8 +106,10 @@ endif
 ifeq ($(DISABLE_DYNLOADING),TRUE)
 gb_CFLAGS_COMMON += -ffunction-sections -fdata-sections
 gb_CXXFLAGS_COMMON += -ffunction-sections -fdata-sections
+ifneq ($(OS),EMSCRIPTEN)
 gb_LinkTarget_LDFLAGS += -Wl,--gc-sections
 endif
+endif
 
 ifeq ($(COM_IS_CLANG),TRUE)
 gb_CXXFLAGS_COMMON += \
diff --git a/svx/Executable_gengal.mk b/svx/Executable_gengal.mk
index 9c82ac774ec5..989711d5d41f 100644
--- a/svx/Executable_gengal.mk
+++ b/svx/Executable_gengal.mk
@@ -29,6 +29,8 @@ $(eval $(call gb_Executable_use_external,gengal,boost_headers))
 
 $(eval $(call gb_Executable_use_sdk_api,gengal))
 
+$(eval $(call gb_Executable_use_package,gengal,svx_gengal))
+
 $(eval $(call gb_Executable_use_libraries,gengal,\
     basegfx \
     sal \
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index fed54a9185ca..9a45df4943c1 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -47,11 +47,17 @@ $(eval $(call gb_Module_add_screenshot_targets,svx,\
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,svx,\
-    $(if $(filter-out EMSCRIPTEN,$(OS)),Executable_gengal) \
+    Executable_gengal \
     $(if $(filter-out MACOSX WNT,$(OS)), \
 		Package_gengal) \
 ))
+else # !DESKTOP
+ifeq ($(WITH_GALLERY_BUILD),TRUE)
+$(eval $(call gb_Module_add_targets_for_build,svx,\
+    Executable_gengal \
+))
 endif
+endif # !DESKTOP
 
 $(eval $(call gb_Module_add_subsequentcheck_targets,svx,\
     JunitTest_svx_unoapi \
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 0feae91ece83..af5028b0fe6b 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -2149,6 +2149,8 @@ std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
     return nWritten;
 }
 
+SvStreamEOFException::SvStreamEOFException() : std::exception() {}
+
 const char * SvStreamEOFException::what() const throw()
 {
     return "SvStreamEOFException";
commit a897b76616277b9e84a947ecd5f64d647bac9f37
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: Tue Dec 22 00:14:08 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 76acb25c5741..815a06a240ea 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@
@@ -179,6 +178,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 3241c0ee1c4f..894c6b0fdc84 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"
@@ -2850,7 +2848,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)
@@ -10646,10 +10644,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.
         #
@@ -10677,16 +10676,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 62bb22bf2dcf5344c38a61e5cce2b48c18a9c446
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: Tue Dec 22 00:14:07 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 4638e58f32e2dd207ad7ce1f5f8d0984dba5c7eb
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: Tue Dec 22 00:14:07 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 e62c37c45b92..76acb25c5741 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -476,6 +476,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 2ba5467bcba2..3241c0ee1c4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6093,6 +6093,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)
@@ -12489,6 +12491,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)
 {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list