[Libreoffice-commits] core.git: Branch 'private/thb/wasm-upstreaming' - 13 commits - autogen.sh bridges/Module_bridges.mk config_host.mk.in configure.ac desktop/Library_sofficeapp.mk editeng/source external/apr external/boost external/breakpad external/cairo external/coinmp external/cppunit external/curl external/epm external/expat external/firebird external/fontconfig external/freetype external/gpgmepp external/harfbuzz external/hunspell external/hyphen external/icu external/lcms2 external/libabw external/libassuan external/libatomic_ops external/libcdr external/libebook external/libeot external/libepubgen external/libetonyek external/libexttextcat external/libffi external/libfreehand external/libgpg-error external/libjpeg-turbo external/liblangtag external/libmspub external/libmwaw external/libnumbertext external/libodfgen external/liborcus external/libpagemaker external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwpg external/libwps external/ libxml2 external/libxslt external/libzmf external/mythes external/neon external/openldap external/openssl external/postgresql external/python3 external/redland external/xmlsec .gitignore i18nutil/source idl/source include/osl include/sal include/vcl Makefile.in README.md README.wasm RepositoryExternal.mk Repository.mk sal/osl sal/rtl sc/source solenv/bin solenv/gbuild starmath/source svtools/source vcl/inc vcl/qt5 vcl/source vcl/unx wasm-qt/CustomTarget_wasm-qt5-mandelbrot_moc.mk wasm-qt/Executable_wasm-qt5-mandelbrot.mk wasm-qt/Makefile wasm-qt/Module_wasm-qt.mk wasm-qt/README wasm-qt/source xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 25 00:58:50 UTC 2021


Rebased ref, commits from common ancestor:
commit 4cd74897c5c4369e9f736430b39965def964ee90
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Apr 23 14:04:06 2021 +0200
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Sun Apr 25 02:57:53 2021 +0200

    Add WASM readme with build howto
    
    Change-Id: I2ce1787abfaa2cf6990d71e88de2d027b08f1489

diff --git a/README.wasm b/README.wasm
new file mode 100644
index 000000000000..53774549a46c
--- /dev/null
+++ b/README.wasm
@@ -0,0 +1,282 @@
+= Status =
+
+$ make
+$ emrun --serve_after_close instdir/program/ui-previewer.html
+
+The ui-previewer "binary" will "crash" with memory alignment problems.
+
+You can run the WASM mandelbrot Qt example, if you copy it's HTML
+and the qtloader.js from the Qt's example folder after build with:
+
+$ emrun --serve_after_close workdir/LinkTarget/Executable/mandelbrot.html
+
+REMINDER: always start new tabs in the browser, reload might fail / cache!
+
+
+= Setup for the LO WASM build (with Qt) =
+
+We're using Qt 5.15 with the officially supported emscripten v1.39.8.
+But there are several potential problems with threads and exceptions, so this will likely
+change later to a newer emscripten.
+
+Qt WASM is not yet used with LO, just if you're wondering!
+
+ ++ See below under Docker build for another build option ++
+
+== Setup emscripten ==
+
+https://emscripten.org/docs/getting_started/index.html
+
+git clone https://github.com/emscripten-core/emsdk.git
+./emsdk install 1.39.8
+./emsdk activate --embedded 1.39.8
+
+Example bashrc scriptlet:
+
+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.
+
+So:
+
+git clone https://github.com/qt/qt5.git
+cd qt5
+git checkout v5.15.2
+./init-repository
+./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
+make -j<CORES> module-qtbase module-qtdeclarative
+
+Building with examples will break with some of them, but at that point Qt already works.
+
+At some point Qt configure failed for me with:
+"Checking for target architecture... Project ERROR: target architecture detection binary not found."
+
+What seems to have fixed this was to run "emsdk activate 1.39.8" again.
+
+Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
+Use "emrun --serve_after_close" to run Qt WASM demos
+
+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 ==
+
+autogen.sh is patched to use emconfigure. That basically sets various environment vars,
+especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
+configure (a.out).
+
+QT5DIR=/dir/of/git_qt5/qtbase
+
+--host=wasm64-local-emscripten
+--disable-coinmp
+--disable-cups
+--disable-dbus
+--disable-dconf
+--disable-dynamic-loading
+--disable-extension-integration
+--disable-extensions
+--disable-extension-update
+--disable-firebird-sdbc
+--disable-gio
+--disable-gstreamer-1-0
+--disable-ldap
+--disable-lpsolve
+--disable-mariadb-sdbc
+--disable-nss
+--disable-odk
+--disable-online-update
+--disable-opencl
+--disable-pdfimport
+--disable-postgresql-sdbc
+--disable-python
+--disable-randr
+--disable-report-builder
+--disable-scripting
+--disable-sdremote-bluetooth
+--enable-ccache
+--without-helppack-integration
+--without-java
+--without-junit
+--without-system-dicts
+--with-fonts
+--with-theme=no
+
+Many will also be encoded in configure.ac at some point, some already is.
+
+
+== Using Docker to cross-build with emscripten ==
+
+If you prefer a controlled environment (sadly emsdk install/activate
+is _not_ stable over time, as e.g. nodejs versions evolve), that is
+easy to replicate across different machines - consider the docker
+images we're providing.
+
+Config/setup file see
+https://git.libreoffice.org/lode/+/ccb36979563635b51215477455953252c99ec013
+
+Run
+
+ docker-compose build
+
+in the lode/docker dir to get the container prepared. Run
+
+ PARALLELISM=4 BUILD_OPTIONS= BUILD_TARGET=build docker-compose run --rm -e PARALLELISM -e BUILD_TARGET -e BUILD_OPTIONS builder
+
+to perform an actual srcdir != buildir build; the container mounts
+checked-out git repo and output dir via docker-compose.yml (so make
+sure the path names there match your setup):
+
+The lode setup expects, inside the lode/docker subdir, the following directories:
+
+- core (git checkout)
+- workdir (the output dir - gets written into)
+- cache (ccache tree)
+- tarballs (external project tarballs gets written and cached there)
+
+
+= 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.
+
+WASM dynamic dispatch: https://fitzgeraldnick.com/2018/04/26/how-does-dynamic-dispatch-work-in-wasm.html
+
+
+= 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.
+  If you get linking errors that archive has no index.
+
+
+= Emscripten filesystem access with threads =
+
+This is closed, but not really fixed IMHO: https://github.com/emscripten-core/emscripten/issues/3922
+
+
+= Dynamic libraries / modules in emscripten =
+
+There is a good summary in https://bugreports.qt.io/browse/QTBUG-63925
+
+Summary: you can't use modules and threads.
+
+This is mentioned at the end of: https://github.com/emscripten-core/emscripten/wiki/Linking
+The usage of MAIN_MODULE and SIDE_MODULE has other problems, a major one IMHO is symbol resolution at runtime only.
+So this works really more like plugins in the sense of symbol resolution without dependencies / rpath.
+
+There is some clang-level dynamic-linking in progress (WASM dlload). The follwing link is already a bit old,
+but I found it a god summary of problems to expect:
+https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/
+
+
+= Mixed information, links, problems, TODO =
+
+More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
+
+WASM needs -pthread at compile, not just link time for atomics support. Alternativel< you can provide
+-s USE_PTHREADS=1, but both don't seem to work relyable, so best provide both.
+https://github.com/emscripten-core/emscripten/issues/10370
+
+The output file must have the prefix .o, otherwise the WASM files will get a
+node.js shebang (!) and ranlib won't be able to index the library (link errors).
+
+Qt with threads has further memory limit. From Qt configure:
+Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
+Project MESSAGE: Setting TOTAL_MEMORY to 1GB
+
+You can actually allocate 4GB: https://bugzilla.mozilla.org/show_bug.cgi?id=1392234
+
+LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
+the browser event loop. like VCL does with the system event loop in the various VCL backends.
+Changing this will need some major work (basically dropping Application::Execute).
+
+But with the know problems with exceptions and threads, this might change:
+- https://github.com/emscripten-core/emscripten/pull/11518
+- https://github.com/emscripten-core/emscripten/issues/11503
+- https://github.com/emscripten-core/emscripten/issues/11233
+- https://github.com/emscripten-core/emscripten/issues/12035
+
+We're also using emconfigure at the moment. Originally I patched emscripten, because it
+woulden't create the correct a.out file for C++ configure tests. Later I found that
+the emconfigure sets EMMAKEN_JUST_CONFIGURE to work around the problem.
+
+ICU bug: https://github.com/emscripten-core/emscripten/issues/10129
+Alternative, probably: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Intl
+
+There is a wasm64, but that still uses 32bit pointers!
+
+Old outdated docs: https://wiki.documentfoundation.org/Development/Emscripten
+Reverted patch: https://cgit.freedesktop.org/libreoffice/core/commit/?id=0e21f6619c72f1e17a7b0a52b6317810973d8a3e
+
+Generally https://emscripten.org/docs/porting:
+- https://emscripten.org/docs/porting/guidelines/api_limitations.html#api-limitations
+- https://emscripten.org/docs/porting/files/file_systems_overview.html#file-system-overview
+- https://emscripten.org/docs/porting/pthreads.html
+- https://emscripten.org/docs/porting/emscripten-runtime-environment.html
+
+This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-an-event-loop
+
+This didn't help much yet: https://github.com/emscripten-ports
+
+Emscripten supports standalone WASI binaries: https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone
+
+https://www.qt.io/qt-examples-for-webassembly
+http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
+http://qtandeverything.blogspot.com/2020/
+https://emscripten.org/docs/api_reference/Filesystem-API.html
+https://discuss.python.org/t/add-a-webassembly-wasm-runtime/3957/12
+http://git.savannah.gnu.org/cgit/config.git
+https://webassembly.org/specs/
+https://developer.chrome.com/docs/native-client/
+https://emscripten.org/docs/getting_started/downloads.html
+https://github.com/openpgpjs/openpgpjs/blob/master/README.md#getting-started
+https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
+https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md
+https://www.ip6.li/de/security/x.509_kochbuch/openssl-fuer-webassembly-compilieren
+https://emscripten.org/docs/introducing_emscripten/about_emscripten.html#about-emscripten-porting-code
+https://emscripten.org/docs/compiling/Building-Projects.html
+
commit 2a2d45d03322427938fedae8629d4413529ab433
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Apr 23 14:03:31 2021 +0200
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Sun Apr 25 02:57:53 2021 +0200

    Add Emscripten demo application
    
    Change-Id: I31297142761255b1f357fc9677a644b7a93c921a

diff --git a/configure.ac b/configure.ac
index f96aef68bee9..be73e0d4bdfc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12519,10 +12519,18 @@ then
     fi
 
     qt5_test_include="QtWidgets/qapplication.h"
-    qt5_test_library="libQt5Widgets.so"
+    if test "$_os" = "Emscripten"; then
+        qt5_test_library="libQt5Widgets.a"
+    else
+        qt5_test_library="libQt5Widgets.so"
+    fi
 
     dnl Check for qmake5
-    AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
+    if test -n "$QT5DIR"; then
+        AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
+    else
+        AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
+    fi
     if test "$QMAKE5" = "no"; then
         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
     else
@@ -12541,6 +12549,8 @@ then
 
     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
+    qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
+    QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
 
     AC_MSG_CHECKING([for Qt5 headers])
     qt5_incdir="no"
@@ -12576,9 +12586,21 @@ then
         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
     fi
 
+    if test "$_os" = "Emscripten"; then
+        if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
+            QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
+        fi
+	if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
+            AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
+        fi
+    fi
+
     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+    if test "$_os" = "Emscripten"; then
+        QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
+    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.])])
@@ -12618,6 +12640,7 @@ AC_SUBST(MOC5)
 AC_SUBST(QT5_GOBJECT_CFLAGS)
 AC_SUBST(QT5_GOBJECT_LIBS)
 AC_SUBST(QT5_HAVE_GOBJECT)
+AC_SUBST(QT5_PLATFORMS_SRCDIR)
 
 dnl ===================================================================
 dnl KF5 Integration
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 765ed602704e..4cc5a8aaab11 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -54,6 +54,11 @@
 #include <mutex>
 #include <condition_variable>
 
+#ifdef EMSCRIPTEN
+#include <QtCore/QtPlugin>
+Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
+#endif
+
 namespace
 {
 /// TODO: not much Qt5 specific here? could be generalised, esp. for OSX...
@@ -427,7 +432,7 @@ OUString Qt5Instance::GetConnectionIdentifier() { return OUString(); }
 
 void Qt5Instance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) {}
 
-OpenGLContext* Qt5Instance::CreateOpenGLContext() { return new Qt5OpenGLContext; }
+OpenGLContext* Qt5Instance::CreateOpenGLContext() { return nullptr; }
 
 bool Qt5Instance::IsMainThread() const
 {
@@ -570,7 +575,7 @@ void* Qt5Instance::CreateGStreamerSink(const SystemChildWindow* pWindow)
 
     return pVideosink;
 #else
-    (void*)pWindow;
+    Q_UNUSED(pWindow);
     return nullptr;
 #endif
 }
diff --git a/vcl/qt5/Qt5MainWindow.cxx b/vcl/qt5/Qt5MainWindow.cxx
index 45d726ba22be..89879864a9bc 100644
--- a/vcl/qt5/Qt5MainWindow.cxx
+++ b/vcl/qt5/Qt5MainWindow.cxx
@@ -19,7 +19,9 @@ Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
     : QMainWindow(nullptr, f)
     , m_rFrame(rFrame)
 {
+#ifndef EMSCRIPTEN
     QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
+#endif
 }
 
 void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
diff --git a/wasm-qt/CustomTarget_wasm-qt5-mandelbrot_moc.mk b/wasm-qt/CustomTarget_wasm-qt5-mandelbrot_moc.mk
new file mode 100644
index 000000000000..6267db3f5b8d
--- /dev/null
+++ b/wasm-qt/CustomTarget_wasm-qt5-mandelbrot_moc.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,wasm-qt/qt5-mandelbrot))
+
+$(call gb_CustomTarget_get_target,wasm-qt/qt5-mandelbrot) : \
+	$(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/renderthread.moc \
+	$(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/mandelbrotwidget.moc \
+
+qt5_mandelbrot_MOCDEFS_H := $(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/moc_predefs.h
+qt5_mandelbrot_MOCDEFS_CXX := $(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/moc_dummy.cxx
+qt5_mandelbrot_WORKDIR :=  $(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/.dir
+
+$(qt5_mandelbrot_MOCDEFS_CXX): | $(qt5_mandelbrot_WORKDIR)
+	touch $@
+
+$(qt5_mandelbrot_MOCDEFS_H): $(qt5_mandelbrot_MOCDEFS_CXX) | $(qt5_mandelbrot_WORKDIR)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CXX,1)
+	$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CXX)
+	$(CXX) -pipe -O2 -std=gnu++11 -fno-exceptions $(gb_EMSCRIPTEN_CPPFLAGS) -dM -E -o $@ $<
+	$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
+
+$(call gb_CustomTarget_get_workdir,wasm-qt/qt5-mandelbrot)/%.moc : \
+		$(SRCDIR)/wasm-qt/source/qt5-mandelbrot/%.h \
+		$(qt5_mandelbrot_MOCDEFS_H) | $(qt5_mandelbrot_WORKDIR)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1)
+	$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),MOC)
+	$(MOC5) --include $(qt5_mandelbrot_MOCDEFS_H) $(gb_EMSCRIPTEN_QTDEFS) $< -o $@
+	$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
+
+# vim: set noet sw=4:
diff --git a/wasm-qt/Executable_wasm-qt5-mandelbrot.mk b/wasm-qt/Executable_wasm-qt5-mandelbrot.mk
new file mode 100644
index 000000000000..040fad441219
--- /dev/null
+++ b/wasm-qt/Executable_wasm-qt5-mandelbrot.mk
@@ -0,0 +1,32 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Executable_Executable,wasm-qt5-mandelbrot))
+
+$(eval $(call gb_Executable_use_custom_headers,wasm-qt5-mandelbrot,wasm-qt/qt5-mandelbrot))
+
+$(eval $(call gb_Executable_use_externals,wasm-qt5-mandelbrot,\
+    graphite \
+    freetype \
+    harfbuzz \
+    libpng \
+    qt5 \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,wasm-qt5-mandelbrot,\
+    wasm-qt/source/qt5-mandelbrot/main \
+    wasm-qt/source/qt5-mandelbrot/mandelbrotwidget \
+    wasm-qt/source/qt5-mandelbrot/renderthread \
+))
+
+$(eval $(call gb_Executable_add_defs,wasm-qt5-mandelbrot,\
+    -DVCL_INTERNALS \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm-qt/Makefile b/wasm-qt/Makefile
new file mode 100644
index 000000000000..0c6f47b1790f
--- /dev/null
+++ b/wasm-qt/Makefile
@@ -0,0 +1,13 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm-qt/Module_wasm-qt.mk b/wasm-qt/Module_wasm-qt.mk
new file mode 100644
index 000000000000..8e86df4e8baa
--- /dev/null
+++ b/wasm-qt/Module_wasm-qt.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+$(eval $(call gb_Module_Module,wasm-qt))
+
+ifeq ($(OS),EMSCRIPTEN)
+
+$(eval $(call gb_Module_add_targets,wasm-qt,\
+    CustomTarget_wasm-qt5-mandelbrot_moc \
+    Executable_wasm-qt5-mandelbrot \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/wasm-qt/README b/wasm-qt/README
new file mode 100644
index 000000000000..a23bd6a45ea9
--- /dev/null
+++ b/wasm-qt/README
@@ -0,0 +1 @@
+See /README.wasm
diff --git a/wasm-qt/source/qt5-mandelbrot/main.cxx b/wasm-qt/source/qt5-mandelbrot/main.cxx
new file mode 100644
index 000000000000..037c63153cf2
--- /dev/null
+++ b/wasm-qt/source/qt5-mandelbrot/main.cxx
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mandelbrotwidget.h"
+
+#include <QtWidgets/QApplication>
+#include <QtCore/QtPlugin>
+
+Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
+
+int main(int argc, char* argv[])
+{
+    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+    QApplication app(argc, argv);
+    MandelbrotWidget widget;
+    widget.show();
+    return app.exec();
+}
diff --git a/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.cxx b/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.cxx
new file mode 100644
index 000000000000..5886dd2664c0
--- /dev/null
+++ b/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.cxx
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mandelbrotwidget.h"
+#include "mandelbrotwidget.moc"
+
+#include <QtGui/QPainter>
+#include <QtGui/QKeyEvent>
+
+#include <math.h>
+
+const double DefaultCenterX = -0.637011;
+const double DefaultCenterY = -0.0395159;
+const double DefaultScale = 0.00403897;
+
+const double ZoomInFactor = 0.8;
+const double ZoomOutFactor = 1 / ZoomInFactor;
+const int ScrollStep = 20;
+
+MandelbrotWidget::MandelbrotWidget(QWidget* parent)
+    : QWidget(parent)
+    , centerX(DefaultCenterX)
+    , centerY(DefaultCenterY)
+    , pixmapScale(DefaultScale)
+    , curScale(DefaultScale)
+{
+    connect(&thread, &RenderThread::renderedImage, this, &MandelbrotWidget::updatePixmap);
+
+    setWindowTitle(tr("Mandelbrot"));
+#if QT_CONFIG(cursor)
+    setCursor(Qt::CrossCursor);
+#endif
+    resize(550, 400);
+}
+
+void MandelbrotWidget::paintEvent(QPaintEvent* /* event */)
+{
+    QPainter painter(this);
+    painter.fillRect(rect(), Qt::black);
+
+    if (pixmap.isNull())
+    {
+        painter.setPen(Qt::white);
+        painter.drawText(rect(), Qt::AlignCenter, tr("Rendering initial image, please wait..."));
+        return;
+    }
+
+    if (qFuzzyCompare(curScale, pixmapScale))
+    {
+        painter.drawPixmap(pixmapOffset, pixmap);
+    }
+    else
+    {
+        auto previewPixmap = qFuzzyCompare(pixmap.devicePixelRatioF(), qreal(1))
+                                 ? pixmap
+                                 : pixmap.scaled(pixmap.size() / pixmap.devicePixelRatioF(),
+                                                 Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        double scaleFactor = pixmapScale / curScale;
+        int newWidth = int(previewPixmap.width() * scaleFactor);
+        int newHeight = int(previewPixmap.height() * scaleFactor);
+        int newX = pixmapOffset.x() + (previewPixmap.width() - newWidth) / 2;
+        int newY = pixmapOffset.y() + (previewPixmap.height() - newHeight) / 2;
+
+        painter.save();
+        painter.translate(newX, newY);
+        painter.scale(scaleFactor, scaleFactor);
+
+        QRectF exposed = painter.transform().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1);
+        painter.drawPixmap(exposed, previewPixmap, exposed);
+        painter.restore();
+    }
+
+    QString text = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
+                      "Press and hold left mouse button to scroll.");
+    QFontMetrics metrics = painter.fontMetrics();
+    int textWidth = metrics.horizontalAdvance(text);
+
+    painter.setPen(Qt::NoPen);
+    painter.setBrush(QColor(0, 0, 0, 127));
+    painter.drawRect((width() - textWidth) / 2 - 5, 0, textWidth + 10, metrics.lineSpacing() + 5);
+    painter.setPen(Qt::white);
+    painter.drawText((width() - textWidth) / 2, metrics.leading() + metrics.ascent(), text);
+}
+
+void MandelbrotWidget::resizeEvent(QResizeEvent* /* event */)
+{
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
+
+void MandelbrotWidget::keyPressEvent(QKeyEvent* event)
+{
+    switch (event->key())
+    {
+        case Qt::Key_Plus:
+            zoom(ZoomInFactor);
+            break;
+        case Qt::Key_Minus:
+            zoom(ZoomOutFactor);
+            break;
+        case Qt::Key_Left:
+            scroll(-ScrollStep, 0);
+            break;
+        case Qt::Key_Right:
+            scroll(+ScrollStep, 0);
+            break;
+        case Qt::Key_Down:
+            scroll(0, -ScrollStep);
+            break;
+        case Qt::Key_Up:
+            scroll(0, +ScrollStep);
+            break;
+        default:
+            QWidget::keyPressEvent(event);
+    }
+}
+
+#if QT_CONFIG(wheelevent)
+void MandelbrotWidget::wheelEvent(QWheelEvent* event)
+{
+    const int numDegrees = event->angleDelta().y() / 8;
+    const double numSteps = numDegrees / double(15);
+    zoom(pow(ZoomInFactor, numSteps));
+}
+#endif
+
+void MandelbrotWidget::mousePressEvent(QMouseEvent* event)
+{
+    if (event->button() == Qt::LeftButton)
+        lastDragPos = event->pos();
+}
+
+void MandelbrotWidget::mouseMoveEvent(QMouseEvent* event)
+{
+    if (event->buttons() & Qt::LeftButton)
+    {
+        pixmapOffset += event->pos() - lastDragPos;
+        lastDragPos = event->pos();
+        update();
+    }
+}
+
+void MandelbrotWidget::mouseReleaseEvent(QMouseEvent* event)
+{
+    if (event->button() == Qt::LeftButton)
+    {
+        pixmapOffset += event->pos() - lastDragPos;
+        lastDragPos = QPoint();
+
+        const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatioF();
+        int deltaX = (width() - pixmapSize.width()) / 2 - pixmapOffset.x();
+        int deltaY = (height() - pixmapSize.height()) / 2 - pixmapOffset.y();
+        scroll(deltaX, deltaY);
+    }
+}
+
+void MandelbrotWidget::updatePixmap(const QImage& image, double scaleFactor)
+{
+    if (!lastDragPos.isNull())
+        return;
+
+    pixmap = QPixmap::fromImage(image);
+    pixmapOffset = QPoint();
+    lastDragPos = QPoint();
+    pixmapScale = scaleFactor;
+    update();
+}
+
+void MandelbrotWidget::zoom(double zoomFactor)
+{
+    curScale *= zoomFactor;
+    update();
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
+
+void MandelbrotWidget::scroll(int deltaX, int deltaY)
+{
+    centerX += deltaX * curScale;
+    centerY += deltaY * curScale;
+    update();
+    thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
+}
diff --git a/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.h b/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.h
new file mode 100644
index 000000000000..72e95568b522
--- /dev/null
+++ b/wasm-qt/source/qt5-mandelbrot/mandelbrotwidget.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtGui/QPixmap>
+#include <QtWidgets/QWidget>
+
+#include "renderthread.h"
+
+class MandelbrotWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    MandelbrotWidget(QWidget* parent = nullptr);
+
+protected:
+    void paintEvent(QPaintEvent* event) override;
+    void resizeEvent(QResizeEvent* event) override;
+    void keyPressEvent(QKeyEvent* event) override;
+#if QT_CONFIG(wheelevent)
+    void wheelEvent(QWheelEvent* event) override;
+#endif
+    void mousePressEvent(QMouseEvent* event) override;
+    void mouseMoveEvent(QMouseEvent* event) override;
+    void mouseReleaseEvent(QMouseEvent* event) override;
+
+private slots:
+    void updatePixmap(const QImage& image, double scaleFactor);
+    void zoom(double zoomFactor);
+
+private:
+    void scroll(int deltaX, int deltaY);
+
+    RenderThread thread;
+    QPixmap pixmap;
+    QPoint pixmapOffset;
+    QPoint lastDragPos;
+    double centerX;
+    double centerY;
+    double pixmapScale;
+    double curScale;
+};
diff --git a/wasm-qt/source/qt5-mandelbrot/renderthread.cxx b/wasm-qt/source/qt5-mandelbrot/renderthread.cxx
new file mode 100644
index 000000000000..398e43ded15d
--- /dev/null
+++ b/wasm-qt/source/qt5-mandelbrot/renderthread.cxx
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "renderthread.h"
+#include "renderthread.moc"
+
+#include <QtGui/QImage>
+#include <cmath>
+
+RenderThread::RenderThread(QObject* parent)
+    : QThread(parent)
+{
+    for (int i = 0; i < ColormapSize; ++i)
+        m_colormap[i] = rgbFromWaveLength(380.0 + (i * 400.0 / ColormapSize));
+}
+
+RenderThread::~RenderThread()
+{
+    m_mutex.lock();
+    m_abort = true;
+    m_condition.wakeOne();
+    m_mutex.unlock();
+
+    wait();
+}
+
+void RenderThread::render(double centerX, double centerY, double scaleFactor, QSize resultSize,
+                          double devicePixelRatio)
+{
+    QMutexLocker locker(&m_mutex);
+
+    m_centerX = centerX;
+    m_centerY = centerY;
+    m_scaleFactor = scaleFactor;
+    m_devicePixelRatio = devicePixelRatio;
+    m_resultSize = resultSize;
+
+    if (!isRunning())
+    {
+        start(LowPriority);
+    }
+    else
+    {
+        m_restart = true;
+        m_condition.wakeOne();
+    }
+}
+
+void RenderThread::run()
+{
+    forever
+    {
+        m_mutex.lock();
+        const double devicePixelRatio = m_devicePixelRatio;
+        const QSize resultSize = m_resultSize * devicePixelRatio;
+        const double requestedScaleFactor = m_scaleFactor;
+        const double scaleFactor = requestedScaleFactor / devicePixelRatio;
+        const double centerX = m_centerX;
+        const double centerY = m_centerY;
+        m_mutex.unlock();
+
+        int halfWidth = resultSize.width() / 2;
+        int halfHeight = resultSize.height() / 2;
+        QImage image(resultSize, QImage::Format_RGB32);
+        image.setDevicePixelRatio(devicePixelRatio);
+
+        const int NumPasses = 8;
+        int pass = 0;
+        while (pass < NumPasses)
+        {
+            const int MaxIterations = (1 << (2 * pass + 6)) + 32;
+            const int Limit = 4;
+            bool allBlack = true;
+
+            for (int y = -halfHeight; y < halfHeight; ++y)
+            {
+                if (m_restart)
+                    break;
+                if (m_abort)
+                    return;
+
+                auto scanLine = reinterpret_cast<uint*>(image.scanLine(y + halfHeight));
+                const double ay = centerY + (y * scaleFactor);
+
+                for (int x = -halfWidth; x < halfWidth; ++x)
+                {
+                    const double ax = centerX + (x * scaleFactor);
+                    double a1 = ax;
+                    double b1 = ay;
+                    int numIterations = 0;
+
+                    do
+                    {
+                        ++numIterations;
+                        const double a2 = (a1 * a1) - (b1 * b1) + ax;
+                        const double b2 = (2 * a1 * b1) + ay;
+                        if ((a2 * a2) + (b2 * b2) > Limit)
+                            break;
+
+                        ++numIterations;
+                        a1 = (a2 * a2) - (b2 * b2) + ax;
+                        b1 = (2 * a2 * b2) + ay;
+                        if ((a1 * a1) + (b1 * b1) > Limit)
+                            break;
+                    } while (numIterations < MaxIterations);
+
+                    if (numIterations < MaxIterations)
+                    {
+                        *scanLine++ = m_colormap[numIterations % ColormapSize];
+                        allBlack = false;
+                    }
+                    else
+                    {
+                        *scanLine++ = qRgb(0, 0, 0);
+                    }
+                }
+            }
+
+            if (allBlack && pass == 0)
+            {
+                pass = 4;
+            }
+            else
+            {
+                if (!m_restart)
+                    emit renderedImage(image, requestedScaleFactor);
+                ++pass;
+            }
+        }
+
+        m_mutex.lock();
+        if (!m_restart)
+            m_condition.wait(&m_mutex);
+        m_restart = false;
+        m_mutex.unlock();
+    }
+}
+
+uint RenderThread::rgbFromWaveLength(double wave)
+{
+    double r = 0;
+    double g = 0;
+    double b = 0;
+
+    if (wave >= 380.0 && wave <= 440.0)
+    {
+        r = -1.0 * (wave - 440.0) / (440.0 - 380.0);
+        b = 1.0;
+    }
+    else if (wave >= 440.0 && wave <= 490.0)
+    {
+        g = (wave - 440.0) / (490.0 - 440.0);
+        b = 1.0;
+    }
+    else if (wave >= 490.0 && wave <= 510.0)
+    {
+        g = 1.0;
+        b = -1.0 * (wave - 510.0) / (510.0 - 490.0);
+    }
+    else if (wave >= 510.0 && wave <= 580.0)
+    {
+        r = (wave - 510.0) / (580.0 - 510.0);
+        g = 1.0;
+    }
+    else if (wave >= 580.0 && wave <= 645.0)
+    {
+        r = 1.0;
+        g = -1.0 * (wave - 645.0) / (645.0 - 580.0);
+    }
+    else if (wave >= 645.0 && wave <= 780.0)
+    {
+        r = 1.0;
+    }
+
+    double s = 1.0;
+    if (wave > 700.0)
+        s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0);
+    else if (wave < 420.0)
+        s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0);
+
+    r = std::pow(r * s, 0.8);
+    g = std::pow(g * s, 0.8);
+    b = std::pow(b * s, 0.8);
+    return qRgb(int(r * 255), int(g * 255), int(b * 255));
+}
diff --git a/wasm-qt/source/qt5-mandelbrot/renderthread.h b/wasm-qt/source/qt5-mandelbrot/renderthread.h
new file mode 100644
index 000000000000..16c0d86fd46c
--- /dev/null
+++ b/wasm-qt/source/qt5-mandelbrot/renderthread.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of The Qt Company Ltd nor the names of its
+**     contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtCore/QMutex>
+#include <QtCore/QSize>
+#include <QtCore/QThread>
+#include <QtCore/QWaitCondition>
+
+QT_BEGIN_NAMESPACE
+class QImage;
+QT_END_NAMESPACE
+
+class RenderThread : public QThread
+{
+    Q_OBJECT
+
+public:
+    RenderThread(QObject* parent = nullptr);
+    ~RenderThread();
+
+    void render(double centerX, double centerY, double scaleFactor, QSize resultSize,
+                double devicePixelRatio);
+
+signals:
+    void renderedImage(const QImage& image, double scaleFactor);
+
+protected:
+    void run() override;
+
+private:
+    static uint rgbFromWaveLength(double wave);
+
+    QMutex m_mutex;
+    QWaitCondition m_condition;
+    double m_centerX;
+    double m_centerY;
+    double m_scaleFactor;
+    double m_devicePixelRatio;
+    QSize m_resultSize;
+    bool m_restart = false;
+    bool m_abort = false;
+
+    enum
+    {
+        ColormapSize = 512
+    };
+    uint m_colormap[ColormapSize];
+};
diff --git a/xmlsecurity/Library_xmlsecurity.mk b/xmlsecurity/Library_xmlsecurity.mk
index f50140edb303..1e974297f43e 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)))
+ifeq (TRUE,$(ENABLE_NSS))
 $(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
 
commit c652b5f584650eeb277421b9f5805b9deb74d2ee
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Apr 23 13:45:05 2021 +0200
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Sun Apr 25 02:57:53 2021 +0200

    Initial support for Emscripten
    
    - configure with:
    - --host=wasm64-local-emscripten
    - had to make a few externals optional, so adding:
      - --disable-nss
      - --disable-cmis
      - --disable-curl
    
    Change-Id: I48d1c73d2675ad2e2beaf2c341578199efbd24ee

diff --git a/.gitignore b/.gitignore
index d89e5b12035f..4562c89b7e05 100644
--- a/.gitignore
+++ b/.gitignore
@@ -175,3 +175,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.md b/README.md
index 35a68bcf4795..20912732da3d 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,10 @@ run and compile LibreOffice, also used by the TDF builds:
     * Build: Xcode 9.3 and iPhone SDK 11.4
 * Android:
     * Build: NDK r19c and SDK 22.6.2
+* Emscripten / WASM:
+    * Runtime: a browser with SharedMemory support (threads + atomics)
+    * Build: Qt 5.15 with Qt supported Emscripten 1.39.8
+    * See README.wasm
 
 If you want to use Clang with the LibreOffice compiler plugins, the minimal
 version of Clang is 5.0.2. Since Xcode doesn't provide the compiler plugin
diff --git a/autogen.sh b/autogen.sh
index 1779de77e6f3..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 ("./configure", @args) && die "Error running configure";
+    system (@args) && die "Error running configure";
 }
 
 # Local Variables:
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 3016bf2c404f..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),\
@@ -29,5 +30,6 @@ else ifneq ($(words $(bridges_SELECTED_BRIDGE)),1)
 $(call gb_Output_error,multiple bridges selected for build: $(bridges_SELECTED_BRIDGE))
 endif
 endif
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/config_host.mk.in b/config_host.mk.in
index b6012d793893..5cc02e393589 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -325,6 +325,7 @@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@
 export KRB5_LIBS=@KRB5_LIBS@
 export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@
 export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@
+export LD=@LD@
 export LD_GC_SECTIONS=@LD_GC_SECTIONS@
 export LD_PLUGIN=@LD_PLUGIN@
 @x_LDFLAGS@ export LDFLAGS=@LDFLAGS@
@@ -474,6 +475,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@
@@ -506,6 +517,7 @@ export QT5_LIBS=$(gb_SPACE)@QT5_LIBS@
 export QT5_GOBJECT_CFLAGS=$(gb_SPACE)@QT5_GOBJECT_CFLAGS@
 export QT5_GOBJECT_LIBS=$(gb_SPACE)@QT5_GOBJECT_LIBS@
 export QT5_HAVE_GOBJECT=@QT5_HAVE_GOBJECT@
+export QT5_PLATFORMS_SRCDIR=@QT5_PLATFORMS_SRCDIR@
 export QXP_CFLAGS=$(gb_SPACE)@QXP_CFLAGS@
 export QXP_LIBS=$(gb_SPACE)@QXP_LIBS@
 export RANLIB=@RANLIB@
@@ -639,6 +651,7 @@ export USE_XINERAMA=@USE_XINERAMA@
 export UPDATE_CONFIG=@UPDATE_CONFIG@
 export UUIDGEN=@UUIDGEN@
 export VALGRIND_CFLAGS=$(gb_SPACE)@VALGRIND_CFLAGS@
+export VCL_PLUGIN_INFO=@VCL_PLUGIN_INFO@
 export VCVER=@VCVER@
 export DEVENV=@DEVENV@
 export VISIO_CFLAGS=$(gb_SPACE)@VISIO_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 2bbe081ac044..f96aef68bee9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -804,6 +804,8 @@ dnl Sequential to keep the logic very simple
 dnl These values may be checked and reset later.
 dnl ===================================================================
 #defaults unless the os test overrides this:
+test_cmis=yes
+test_curl=yes
 test_randr=yes
 test_xrender=yes
 test_cups=yes
@@ -957,6 +959,7 @@ darwin*|macos*) # macOS
 ;;
 
 ios*) # iOS
+    test_cmis=no
     test_randr=no
     test_xrender=no
     test_freetype=no
@@ -1104,6 +1107,29 @@ haiku*)
     _os=Haiku
     ;;
 
+emscripten)
+    build_gstreamer_1_0=no
+    enable_lpsolve=no
+    enable_report_builder=no
+    with_theme="breeze"
+    test_cmis=no
+    test_cups=no
+    test_curl=no
+    test_dbus=no
+    test_fontconfig=no
+    test_freetype=no
+    test_gtk=no
+    test_randr=no
+    test_xrender=no
+    enable_postgresql_sdbc=no
+    enable_firebird_sdbc=no
+    enable_mariadb_sdbc=no
+    with_system_zlib=no
+    _os=Emscripten
+
+    BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -1254,10 +1280,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
@@ -1272,6 +1312,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
@@ -1462,7 +1507,8 @@ libo_FUZZ_ARG_ENABLE(optimized,
         [Whether to compile with optimization flags.
          By default, disabled for --enable-debug and --enable-dbgutil, enabled
          otherwise. Using 'debug' will try to use only optimizations that should
-         not interfere with debugging.]))
+         not interfere with debugging. For Emscripten we default to optimized (-O1)
+         debug build, as otherwise biaries become too large.]))
 
 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
     AS_HELP_STRING([--disable-runtime-optimizations],
@@ -1789,6 +1835,13 @@ libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
          Requires --enable-openssl.]))
 
+AC_ARG_ENABLE(nss,
+    AS_HELP_STRING([--disable-nss],
+        [Disable using NSS. If disabled,
+         components will either use GNUTLS or openssl. Work in progress,
+         use only if you are hacking on it.]),
+,enable_nss=yes)
+
 AC_ARG_ENABLE(library-bin-tar,
     AS_HELP_STRING([--enable-library-bin-tar],
         [Enable the building and reused of tarball of binary build for some 'external' libraries.
@@ -1832,6 +1885,16 @@ libo_FUZZ_ARG_ENABLE(librelogo,
         [Do not build LibreLogo.]),
 ,enable_librelogo=yes)
 
+AC_ARG_ENABLE(cmis,
+    AS_HELP_STRING([--disable-cmis],
+        [Disable CMIS support.]),
+,enable_cmis=yes)
+
+AC_ARG_ENABLE(curl,
+    AS_HELP_STRING([--disable-curl],
+        [Disable CURL support.]),
+,enable_curl=yes)
+
 dnl ===================================================================
 dnl Optional Packages (--with/without-)
 dnl ===================================================================
@@ -2817,7 +2880,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)
@@ -2868,7 +2931,7 @@ fi
 if test -z "$enable_scripting"; then
     # Disable scripting for iOS unless specifically overridden
     # with --enable-scripting.
-    if test $_os != iOS; then
+    if test $_os != iOS -o $_os = Emscripten; then
         enable_scripting=yes
     fi
 fi
@@ -2882,7 +2945,7 @@ else
     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
 fi
 
-if test $_os = iOS -o $_os = Android; then
+if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
     # Disable dynamic_loading always for iOS and Android
     enable_dynamic_loading=no
 elif test -z "$enable_dynamic_loading"; then
@@ -4096,6 +4159,8 @@ if test "$COM_IS_CLANG" = TRUE; then
         [my_apple_clang=yes],[my_apple_clang=])
     if test "$my_apple_clang" = yes; then
         AC_MSG_RESULT([assumed yes (Apple Clang)])
+    elif test "$_os" = Emscripten; then
+        AC_MSG_RESULT([assumed yes (Emscripten Clang)])
     else
         if test "$_os" = WINNT; then
             dnl In which case, assume clang-cl:
@@ -4177,7 +4242,7 @@ fi
 # ===================================================================
 
 HAVE_GCC_GGDB2=
-if test "$GCC" = "yes"; then
+if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
     save_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -Werror -ggdb2"
@@ -4405,7 +4470,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"
@@ -4591,7 +4656,7 @@ elif test "$enable_optimized" = debug; then
     ENABLE_OPTIMIZED_DEBUG=TRUE
     AC_MSG_RESULT([yes (debug)])
     HAVE_GCC_OG=
-    if test "$GCC" = "yes"; then
+    if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
         save_CFLAGS=$CFLAGS
         CFLAGS="$CFLAGS -Werror -Og"
@@ -4603,7 +4668,7 @@ elif test "$enable_optimized" = debug; then
             AC_MSG_RESULT([no])
         fi
     fi
-    if test -z "$HAVE_GCC_OG"; then
+    if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
     fi
 else
@@ -5046,6 +5111,25 @@ solaris*)
     SOLARINC="$SOLARINC -I/usr/local/include"
     ;;
 
+emscripten*)
+    COM=GCC
+    USING_X11=
+    OS=EMSCRIPTEN
+    RTL_OS=Emscripten
+    P_SEP=:
+
+    case "$host_cpu" in
+    wasm32|wasm64)
+        ;;
+    *)
+        AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
+        ;;
+    esac
+    CPUNAME=INTEL
+    RTL_ARCH=x86
+    PLATFORMID=linux_x86
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -5170,9 +5254,10 @@ if test "$cross_compiling" = "yes"; then
     (
     unset COM USING_X11 OS CPUNAME
     unset CC CXX SYSBASE CFLAGS
-    unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
+    unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
-    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
+    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
+    unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
     if test -n "$CC_FOR_BUILD"; then
         export CC="$CC_FOR_BUILD"
         CC_BASE=`first_arg_basename "$CC"`
@@ -5184,6 +5269,7 @@ if test "$cross_compiling" = "yes"; then
     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
     cd CONF-FOR-BUILD
 
+    # Handle host configuration, which affects the cross-toolset too
     sub_conf_opts=""
     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
@@ -5218,6 +5304,7 @@ if test "$cross_compiling" = "yes"; then
         --disable-gstreamer-1-0 \
         --disable-gtk3 \
         --disable-mariadb-sdbc \
+        --disable-nss \
         --disable-online-update \
         --disable-opencl \
         --disable-pdfimport \
@@ -5240,7 +5327,9 @@ if test "$cross_compiling" = "yes"; then
     PERMITTED_BUILD_TARGETS="
         AVMEDIA
         BOOST
+        CAIRO
         CLUCENE
+        CURL
         DBCONNECTIVITY
         DESKTOP
         DYNLOADING
@@ -6053,9 +6142,12 @@ if test "$_os" != "WINNT"; then
 fi
 AC_SUBST(AR)
 AC_SUBST(DLLTOOL)
+AC_SUBST(LD)
 AC_SUBST(NM)
 AC_SUBST(OBJDUMP)
 AC_SUBST(PKG_CONFIG)
+AC_SUBST(PKG_CONFIG_PATH)
+AC_SUBST(PKG_CONFIG_LIBDIR)
 AC_SUBST(RANLIB)
 AC_SUBST(READELF)
 AC_SUBST(STRIP)
@@ -7045,7 +7137,7 @@ dnl ===================================================================
 dnl Check for system libcmis
 dnl ===================================================================
 # libcmis requires curl and we can't build curl for iOS
-if test $_os != iOS; then
+if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
     ENABLE_LIBCMIS=TRUE
 else
@@ -9198,6 +9290,9 @@ if test "$with_system_libxml" = "auto"; then
     WINNT|iOS|Android)
         with_system_libxml="$with_system_libs"
         ;;
+    Emscripten)
+        with_system_libxml=no
+        ;;
     *)
         if test "$enable_fuzzers" != "yes"; then
             with_system_libxml=yes
@@ -9340,7 +9435,11 @@ no|disable)
         # Python is required to build LibreOffice. In theory we could separate the build-time Python
         # requirement from the choice whether to include Python stuff in the installer, but why
         # bother?
-        AC_MSG_ERROR([Python is required at build time.])
+        if test "$cross_compiling" = yes; then
+            enable_python=system
+        else
+            AC_MSG_ERROR([Python is required at build time.])
+        fi
     fi
     enable_python=no
     AC_MSG_RESULT([none])
@@ -10028,7 +10127,7 @@ if test "$with_system_curl" = "auto"; then
     with_system_curl="$with_system_libs"
 fi
 
-if test "$with_system_curl" = "yes"; then
+if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_CURL=TRUE
 
@@ -10060,6 +10159,8 @@ if test "$with_system_curl" = "yes"; then
     fi
 
     ENABLE_CURL=TRUE
+elif test "$test_curl" = "no"; then
+    AC_MSG_RESULT([none])
 else
     AC_MSG_RESULT([internal])
     SYSTEM_CURL=
@@ -10202,7 +10303,7 @@ AC_SUBST(SYSTEM_OPENLDAP)
 dnl ===================================================================
 dnl Check for system NSS
 dnl ===================================================================
-if test "$enable_fuzzers" != "yes"; then
+if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
     AC_DEFINE(HAVE_FEATURE_NSS)
     ENABLE_NSS="TRUE"
@@ -11363,6 +11464,8 @@ if test -z "$build_vcl_plugins"; then
     build_vcl_plugins="none"
 fi
 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
+VCL_PLUGIN_INFO=$R
+AC_SUBST([VCL_PLUGIN_INFO])
 
 dnl ===================================================================
 dnl check for dbus support
@@ -12403,6 +12506,7 @@ MOC5="moc"
 QT5_GOBJECT_CFLAGS=""
 QT5_GOBJECT_LIBS=""
 QT5_HAVE_GOBJECT=""
+QT5_PLATFORMS_SRCDIR=""
 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
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/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/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index bdacdcd9856e..c10ed5a55048 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,boost,3))
 
 $(eval $(call gb_UnpackedTarball_add_patches,boost,\
 	$(foreach patch,$(boost_patches),external/boost/$(patch)) \
+    external/boost/boost-emscripten-noshm.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/boost/boost-emscripten-noshm.patch.0 b/external/boost/boost-emscripten-noshm.patch.0
new file mode 100644
index 000000000000..f9d27b0b6e11
--- /dev/null
+++ b/external/boost/boost-emscripten-noshm.patch.0
@@ -0,0 +1,11 @@
+--- boost/interprocess/detail/workaround.hpp.orig	2020-12-15 06:31:51.037665526 +0100
++++ boost/interprocess/detail/workaround.hpp	2020-12-15 06:32:39.741281893 +0100
+@@ -31,7 +31,7 @@
+    //////////////////////////////////////////////////////
+    //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
+    //////////////////////////////////////////////////////
+-   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__)
++   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !defined(__EMSCRIPTEN__)
+       #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+    #endif
+ 
diff --git a/external/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 41e7621c789f..1f9b2982c6d5 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 \
@@ -64,14 +65,15 @@ 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-out ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
+		$(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)" \
 		$(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \
-		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
+		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman -pthread" \
 		pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \
 			$(if $(filter LINUX,$(OS)),-Wl$(COMMA)-z$(COMMA)origin \
 					-Wl$(COMMA)-rpath$(COMMA)\\\$$\$$ORIGIN) \
@@ -84,7 +86,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 		$(if $(SYSTEM_FONTCONFIG),,FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)") \
 		$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
-		$(if $(filter ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
+		$(if $(filter EMSCRIPTEN ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
 		$(if $(filter iOS,$(OS)),--enable-quartz --enable-quartz-font) \
 		--disable-valgrind \
 		$(if $(filter iOS,$(OS)),--disable-ft,--enable-ft --enable-fc) \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index fec943762df8..03dffbd01312 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -34,11 +34,12 @@ 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) \
 		$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS="-pthread") \
 		&& $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,pixman,EXTERNAL)
diff --git a/external/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..92db8a1953f3 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 \
@@ -55,7 +55,8 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) :
 			$(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
 			$(if $(filter SOLARIS,$(OS)),LIBS="-lm") \
 			$(if $(filter ANDROID,$(OS)),LIBS="$(gb_STDLIBS)") \
-			CXXFLAGS="$(cppunit_CXXFLAGS)" \
+			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+			CXXFLAGS="$(cppunit_CXXFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS)" \
 		&& cd src \
 		&& $(MAKE) \
 	)
diff --git a/external/cppunit/disable-dynloading.patch b/external/cppunit/disable-dynloading.patch
index a9aa37f6f45d..62ed1deeb635 100644
--- a/external/cppunit/disable-dynloading.patch
+++ b/external/cppunit/disable-dynloading.patch
@@ -17,7 +17,7 @@
 +// Actually this is for iOS and Android where we build the cppunit tests libraries
 +// as plain archives and just link them statically into test fixture programs,
 +// and don't want any stinking duplicate main(), but shouldn't hurt for MacOSX either.
-+#elif defined(__APPLE__) || defined(__ANDROID__)
++#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__)
 +#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN()               \
 +  typedef char __CppUnitPlugInImplementMainDummyTypeDef
  // Unix
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 2a491d965699..94a62e418124 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 b82c7657395b..fdcb80a38363 100644
--- a/external/fontconfig/ExternalProject_fontconfig.mk
+++ b/external/fontconfig/ExternalProject_fontconfig.mk
@@ -21,14 +21,15 @@ $(eval $(call gb_ExternalProject_register_targets,fontconfig,\
 $(call gb_ExternalProject_get_state_target,fontconfig,build) :
 	$(call gb_Trace_StartRange,fontconfig,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
-		./configure \
+		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS) $(if $(filter EMSCRIPTEN,$(OS)),-pthread)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
+		$(gb_RUN_CONFIGURE) ./configure \
 			--disable-shared \
 			--disable-silent-rules \
 			$(if $(filter ANDROID,$(OS)),--with-arch=arm) \
 			--with-expat-includes=$(call gb_UnpackedTarball_get_dir,expat)/lib \
 			--with-expat-lib=$(gb_StaticLibrary_WORKDIR) \
 			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+			$(if $(filter EMSCRIPTEN,$(OS)),ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no) \
 		&& $(MAKE) -C src \
 	)
 	$(call gb_Trace_EndRange,fontconfig,EXTERNAL)
diff --git a/external/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..91fd5c431ef8 100644
--- a/external/hunspell/ExternalProject_hunspell.mk
+++ b/external/hunspell/ExternalProject_hunspell.mk
@@ -24,11 +24,11 @@ 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)') \
-			CXXFLAGS="$(CXXFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS))" \
+			CXXFLAGS="$(CXXFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS))" \
 		&& cd src/hunspell && $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,hunspell,EXTERNAL)
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 4ff8370ebd50..18a8f3838834 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,11 +70,10 @@ $(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 iOS ANDROID,$(OS)),--disable-dyload) \
-			$(if $(filter ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter EMSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--with-data-packaging=static --enable-static --disable-shared --disable-dyload,\
@@ -82,6 +81,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\
 				--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \
 				--disable-tools --disable-extras) \
+			AR="$(AR)" RANLIB="$(RANLIB)" \
 		&& $(MAKE) $(if $(CROSS_COMPILING),DATASUBDIR=data) $(if $(verbose),VERBOSE=1) \
 		$(if $(filter MACOSX,$(OS)), \
 			&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl \
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 435382fa7988..a59d6e8b97d7 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/icu4c-windows-cygwin-cross.patch.1 \
 	external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \
 	$(if $(filter-out ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \
+	external/icu/icu4c-emscripten-cross.patch.1 \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
new file mode 100644
index 000000000000..84c88a68a87d
--- /dev/null
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -0,0 +1,99 @@
+--- icu/source/acinclude.m4.orig	2020-04-22 22:04:20.000000000 +0200
++++ icu/source/acinclude.m4	2020-11-04 06:10:29.993070072 +0100
+@@ -84,6 +84,7 @@
+ *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
+ *-*-nto*)	icu_cv_host_frag=mh-qnx ;;
+ *-ncr-*)	icu_cv_host_frag=mh-mpras ;;
++wasm*-*-emscripten*)	icu_cv_host_frag=mh-emscripten ;;
+ *) 		icu_cv_host_frag=mh-unknown ;;
+ esac
+ 		]
+--- /dev/null
++++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
+@@ -0,0 +1,86 @@
++## Emscripten-specific setup
++## Copyright (c) 1999-2013, International Business Machines Corporation and
++## others. All Rights Reserved.
++## Commands to generate dependency files
++GEN_DEPS.c=  $(CC) -E -MM $(DEFS) $(CPPFLAGS)
++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
++ 
++## Flags for position independent code
++SHAREDLIBCFLAGS = -fPIC
++SHAREDLIBCXXFLAGS = -fPIC
++SHAREDLIBCPPFLAGS = -DPIC
++
++## Additional flags when building libraries and with threads
++THREADSCPPFLAGS = -D_REENTRANT
++LIBCPPFLAGS =
++
++## Compiler switch to embed a runtime search path
++LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN
++LD_RPATH_PRE = -Wl,-rpath,
++
++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH:
++ENABLE_RPATH=YES
++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN'
++
++## These are the library specific LDFLAGS
++#LDFLAGSICUDT=-nodefaultlibs -nostdlib
++# Debian change: linking icudata as data only causes too many problems.
++LDFLAGSICUDT=
++
++## Compiler switch to embed a library name
++# The initial tab in the next line is to prevent icu-config from reading it.
++	LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
++#SH# # We can't depend on MIDDLE_SO_TARGET being set.
++#SH# LD_SONAME=
++
++## Shared library options
++LD_SOOPTIONS= -Wl,-Bsymbolic-functions
++
++## Shared object suffix
++SO = so
++## Non-shared intermediate object suffix
++STATIC_O = o
++
++## Compilation rules
++# WASM needs -pthread for atomics support
++%.$(STATIC_O): $(srcdir)/%.c
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -pthread -o $@ $<)
++
++%.$(STATIC_O): $(srcdir)/%.cpp
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -pthread -o $@ $<)
++
++
++## Dependency rules
++%.d: $(srcdir)/%.c
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++%.d: $(srcdir)/%.cpp
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++## Versioned libraries rules
++
++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
++	$(RM) $@ && ln -s ${<F} $@
++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
++	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
++
++##  Bind internal references
++
++# LDflags that pkgdata will use
++BIR_LDFLAGS= -Wl,-Bsymbolic
++
++# Dependencies [i.e. map files] for the final library
++BIR_DEPS=
++
++## Remove shared library 's'
++STATIC_PREFIX_WHEN_USED =
++STATIC_PREFIX =
++
++## without assembly
++PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc -w
diff --git a/external/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 b9e4254d9b2c..a495db9af11c 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)

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list