[Libreoffice-commits] core.git: Branch 'private/jmux/wasm-for-master' - 18 commits - accessibility/Library_acc.mk accessibility/source avmedia/Library_avmedia.mk avmedia/Module_avmedia.mk avmedia/source basic/Library_sb.mk bin/run bridges/Library_cpp_uno.mk canvas/Executable_canvasdemo.mk canvas/Module_canvas.mk config_host.mk.in configure.ac connectivity/Library_postgresql-sdbc-impl.mk connectivity/Module_connectivity.mk cppuhelper/source cpputools/Module_cpputools.mk cui/Library_cui.mk dbaccess/Module_dbaccess.mk desktop/CppunitTest_desktop_app.mk desktop/CustomTarget_soffice.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/Package_scripts.mk desktop/scripts desktop/source extensions/Module_extensions.mk helpcompiler/Module_helpcompiler.mk i18npool/CustomTarget_breakiterator.mk i18npool/Library_collator_data.mk i18npool/Library_dict_ja.mk i18npool/Library_dict_zh.mk i18npool/Library_i18npool.mk i18npool/Library_index_data.mk i18npool/Library_localedata_en.mk i18npool/Library_l ocaledata_es.mk i18npool/Library_localedata_euro.mk i18npool/Library_localedata_others.mk i18npool/Library_textconv_dict.mk i18npool/source include/svx Makefile.gbuild Makefile.in oox/CppunitTest_oox_tokenmap.mk postprocess/CustomTarget_components.mk postprocess/CustomTarget_registry.mk postprocess/Module_postprocess.mk postprocess/Rdb_services.mk registry/Module_registry.mk RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_host.mk sal/Library_cppunitmain.mk sal/Library_sal.mk sal/Library_sal_textenc.mk sal/Module_sal.mk sccomp/Module_sccomp.mk sc/Library_sc.mk sc/Library_scui.mk sc/Module_sc.mk scripting/Module_scripting.mk sc/source sd/Library_sd.mk sd/Library_sdui.mk sd/source shell/Module_shell.mk slideshow/source solenv/bin solenv/clang-format solenv/gbuild static/CustomTarget_components.mk static/Library_components.mk static/Makefile static/Module_static.mk static/README svl/Library_svl.mk svx/Executable_gengal.mk svx/Library_svxcore.mk svx/Library_svx.mk svx/Module_svx.mk svx/source svx/util sw/CppunitTest_sw_apitests.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_uwriter.mk sw/Library_sw.mk sw/Library_swui.mk sw/source sw/util unotest/source ure/Package_install.mk vcl/Executable_icontest.mk vcl/Executable_mtfdemo.mk vcl/Executable_ui-previewer.mk vcl/Executable_vcldemo.mk vcl/Executable_visualbackendtest.mk vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk4.mk vcl/Library_vclplug_kf5.mk vcl/Library_vclplug_osx.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/source xmlhelp/source xmlsecurity/inc xmlsecurity/IwyuFilter_xmlsecurity.yaml xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/source xmlsecurity/util

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sat May 22 11:47:56 UTC 2021


Rebased ref, commits from common ancestor:
commit 8c52af6f018b2c2d902237f17bb17b42bddfef24
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat May 22 13:30:41 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat May 22 13:45:46 2021 +0200

    no fontconfig
    
    Change-Id: Ica735004d61040651c6ce8b9fd863728c8027495

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 92e1202e1211..249ae868032f 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1384,8 +1384,6 @@ $(call gb_LinkTarget_add_libs,$(1),$(FONTCONFIG_LIBS))
 
 endef
 
-gb_ExternalProject__use_fontconfig :=
-
 else
 
 define gb_LinkTarget__use_fontconfig
@@ -1401,11 +1399,6 @@ $(call gb_LinkTarget_add_libs,$(1),\
 
 endef
 
-define gb_ExternalProject__use_fontconfig
-$(call gb_ExternalProject_use_external_project,$(1),fontconfig)
-
-endef
-
 endif # SYSTEM_FONTCONFIG
 
 ifneq ($(SYSTEM_GRAPHITE),)
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 1f9b2982c6d5..471ae6104361 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_ExternalProject_ExternalProject,cairo))
 $(eval $(call gb_ExternalProject_use_external_project,cairo,pixman))
 
 $(eval $(call gb_ExternalProject_use_externals,cairo,\
-	fontconfig \
 	freetype \
 	libpng \
 	zlib \
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index 8c5de91ef7c6..3cc0a95e3617 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -11,10 +11,7 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,poppler))
 
 $(eval $(call gb_StaticLibrary_use_unpacked,poppler,poppler))
 
-$(eval $(call gb_StaticLibrary_use_externals,poppler,\
-    fontconfig \
-    libjpeg \
-))
+$(eval $(call gb_StaticLibrary_use_external,poppler,libjpeg))
 
 $(eval $(call gb_StaticLibrary_set_warnings_disabled,poppler))
 
commit e55aac4f25405583d8ea7e1e1a227b649a4a43d1
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri May 21 15:41:15 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat May 22 13:45:46 2021 +0200

    Catchall static build
    
    Change-Id: Iafc95752fae9e88095f54a21f1e30a4f080815e2

diff --git a/Makefile.gbuild b/Makefile.gbuild
index 1ce4bca5d9b1..82f7b9b69e59 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -20,8 +20,9 @@ include $(SRCDIR)/solenv/gbuild/gbuild.mk
 
 $(eval $(call gb_Module_make_global_targets,$(SRCDIR)/RepositoryModule_$(gb_Side).mk))
 
-ifneq (,$(DISABLE_DYNLOADING))
+ifeq ($(DISABLE_DYNLOADING),TRUE)
 $(if $(gb_LinkTarget__Lock),$(shell rm -f $(gb_LinkTarget__Lock)))
+include $(SRCDIR)/solenv/gbuild/static.mk
 endif
 
 ifeq ($(ENABLE_SERVICES_RDB_FROM_BUILD),TRUE)
diff --git a/Makefile.in b/Makefile.in
index eba3b6994d62..978cd4e0d618 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,6 +7,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
+unexport UNO_HOME
+
 gb_Top_MODULE_CHECK_TARGETS := slowcheck unitcheck subsequentcheck perfcheck uicheck screenshot
 
 .PHONY : check-if-root bootstrap gbuild build build-non-l10n-only build-l10n-only check clean clean-build clean-host test-install distclean distro-pack-install docs download etags fetch get-submodules id install install-gdb-printers install-strip tags debugrun help showmodules translations packageinfo internal.clean $(gb_Top_MODULE_CHECK_TARGETS)
diff --git a/Repository.mk b/Repository.mk
index b5b72b65562e..7258b3ee4b90 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -296,13 +296,12 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \
 	$(if $(ENABLE_KF5),kf5be1) \
 ))
 
-ifneq (,$(USING_X11))
+ifneq ($(OS),HAIKU)
 $(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,kde, \
     $(if $(ENABLE_KF5),vclplug_kf5) \
     $(if $(ENABLE_QT5),vclplug_qt5) \
     $(if $(ENABLE_GTK3_KDE5),vclplug_gtk3_kde5) \
 ))
-endif
 
 ifneq ($(ENABLE_GTK3_KDE5),)
 $(eval $(call gb_Helper_register_executables_for_install,OOO,kde, \
@@ -310,7 +309,8 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,kde, \
 ))
 endif
 
-ifeq ($(OS),HAIKU)
+else # HAIKU
+
 $(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,haiku, \
     $(if $(ENABLE_QT5),vclplug_qt5) \
     $(if $(ENABLE_KF5),vclplug_kf5) \
@@ -480,13 +480,13 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 
 $(eval $(call gb_Helper_register_plugins_for_install,OOOLIBS,ooo, \
     acc \
+    $(if $(DISABLE_DYNLOADING),components) \
     cui \
     gie \
     sdui \
     $(if $(USING_X11),vclplug_gen) \
     $(if $(filter $(OS),WNT),vclplug_win) \
     $(if $(filter $(OS),MACOSX),vclplug_osx) \
-    $(if $(USING_X11),,$(if $(ENABLE_QT5),vclplug_qt5)) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,postgresqlsdbc, \
@@ -557,6 +557,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
 	$(if $(filter MSC,$(COM)),cli_cppuhelper) \
 	$(if $(filter $(OS),ANDROID),lo-bootstrap) \
 	$(if $(filter $(OS),MACOSX),OOoSpotlightImporter) \
+    cppunitmain \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2329f41e981c..92e1202e1211 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -527,7 +527,9 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\
 	hyphen \
 )
 else
-$(call gb_LinkTarget_add_libs,$(1),$(HYPHEN_LIB))
+$(call gb_LinkTarget_add_libs,$(1),\
+	$(call gb_UnpackedTarball_get_dir,hyphen)/.libs/libhyphen$(gb_StaticLibrary_PLAINEXT) \
+)
 $(call gb_LinkTarget_use_external_project,$(1),hyphen)
 endif
 
@@ -811,12 +813,11 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-	$(call gb_UnpackedTarball_get_dir,libexttextcat)/src/.libs/libexttextcat-2.0.a\
+	$(call gb_UnpackedTarball_get_dir,libexttextcat)/src/.libs/libexttextcat-2.0$(gb_StaticLibrary_PLAINEXT) \
 )
 $(call gb_LinkTarget_use_external_project,$(1),libexttextcat)
 endif
 
-
 endef
 
 endif # SYSTEM_LIBEXTTEXTCAT
@@ -1383,6 +1384,8 @@ $(call gb_LinkTarget_add_libs,$(1),$(FONTCONFIG_LIBS))
 
 endef
 
+gb_ExternalProject__use_fontconfig :=
+
 else
 
 define gb_LinkTarget__use_fontconfig
@@ -1398,6 +1401,11 @@ $(call gb_LinkTarget_add_libs,$(1),\
 
 endef
 
+define gb_ExternalProject__use_fontconfig
+$(call gb_ExternalProject_use_external_project,$(1),fontconfig)
+
+endef
+
 endif # SYSTEM_FONTCONFIG
 
 ifneq ($(SYSTEM_GRAPHITE),)
@@ -3858,7 +3866,7 @@ endif # SYSTEM_JFREEREPORT
 
 define gb_Executable__register_bestreversemap
 $(call gb_Executable_add_runtime_dependencies,bestreversemap,\
-	$(if $(filter $(OS),ANDROID),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(call gb_Library_get_target_for_build,sal_textenc))) \
+    $(if $(filter ANDROID iOS,$(OS)),,$(call gb_Library_get_target_for_build,sal_textenc)) \
 )
 endef
 
@@ -3875,7 +3883,7 @@ endef
 
 define gb_Executable__register_cppumaker
 $(call gb_Executable_add_runtime_dependencies,cppumaker,\
-	$(if $(filter $(OS),ANDROID),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(call gb_Library_get_target,sal_textenc))) \
+	$(if $(filter ANDROID iOS,$(OS)),,$(call gb_Library_get_target,sal_textenc)) \
 )
 endef
 
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index 8df42f077676..1b787929c33b 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	soltools \
 	sot \
 	starmath \
+	$(if $(DISABLE_DYNLOADING),static) \
 	stoc \
 	store \
 	svl \
@@ -160,6 +161,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
 	xmlsecurity \
 ))
 
+ifeq (,$(DISABLE_DYNLOADING))
 # Especially when building everything with symbols, the linking of the largest
 # libraries takes enormous amounts of RAM.	To prevent annoying OOM situations
 # etc., try to prevent linking these in parallel by adding artificial build
@@ -193,5 +195,6 @@ $(eval $(call repositorymodule_serialize,\
 		svx svxcore xo sfx fwk svt vcl) \
 ))
 endif
+endif # !$(DISABLE_DYNLOADING)
 
 # vim: set noet sw=4 ts=4:
diff --git a/bin/run b/bin/run
index 523da3c0e178..6d997552a6c9 100755
--- a/bin/run
+++ b/bin/run
@@ -64,6 +64,7 @@ else
 
     export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${dir}"/instdir/program
     SEARCH_PATH="${LD_LIBRARY_PATH}"
+    export UNO_HOME="file://${dir}/instdir/program"
 
 fi
 
diff --git a/canvas/Module_canvas.mk b/canvas/Module_canvas.mk
index 0ca3c4c9bfe0..79165c4976e7 100644
--- a/canvas/Module_canvas.mk
+++ b/canvas/Module_canvas.mk
@@ -24,8 +24,8 @@ $(eval $(call gb_Module_add_targets,canvas,\
 	Library_canvastools \
 	Library_simplecanvas \
 	Library_vclcanvas \
-	$(if $(filter DESKTOP,$(BUILD_TYPE)), \
-		$(if $(DISABLE_GUI),,Executable_canvasdemo)) \
+    $(if $(filter DESKTOP,$(BUILD_TYPE)), \
+        $(if $(or $(DISABLE_GUI),$(DISABLE_DYNLOADING)),,Executable_canvasdemo)) \
 ))
 
 ifeq ($(ENABLE_CAIRO_CANVAS),TRUE)
diff --git a/configure.ac b/configure.ac
index fe23eab5f91c..3d032a2b7031 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1628,6 +1628,11 @@ AC_ARG_ENABLE(gtk3_kde5,
          platforms where Gtk3, Qt5 and Plasma is available.]),
 ,)
 
+AC_ARG_ENABLE(gen,
+    AS_HELP_STRING([--enable-gen],
+        [To select the gen backend in case of --disable-dynamic-loading])
+,)
+
 AC_ARG_ENABLE(gui,
     AS_HELP_STRING([--disable-gui],
         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
@@ -2903,6 +2908,7 @@ if test "$enable_wasm_strip" = "yes"; then
     enable_database_connectivity=no
     enable_dbus=no
     enable_dconf=no
+    enable_dynamic_loading=no
     enable_extension_integration=no
     enable_extensions=no
     enable_extension_update=no
@@ -2955,6 +2961,10 @@ fi
 if test "$enable_database_connectivity" = yes; then
     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
+else
+    enable_firebird_sdbc=no
+    enable_mariadb_sdbc=no
+    enable_postgresql_sdbc=no
 fi
 
 if test -z "$enable_extensions"; then
@@ -2999,6 +3009,14 @@ if test "$enable_dynamic_loading" = yes; then
     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
 else
     DISABLE_DYNLOADING='TRUE'
+    if test $_os != iOS -a $_os != Android; then
+        enable_database_connectivity=no
+        enable_nss=no
+        enable_odk=no
+        enable_python=no
+        enable_skia=no
+        with_java=no
+    fi
 fi
 AC_SUBST(DISABLE_DYNLOADING)
 
@@ -3756,7 +3774,7 @@ if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
 fi
 
 
-if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
+if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
     # To allow building Windows multi-arch releases without cross-tooling
     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
         cross_compiling="yes"
@@ -5207,6 +5225,10 @@ if test "$with_x" = "no"; then
     USING_X11=
 fi
 
+if test -z "$USING_X11" -a "$DISABLE_DYNLOADING" = TRUE -a "$enable_gen" = "yes"; then
+    AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
+fi
+
 WORKDIR="${BUILDDIR}/workdir"
 INSTDIR="${BUILDDIR}/instdir"
 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
@@ -5633,7 +5655,15 @@ if test "$USING_X11" != TRUE; then
     test_kf5=no
     test_qt5=no
     test_gtk3_kde5=no
-    enable_cairo_canvas=no
+    if test "$DISABLE_DYNLOADING" = TRUE; then
+        enable_cairo_canvas=yes
+        if test "$enable_qt5" = "yes"; then
+            test_qt5=yes
+        fi
+    else
+        enable_cairo_canvas=no
+        enable_gtk3=no
+    fi
 fi
 
 if test "$OS" = "HAIKU"; then
@@ -11467,9 +11497,6 @@ dnl ===================================================================
 dnl Show which vclplugs will be built.
 dnl ===================================================================
 R=""
-if test "$USING_X11" != TRUE; then
-    enable_gtk3=no
-fi
 
 ENABLE_GTK3=""
 if test "x$enable_gtk3" = "xyes"; then
@@ -11499,7 +11526,9 @@ ENABLE_QT5=""
 if test "x$enable_qt5" = "xyes"; then
     ENABLE_QT5="TRUE"
     AC_DEFINE(ENABLE_QT5)
-    R="$R qt5"
+    if test -z "$DISABLE_DYNLOADING" -o \( "$enable_kf5" != "yes" \); then
+        R="$R qt5"
+    fi
 fi
 AC_SUBST(ENABLE_QT5)
 
@@ -11511,7 +11540,7 @@ if test "x$enable_kf5" = "xyes"; then
 fi
 AC_SUBST(ENABLE_KF5)
 
-if test "x$USING_X11" = "xyes"; then
+if test "x$USING_X11" = "xyes" -a \( -z "$DISABLE_DYNLOADING" -o "$enable_gen" = "yes" \); then
     R="$R gen"
 fi
 
@@ -11520,7 +11549,7 @@ if test "$_os" = "WINNT"; then
 elif test "$_os" = "Darwin"; then
     R="$R osx"
 elif test "$_os" = "iOS"; then
-    R="ios (builtin)"
+    R="ios"
 fi
 
 build_vcl_plugins="$R"
@@ -11531,6 +11560,10 @@ AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
 VCL_PLUGIN_INFO=$R
 AC_SUBST([VCL_PLUGIN_INFO])
 
+if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
+    AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
+fi
+
 dnl ===================================================================
 dnl Check for GTK libraries
 dnl ===================================================================
@@ -12267,16 +12300,15 @@ AC_SUBST(CLANG_USE_LD)
 
 SYSTEM_GPGMEPP=
 
+AC_MSG_CHECKING([whether to enable gpgmepp])
 if test "$enable_gpgmepp" = no; then
-    AC_MSG_CHECKING([whether to enable gpgmepp])
     AC_MSG_RESULT([no])
 elif test "$enable_mpl_subset" = "yes"; then
-    AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
-    AC_MSG_RESULT([yes])
+    AC_MSG_RESULT([no (MPL only])
 elif test "$enable_fuzzers" = "yes"; then
-    AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
+    AC_MSG_RESULT([no (oss-fuzz)])
+elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
     AC_MSG_RESULT([yes])
-elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
     dnl ===================================================================
     dnl Check for system gpgme
     dnl ===================================================================
@@ -12351,6 +12383,8 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
         AC_MSG_RESULT([no])
      fi
    fi
+else
+    AC_MSG_RESULT([no (unsuppoted OS or missing NSS)])
 fi
 AC_SUBST(ENABLE_GPGMEPP)
 AC_SUBST(SYSTEM_GPGMEPP)
diff --git a/connectivity/Library_postgresql-sdbc-impl.mk b/connectivity/Library_postgresql-sdbc-impl.mk
index c372f3f0c6f6..aa20969ec2e7 100644
--- a/connectivity/Library_postgresql-sdbc-impl.mk
+++ b/connectivity/Library_postgresql-sdbc-impl.mk
@@ -45,13 +45,15 @@ endif
 $(eval $(call gb_Library_use_externals,postgresql-sdbc-impl,\
 	boost_headers \
 	postgresql \
-	$(if $(filter-out MSC,$(COM)), \
-		openssl \
-		$(if $(ENABLE_LDAP),openldap) \
-		nss3 \
-		plc4 \
-		ssl3 \
-	) \
+    $(if $(filter-out MSC,$(COM)), \
+        $(if $(ENABLE_OPENSSL),openssl) \
+        $(if $(ENABLE_LDAP), \
+            openldap \
+            nss3 \
+            plc4 \
+            ssl3 \
+        ) \
+    ) \
 ))
 
 ifeq ($(SYSTEM_POSTGRESQL),)
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 0f59fb1272da..79bb929183e4 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -20,12 +20,14 @@
 #include <config_folders.h>
 
 #include <sal/config.h>
+#include <sal/log.hxx>
 
 #include <cassert>
 
 #include <com/sun/star/uno/DeploymentException.hpp>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
+#include <osl/thread.h>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
 
@@ -62,7 +64,14 @@ OUString cppu::getUnoIniUri() {
     // clean here is hardish.
     OUString uri("file:///assets/program");
 #else
-    OUString uri(get_this_libpath());
+
+    OUString uri;
+    static const char* uno_home = getenv("UNO_HOME");
+    if (!uno_home)
+        uri = get_this_libpath();
+    else
+        uri = OStringToOUString(uno_home, osl_getThreadTextEncoding());
+
 #ifdef MACOSX
     // We keep both the LO and URE dylibs directly in "Frameworks"
     // (that is, LIBO_LIB_FOLDER) and rc files in "Resources"
@@ -77,7 +86,9 @@ OUString cppu::getUnoIniUri() {
     }
 #endif
 #endif
-    return uri + "/" SAL_CONFIGFILE("uno");
+    uri += "/" SAL_CONFIGFILE("uno");
+    SAL_INFO("cppuhelper", "expected uno config: " << uri);
+    return uri;
 }
 
 bool cppu::nextDirectoryItem(osl::Directory & directory, OUString * url) {
diff --git a/cpputools/Module_cpputools.mk b/cpputools/Module_cpputools.mk
index 5807e3c81f6f..7df84abda2c1 100644
--- a/cpputools/Module_cpputools.mk
+++ b/cpputools/Module_cpputools.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_Module_Module,cpputools))
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
+ifeq (,$(DISABLE_DYNLOADING))
 
 $(eval $(call gb_Module_add_targets,cpputools,\
     Executable_sp2bv \
@@ -19,6 +20,7 @@ $(eval $(call gb_Module_add_targets,cpputools,\
     Executable_uno \
 ))
 
+endif
 endif
 
 # vim:set noet sw=4 ts=4:
diff --git a/desktop/CustomTarget_soffice.mk b/desktop/CustomTarget_soffice.mk
index 1fa356db16b3..b0979c71c0c0 100644
--- a/desktop/CustomTarget_soffice.mk
+++ b/desktop/CustomTarget_soffice.mk
@@ -13,7 +13,7 @@ $(call gb_CustomTarget_get_target,desktop/soffice) : \
 	$(call gb_CustomTarget_get_workdir,desktop/soffice)/soffice.sh
 
 $(call gb_CustomTarget_get_workdir,desktop/soffice)/soffice.sh : \
-		$(SRCDIR)/desktop/scripts/soffice.sh \
+    $(SRCDIR)/desktop/scripts/soffice$(if $(DISABLE_DYNLOADING),_nodyn).sh \
 		| $(call gb_CustomTarget_get_workdir,desktop/soffice)/.dir
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),SED,1)
 	$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),SED)
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index 1c8bdb5691b3..3be81056aad9 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -33,7 +33,7 @@ $(eval $(call gb_Module_add_l10n_targets,desktop,\
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,desktop,\
     Executable_soffice_bin \
-    Executable_unopkg_bin \
+    $(if $(DISABLE_DYNLOADING),,Executable_unopkg_bin) \
     $(if $(ENABLE_BREAKPAD),Executable_minidump_upload) \
     Library_migrationoo2 \
     Library_migrationoo3 \
@@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_targets,desktop,\
 
 ifneq ($(OS),MACOSX)
 ifneq ($(OS),WNT)
+ifeq (,$(DISABLE_DYNLOADING))
 $(eval $(call gb_Module_add_targets,desktop,\
     Pagein_calc \
     Pagein_common \
@@ -52,7 +53,7 @@ $(eval $(call gb_Module_add_targets,desktop,\
     CustomTarget_soffice \
 ))
 
-ifeq ($(USING_X11), TRUE)
+ifeq ($(USING_X11),TRUE)
 $(eval $(call gb_Module_add_targets,desktop,\
     Package_sbase_sh \
     Package_scalc_sh \
@@ -63,9 +64,15 @@ $(eval $(call gb_Module_add_targets,desktop,\
     Package_soffice_sh \
 ))
 endif
+else # $(DISABLE_DYNLOADING)
+$(eval $(call gb_Module_add_targets,desktop, \
+    CustomTarget_soffice \
+    Package_soffice_sh \
+))
 endif
 endif
 endif
+endif # DESKTOP
 
 ifeq ($(OS),WNT)
 
@@ -98,18 +105,10 @@ $(eval $(call gb_Module_add_targets,desktop,\
     WinResTarget_swriter \
 ))
 
-else ifeq ($(OS),MACOSX)
-
-else ifeq ($(OS),ANDROID)
-
-else ifeq ($(OS),iOS)
-
-else ifeq ($(OS),HAIKU)
-
-else
+else ifeq (,$(filter MACOSX ANDROID iOS HAIKU,$(OS)))
 
 $(eval $(call gb_Module_add_targets,desktop,\
-    Executable_oosplash \
+    $(if $(DISABLE_DYNLOADING),,Executable_oosplash) \
 ))
 
 endif
diff --git a/desktop/Package_scripts.mk b/desktop/Package_scripts.mk
index fbd74f43539b..362430532154 100644
--- a/desktop/Package_scripts.mk
+++ b/desktop/Package_scripts.mk
@@ -12,7 +12,9 @@ $(eval $(call gb_Package_Package,desktop_scripts_install,$(SRCDIR)/desktop/scrip
 ifeq (,$(filter MACOSX WNT,$(OS)))
 
 $(eval $(call gb_Package_add_file,desktop_scripts_install,$(LIBO_BIN_FOLDER)/gdbtrace,gdbtrace))
+ifeq (,$(DISABLE_DYNLOADING))
 $(eval $(call gb_Package_add_file,desktop_scripts_install,$(LIBO_BIN_FOLDER)/unopkg,unopkg.sh))
+endif
 
 endif
 
diff --git a/desktop/scripts/soffice_nodyn.sh b/desktop/scripts/soffice_nodyn.sh
new file mode 100755
index 000000000000..274de24727a9
--- /dev/null
+++ b/desktop/scripts/soffice_nodyn.sh
@@ -0,0 +1,185 @@
+#!/bin/sh
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+# use POSIX locale for well-defined tool output
+LO_SAVE_LC_ALL="$LC_ALL"
+LC_ALL=C
+export LC_ALL
+
+#
+# STAR_PROFILE_LOCKING_DISABLED=1
+# export STAR_PROFILE_LOCKING_DISABLED
+#
+
+# file locking now enabled by default
+SAL_ENABLE_FILE_LOCKING=1
+export SAL_ENABLE_FILE_LOCKING
+
+# uncomment line below to disable anti aliasing of fonts
+# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
+
+# uncomment line below if you encounter problems starting soffice on your system
+# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
+
+#@JITC_PROCESSOR_TYPE_EXPORT@
+
+# resolve installation directory
+sd_cwd=$(pwd)
+sd_res="$0"
+while [ -h "$sd_res" ] ; do
+    sd_dirname=$(dirname "$sd_res")
+    cd "$sd_dirname" || exit $?
+    sd_basename=$(basename "$sd_res")
+    sd_res=$(ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g")
+done
+sd_dirname=$(dirname "$sd_res")
+cd "$sd_dirname" || exit $?
+sd_prog=$(pwd)
+cd "$sd_cwd" || exit $?
+
+# try to get some debug output?
+GDBTRACECHECK=
+STRACECHECK=
+VALGRINDCHECK=
+RRCHECK=
+
+# count number of selected checks; only one is allowed
+checks=
+EXTRAOPT=
+# force the --valgrind option if the VALGRIND variable is set
+test -n "$VALGRIND" && EXTRAOPT="--valgrind"
+
+# force the --record option if the RR variable is set
+test -n "$RR" && EXTRAOPT="--record"
+
+for arg in "$@" $EXTRAOPT ; do
+    case "$arg" in
+        --record)
+            if which rr >/dev/null 2>&1 ; then
+                # smoketest may already be recorded => ignore nested
+                RRCHECK="rr record --nested=ignore"
+                checks="c$checks"
+            else
+                echo "Error: Can't find the tool \"rr\", --record option will be ignored."
+                exit 1
+            fi
+            ;;
+        --backtrace)
+            if which gdb >/dev/null 2>&1 ; then
+                GDBTRACECHECK="gdb -nx --command=$sd_prog/gdbtrace --args"
+                checks="c$checks"
+            else
+                echo "Error: Can't find the tool \"gdb\", --backtrace option will be ignored."
+                exit 1
+            fi
+            ;;
+        --strace)
+            if which strace >/dev/null 2>&1 ; then
+                STRACECHECK="strace -o strace.log -f -tt -s 256"
+                checks="c$checks"
+            else
+                echo "Error: Can't find the tool \"strace\", --strace option will be ignored."
+                exit 1;
+            fi
+            ;;
+         --valgrind)
+            test -n "$VALGRINDCHECK" && continue;
+            if which valgrind >/dev/null 2>&1 ; then
+                # another valgrind tool might be forced via the environment variable
+                test -z "$VALGRIND" && VALGRIND="memcheck"
+                # --trace-children-skip is pretty useful but supported only with valgrind >= 3.6.0
+                valgrind_ver=$(valgrind --version | sed -e "s/valgrind-//")
+                valgrind_ver_maj=$(echo "$valgrind_ver" | awk -F. '{ print $1 }')
+                valgrind_ver_min=$(echo "$valgrind_ver" | awk -F. '{ print $2 }')
+                valgrind_skip=
+                if [ "$valgrind_ver_maj" -gt 3 ] || ( [ "$valgrind_ver_maj" -eq 3 ] && [ "$valgrind_ver_min" -ge 6 ] ) ; then
+                    valgrind_skip='--trace-children-skip=*/java,*/gij'
+                fi
+                # finally set the valgrind check
+                VALGRINDCHECK="valgrind --tool=$VALGRIND --trace-children=yes $valgrind_skip --num-callers=50 --error-limit=no"
+                echo "use kill -SIGUSR2 pid to dump traces of active allocations"
+                checks="c$checks"
+                case "$VALGRIND" in
+                helgrind|memcheck|massif|exp-dhat)
+                    export G_SLICE=always-malloc
+                    export GLIBCXX_FORCE_NEW=1
+                    ;;
+                callgrind)
+                    unset MALLOC_CHECK_ MALLOC_PERTURB_ G_SLICE
+                    export SAL_DISABLE_FLOATGRAB=1
+                    export OOO_DISABLE_RECOVERY=1
+                    export SAL_DISABLE_WATCHDOG=1
+                    export LD_BIND_NOW=1
+                    ;;
+                esac
+            else
+                echo "Error: Can't find the tool \"valgrind\", --valgrind option will be ignored"
+                exit 1
+            fi
+            ;;
+    esac
+done
+
+if echo "$checks" | grep -q "cc" ; then
+    echo "Error: The debug options --record, --backtrace, --strace, and --valgrind cannot be used together."
+    echo "       Please, use them one by one."
+    exit 1;
+fi
+
+case "$(uname -s)" in
+OpenBSD)
+# this is a temporary hack until we can live with the default search paths
+    LD_LIBRARY_PATH="$sd_prog${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+    JAVA_HOME=$(javaPathHelper -h libreoffice-java 2> /dev/null)
+    export LD_LIBRARY_PATH
+    if [ -n "${JAVA_HOME}" ]; then
+        export JAVA_HOME
+    fi
+    ;;
+NetBSD|DragonFly)
+# this is a temporary hack until we can live with the default search paths
+    LD_LIBRARY_PATH="$sd_prog${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+    export LD_LIBRARY_PATH
+    ;;
+AIX)
+    LIBPATH="$sd_prog${LIBPATH:+:$LIBPATH}"
+    export LIBPATH
+    ;;
+esac
+
+# restore locale setting, avoiding to export empty LC_ALL, s. tdf#130080
+if [ -n "$LO_SAVE_LC_ALL" ]; then
+    LC_ALL="$LO_SAVE_LC_ALL"
+else
+    unset LC_ALL
+fi
+
+# run soffice.bin directly when you want to get the backtrace
+if [ -n "$GDBTRACECHECK" ] ; then
+    exec $GDBTRACECHECK "$sd_prog/soffice.bin" "$@"
+fi
+
+# valgrind --log-file=valgrind.log does not work well with --trace-children=yes
+if [ -n "$VALGRINDCHECK" ] && [ -z "$VALGRIND" ] ; then
+    echo "redirecting the standard and the error output to valgrind.log"
+    exec > valgrind.log 2>&1
+fi
+
+# oosplash does the rest: forcing pages in, javaldx etc. are
+exec $RRCHECK $VALGRINDCHECK $STRACECHECK "$sd_prog/soffice.bin" "$@"
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk
index 43a32560e64c..f0a4784b8b56 100644
--- a/extensions/Module_extensions.mk
+++ b/extensions/Module_extensions.mk
@@ -13,7 +13,7 @@ $(eval $(call gb_Module_add_l10n_targets,extensions,\
 	AllLangMoTarget_pcr \
 ))
 
-ifneq ($(filter-out iOS ANDROID,$(OS)),)
+ifeq (,$(DISABLE_DYNLOADING))
 $(eval $(call gb_Module_add_targets,extensions,\
 	Library_abp \
 	Library_scn \
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 471ae6104361..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 \
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index 3cc0a95e3617..8c5de91ef7c6 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -11,7 +11,10 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,poppler))
 
 $(eval $(call gb_StaticLibrary_use_unpacked,poppler,poppler))
 
-$(eval $(call gb_StaticLibrary_use_external,poppler,libjpeg))
+$(eval $(call gb_StaticLibrary_use_externals,poppler,\
+    fontconfig \
+    libjpeg \
+))
 
 $(eval $(call gb_StaticLibrary_set_warnings_disabled,poppler))
 
diff --git a/helpcompiler/Module_helpcompiler.mk b/helpcompiler/Module_helpcompiler.mk
index 7bb53abf0b9b..d7b0aae2ee85 100644
--- a/helpcompiler/Module_helpcompiler.mk
+++ b/helpcompiler/Module_helpcompiler.mk
@@ -9,9 +9,14 @@
 
 $(eval $(call gb_Module_Module,helpcompiler))
 
+ifeq (,$(DISABLE_DYNLOADING))
 $(eval $(call gb_Module_add_targets,helpcompiler,\
     Executable_HelpIndexer \
     Executable_HelpLinker \
+))
+endif
+
+$(eval $(call gb_Module_add_targets,helpcompiler,\
     Library_helplinker \
 ))
 
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index e173fdbe46fc..275fedce2d54 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -290,13 +290,13 @@ $(eval $(call gb_Rdb_add_components,services,\
 	desktop/source/migration/services/migrationoo3 \
 	desktop/source/offacc/offacc \
 	$(if $(DISABLE_GUI),,desktop/source/splash/spl) \
-	extensions/source/abpilot/abp \
+	$(if $(DISABLE_DYNLOADING),,extensions/source/abpilot/abp) \
 	$(if $(ENABLE_LDAP),extensions/source/config/ldap/ldapbe2) \
 	$(if $(filter WNT,$(OS)),\
 		extensions/source/config/WinUserInfo/WinUserInfoBe \
 	) \
 	extensions/source/logging/log \
-	extensions/source/scanner/scn \
+	$(if $(DISABLE_DYNLOADING),,extensions/source/scanner/scn) \
 	extensions/source/update/feed/updatefeed \
 	xmlhelp/util/ucpchelp1 \
 	$(if $(filter-out WNT,$(OS)),\
diff --git a/registry/Module_registry.mk b/registry/Module_registry.mk
index 90f7833673d8..29c9f1ab44c5 100644
--- a/registry/Module_registry.mk
+++ b/registry/Module_registry.mk
@@ -9,26 +9,19 @@
 
 $(eval $(call gb_Module_Module,registry))
 
+gb_registry_can_build_exe = $(if $(or $(DISABLE_DYNLOADING),$(ENABLE_MACOSX_SANDBOX)),,$(true))
+
 $(eval $(call gb_Module_add_targets,registry,\
 	Library_reg \
-	$(if $(filter-out $(OS),iOS), \
-		$(if $(ENABLE_MACOSX_SANDBOX),, \
+    $(if $(call gb_registry_can_build_exe), \
 			Executable_regmerge \
 			Executable_regview \
-		) \
 		StaticLibrary_registry_helper \
-	) \
+    ) \
 ))
 
-ifneq ($(OS),iOS) # missing regmerge (see above), needed within test
-
-ifeq ($(ENABLE_MACOSX_SANDBOX),) # ditto
-
 $(eval $(call gb_Module_add_check_targets,registry, \
-    CustomTarget_regcompare_test \
+    $(if $(call gb_registry_can_build_exe),CustomTarget_regcompare_test) \
 ))
 
-endif
-endif
-
 # vim:set noet sw=4 ts=4:
diff --git a/sal/Library_cppunitmain.mk b/sal/Library_cppunitmain.mk
new file mode 100644
index 000000000000..07f51e0c4821
--- /dev/null
+++ b/sal/Library_cppunitmain.mk
@@ -0,0 +1,42 @@
+# -*- 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_Library_Library,cppunitmain))
+
+$(eval $(call gb_Library_set_include,cppunitmain,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/sal/inc \
+))
+
+$(eval $(call gb_Library_use_libraries,cppunitmain,\
+    sal \
+    unoexceptionprotector \
+    unobootstrapprotector \
+    vclbootstrapprotector \
+))
+
+$(eval $(call gb_Library_use_externals,cppunitmain,\
+    boost_headers \
+    cppunit \
+))
+
+$(eval $(call gb_Library_add_exception_objects,cppunitmain,\
+    sal/cppunittester/cppunittester \
+))
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Library_add_ldflags,cppunitmain,\
+    /STACK:10000000 \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index d783c84e39e9..2c67e85b90ef 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -128,29 +128,21 @@ $(eval $(call gb_Library_add_cxxflags,sal,\
 ))
 endif
 
-sal_textenc_code= \
-	sal/textenc/context \
-	sal/textenc/convertbig5hkscs \
-	sal/textenc/converteuctw \
-	sal/textenc/convertgb18030 \
-	sal/textenc/convertisciidevangari \
-	sal/textenc/convertiso2022cn \
-	sal/textenc/convertiso2022jp \
-	sal/textenc/convertiso2022kr \
-	sal/textenc/convertsinglebytetobmpunicode \
-	sal/textenc/tables \
-	sal/textenc/tcvtbyte \
-	sal/textenc/tcvtmb \
-	sal/textenc/tcvtutf7 \
-
-ifeq ($(OS),ANDROID)
-$(eval $(call gb_Library_add_exception_objects,sal,\
-    $(sal_textenc_code) \
-))
-else ifeq ($(DISABLE_DYNLOADING),TRUE)
-
+ifneq (,$(filter ANDROID iOS,$(OS)))
 $(eval $(call gb_Library_add_exception_objects,sal,\
-    $(sal_textenc_code) \
+    sal/textenc/context \
+    sal/textenc/convertbig5hkscs \
+    sal/textenc/converteuctw \
+    sal/textenc/convertgb18030 \
+    sal/textenc/convertisciidevangari \
+    sal/textenc/convertiso2022cn \
+    sal/textenc/convertiso2022jp \
+    sal/textenc/convertiso2022kr \
+    sal/textenc/convertsinglebytetobmpunicode \
+    sal/textenc/tables \
+    sal/textenc/tcvtbyte \
+    sal/textenc/tcvtmb \
+    sal/textenc/tcvtutf7 \
 ))
 endif
 
diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk
index 1a190037f05b..0d5299e033a9 100644
--- a/sal/Module_sal.mk
+++ b/sal/Module_sal.mk
@@ -10,11 +10,11 @@
 $(eval $(call gb_Module_Module,sal))
 
 $(eval $(call gb_Module_add_targets,sal,\
-	$(if $(CROSS_COMPILING),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,Executable_cppunittester)) \
+    $(if $(or $(CROSS_COMPILING),$(DISABLE_DYNLOADING)),Library_cppunitmain,Executable_cppunittester) \
 	$(if $(filter $(OS),ANDROID), \
 		Library_lo-bootstrap) \
 	Library_sal \
-	$(if $(filter $(OS),ANDROID),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,Library_sal_textenc)) \
+    $(if $(filter ANDROID iOS,$(OS)),,Library_sal_textenc) \
 ))
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
@@ -23,6 +23,8 @@ $(eval $(call gb_Module_add_targets,sal,\
 	Executable_osl_process_child \
 ))
 
+endif
+
 $(eval $(call gb_Module_add_check_targets,sal,\
 	$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,CppunitTest_Module_DLL) \
 	$(if $(filter WNT,$(OS)),CppunitTest_sal_comtools) \
@@ -35,6 +37,4 @@ $(eval $(call gb_Module_add_check_targets,sal,\
 	    CompilerTest_sal_rtl_oustring)) \
 ))
 
-endif
-
 # vim: set noet sw=4 ts=4:
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx
index 046be764ba19..4378ad2d2f84 100644
--- a/sd/source/core/typemap.cxx
+++ b/sd/source/core/typemap.cxx
@@ -95,7 +95,49 @@
 #include <svx/galleryitem.hxx>
 #include <svx/sdangitm.hxx>
 
+#ifdef DISABLE_DYNLOADING
+/* Avoid clash with the ones from svx/source/form/typemap.cxx */
+#define aSfxBoolItem_Impl sd_source_core_typemap_aSfxBoolItem_Impl
+#define aSfxInt32Item_Impl sd_source_core_typemap_aSfxInt32Item_Impl
+#define aSfxStringItem_Impl sd_source_core_typemap_aSfxStringItem_Impl
+#define aSfxUInt16Item_Impl sd_source_core_typemap_aSfxUInt16Item_Impl
+#define aSfxUInt32Item_Impl sd_source_core_typemap_aSfxUInt32Item_Impl
+#define aSfxVoidItem_Impl sd_source_core_typemap_aSfxVoidItem_Impl
+#define aSvxClipboardFormatItem_Impl sd_source_core_typemap_aSvxClipboardFormatItem_Impl
+#define aSvxColorItem_Impl sd_source_core_typemap_aSvxColorItem_Impl
+#define aSvxContourItem_Impl sd_source_core_typemap_aSvxContourItem_Impl
+#define aSvxCrossedOutItem_Impl sd_source_core_typemap_aSvxCrossedOutItem_Impl
+#define aSvxFontHeightItem_Impl sd_source_core_typemap_aSvxFontHeightItem_Impl
+#define aSvxFontItem_Impl sd_source_core_typemap_aSvxFontItem_Impl
+#define aSvxLanguageItem_Impl sd_source_core_typemap_aSvxLanguageItem_Impl
+#define aSvxPostureItem_Impl sd_source_core_typemap_aSvxPostureItem_Impl
+#define aSvxShadowedItem_Impl sd_source_core_typemap_aSvxShadowedItem_Impl
+#define aSvxUnderlineItem_Impl sd_source_core_typemap_aSvxUnderlineItem_Impl
+#define aSvxOverlineItem_Impl sd_source_core_typemap_aSvxOverlineItem_Impl
+#define aSvxWeightItem_Impl sd_source_core_typemap_aSvxWeightItem_Impl
+#endif
+
 #define SFX_TYPEMAP
 #include <sdslots.hxx>
 
+#ifdef DISABLE_DYNLOADING
+#undef aSfxBoolItem_Impl
+#undef aSfxInt32Item_Impl
+#undef aSfxStringItem_Impl
+#undef aSfxUInt16Item_Impl
+#undef aSfxUInt32Item_Impl
+#undef aSfxVoidItem_Impl
+#undef aSvxClipboardFormatItem_Impl
+#undef aSvxColorItem_Impl
+#undef aSvxContourItem_Impl
+#undef aSvxCrossedOutItem_Impl
+#undef aSvxFontHeightItem_Impl
+#undef aSvxFontItem_Impl
+#undef aSvxLanguageItem_Impl
+#undef aSvxPostureItem_Impl
+#undef aSvxShadowedItem_Impl
+#undef aSvxTextLineItem_Impl
+#undef aSvxWeightItem_Impl
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index e6d66355c27e..193c46f3d75d 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -9,9 +9,9 @@
 
 $(eval $(call gb_Module_Module,shell))
 
-ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
-$(eval $(call gb_Module_add_targets,shell,\
-	Executable_lngconvex \
+ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
+$(eval $(call gb_Module_add_targets_for_build,shell,\
+	$(if $(filter WNT,$(OS)),Executable_lngconvex) \
 ))
 endif
 
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4189b25eabb3..32288b4e529d 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -344,18 +344,6 @@ core_constructor_list = [
     "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
-# starmath/util/sm.component
-    "Math_FormulaDocument_get_implementation",
-    "Math_XMLContentExporter_get_implementation",
-    "Math_XMLExporter_get_implementation",
-    "Math_XMLImporter_get_implementation",
-    "Math_XMLMetaExporter_get_implementation",
-    "Math_XMLOasisMetaExporter_get_implementation",
-    "Math_XMLOasisMetaImporter_get_implementation",
-    "Math_XMLOasisSettingsExporter_get_implementation",
-    "Math_XMLOasisSettingsImporter_get_implementation",
-    "Math_XMLSettingsExporter_get_implementation",
-    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
 # svl/source/fsstor/fsstorage.component
     "svl_FSStorageFactory_get_implementation",
 # vcl/vcl.android.component
@@ -592,6 +580,17 @@ math_constructor_list = [
 # starmath/util/sm.component
     "Math_XMLOasisMetaExporter_get_implementation",
     "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_FormulaDocument_get_implementation",
+    "Math_XMLContentExporter_get_implementation",
+    "Math_XMLExporter_get_implementation",
+    "Math_XMLImporter_get_implementation",
+    "Math_XMLMetaExporter_get_implementation",
+    "Math_XMLOasisMetaExporter_get_implementation",
+    "Math_XMLOasisMetaImporter_get_implementation",
+    "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_XMLOasisSettingsImporter_get_implementation",
+    "Math_XMLSettingsExporter_get_implementation",
+    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
     ]
 
 calc_factory_list = [
@@ -736,6 +735,198 @@ writer_constructor_list = [
     "com_sun_star_comp_Writer_EPUBExportFilter_get_implementation",
     ]
 
+desktop_factory_list = [
+    ]
+
+desktop_constructor_list = [
+    "com_sun_star_comp_bridge_BridgeFactory_get_implementation",
+    "com_sun_star_comp_bridge_BridgeFactory_get_implementation",
+    "com_sun_star_comp_configuration_ConfigurationProvider_get_implementation",
+    "com_sun_star_comp_configuration_ConfigurationRegistry_get_implementation",
+    "com_sun_star_comp_configuration_DefaultProvider_get_implementation",
+    "com_sun_star_comp_configuration_ReadOnlyAccess_get_implementation",
+    "com_sun_star_comp_configuration_ReadWriteAccess_get_implementation",
+    "com_sun_star_comp_deployment_component_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_deployment_configuration_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_deployment_executable_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_deployment_ExtensionManager_get_implementation",
+    "com_sun_star_comp_deployment_ExtensionManager_get_implementation",
+    "com_sun_star_comp_deployment_help_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_deployment_PackageManagerFactory_get_implementation",
+    "com_sun_star_comp_deployment_PackageManagerFactory_get_implementation",
+    "com_sun_star_comp_deployment_ProgressLog_get_implementation",
+    "com_sun_star_comp_deployment_script_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_deployment_sfwk_PackageRegistryBackend_get_implementation",
+    "com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation",
+    "com_sun_star_comp_frame_SessionListener_get_implementation",
+    "com_sun_star_comp_framework_AddonsToolBarFactory_get_implementation",
+    "com_sun_star_comp_framework_Desktop_get_implementation",
+    "com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation",
+    "com_sun_star_comp_framework_Frame_get_implementation",
+    "com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation",
+    "com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation",
+    "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
+    "com_sun_star_comp_framework_JobExecutor_get_implementation",
+    "com_sun_star_comp_framework_LangSelectionStatusbarController_get_implementation",
+    "com_sun_star_comp_framework_LayoutManager_get_implementation",
+    "com_sun_star_comp_framework_MenuBarFactory_get_implementation",
+    "com_sun_star_comp_framework_MenuBarFactory_get_implementation",
+    "com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation",
+    "com_sun_star_comp_framework_ModuleManager_get_implementation",
+    "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation",
+    "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation",
+    "com_sun_star_comp_framework_ObjectMenuController_get_implementation",
+    "com_sun_star_comp_framework_PathSettings_get_implementation",
+    "com_sun_star_comp_framework_PathSubstitution_get_implementation",
+    "com_sun_star_comp_framework_PopupMenuControllerFactory_get_implementation",
+    "com_sun_star_comp_framework_RecentFilesMenuController_get_implementation",
+    "com_sun_star_comp_framework_RecentFilesMenuController_get_implementation",
+    "com_sun_star_comp_framework_ResourceMenuController_get_implementation",
+    "com_sun_star_comp_framework_SaveToolbarController_get_implementation",
+    "com_sun_star_comp_framework_SaveToolbarController_get_implementation",
+    "com_sun_star_comp_framework_StatusBarControllerFactory_get_implementation",
+    "com_sun_star_comp_framework_StatusBarFactory_get_implementation",
+    "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation",
+    "com_sun_star_comp_framework_SubToolBarController_get_implementation",
+    "com_sun_star_comp_framework_SubToolBarController_get_implementation",
+    "com_sun_star_comp_framework_TaskCreator_get_implementation",
+    "com_sun_star_comp_framework_ToolbarAsMenuController_get_implementation",
+    "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation",
+    "com_sun_star_comp_framework_ToolBarFactory_get_implementation",
+    "com_sun_star_comp_framework_ToolBarFactory_get_implementation",
+    "com_sun_star_comp_framework_UICommandDescription_get_implementation",
+    "com_sun_star_comp_framework_UICommandDescription_get_implementation",
+    "com_sun_star_comp_framework_UIConfigurationManager_get_implementation",
+    "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",
+    "com_sun_star_comp_framework_URLTransformer_get_implementation",
+    "com_sun_star_comp_framework_WindowListMenuController_get_implementation",
+    "com_sun_star_comp_framework_WindowListMenuController_get_implementation",
+    "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation",
+    "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
+    "com_sun_star_comp_office_FrameLoader_get_implementation",
+    "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation",
+    "com_sun_star_comp_sfx2_BackingComp_get_implementation",
+    "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation",
+    "com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation",
+    "com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation",
+    "com_sun_star_comp_stoc_CoreReflection_get_implementation",
+    "com_sun_star_comp_stoc_Introspection_get_implementation",
+    "com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_ColorToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_CTLToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_Impl_FindbarDispatcher_get_implementation",
+    "com_sun_star_comp_svx_Impl_FindbarDispatcher_get_implementation",
+    "com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_RecoveryUI_get_implementation",
+    "com_sun_star_comp_svx_StyleToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_TableToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_TableToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_UndoRedoToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_UndoRedoToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation",
+    "com_sun_star_comp_uri_ExternalUriReferenceTranslator_get_implementation",
+    "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
+    "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
+    "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
+    "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
+    "com_sun_star_extensions_xml_sax_Writer_get_implementation",
+    "com_sun_star_frame_VCLSessionManagerClient_get_implementation",
+    "com_sun_star_i18n_BreakIterator_get_implementation",
+    "com_sun_star_i18n_BreakIterator_Unicode_get_implementation",
+    "com_sun_star_i18n_CharacterClassification_get_implementation",
+    "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation",
+    "com_sun_star_i18n_Collator_get_implementation",
+    "com_sun_star_i18n_LocaleDataImpl_get_implementation",
+    "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation",
+    "com_sun_star_i18n_Transliteration_get_implementation",
+    "com_sun_star_i18n_Transliteration_IGNORE_CASE_get_implementation",
+    "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation",
+    "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation",
+    "com_sun_star_svx_DownSearchToolboxController_get_implementation",
+    "com_sun_star_svx_ExitFindbarToolboxController_get_implementation",
+    "com_sun_star_svx_FindAllToolboxController_get_implementation",
+    "com_sun_star_svx_FindTextToolboxController_get_implementation",
+    "com_sun_star_svx_FontHeightToolBoxController_get_implementation",
+    "com_sun_star_svx_MatchCaseToolboxController_get_implementation",
+    "com_sun_star_svx_SearchLabelToolboxController_get_implementation",
+    "com_sun_star_svx_UpSearchToolboxController_get_implementation",
+    "com_sun_star_text_DefaultNumberingProvider_get_implementation",
+    "dtrans_CMimeContentTypeFactory_get_implementation",
+    "filter_ConfigFlush_get_implementation",
+    "filter_ContentHandlerFactory_get_implementation",
+    "filter_FilterFactory_get_implementation",
+    "filter_FrameLoaderFactory_get_implementation",
+    "filter_TypeDetection_get_implementation",
+    "framework_FooterMenuController_get_implementation",
+    "framework_FooterMenuController_get_implementation",
+    "framework_HeaderMenuController_get_implementation",
+    "framework_HeaderMenuController_get_implementation",
+    "framework_LanguageSelectionMenuController_get_implementation",
+    "framework_LanguageSelectionMenuController_get_implementation",
+    "framework_MacrosMenuController_get_implementation",
+    "framework_MacrosMenuController_get_implementation",
+    "framework_NewMenuController_get_implementation",
+    "framework_NewMenuController_get_implementation",
+    "framework_ServiceHandler_get_implementation",
+    "framework_ServiceHandler_get_implementation",
+    "framework_ToolbarsMenuController_get_implementation",
+    "framework_ToolbarsMenuController_get_implementation",
+    "i18npool_Collator_Unicode_get_implementation",
+    "IndexedPropertyValuesContainer_get_implementation",
+    "lingucomponent_Hyphenator_get_implementation",
+    "lingucomponent_LangGuess_get_implementation",
+    "lingucomponent_SpellChecker_get_implementation",
+    "lingucomponent_Thesaurus_get_implementation",
+    "linguistic_DicList_get_implementation",
+    "linguistic_GrammarCheckingIterator_get_implementation",
+    "linguistic_LinguProps_get_implementation",
+    "linguistic_LngSvcMgr_get_implementation",
+    "lo_writer_NavElementToolBoxController_get_implementation",
+    "lo_writer_NextScrollToolboxController_get_implementation",
+    "lo_writer_PreviousScrollToolboxController_get_implementation",
+    "org_apache_openoffice_comp_framework_ContextChangeEventMultiplexer_get_implementation",
+    "org_apache_openoffice_comp_framework_NewToolbarController_get_implementation",
+    "org_apache_openoffice_comp_framework_NewToolbarController_get_implementation",
+    "org_apache_openoffice_comp_svx_sidebar_PanelFactory_get_implementation",
+    "package_ManifestReader_get_implementation",
+    "package_OStorageFactory_get_implementation",
+    "package_OZipFileAccess_get_implementation",
+    "package_ZipPackage_get_implementation",
+    "SfxDocumentMetaData_get_implementation",
+    "shell_DesktopBackend_get_implementation",
+    "shell_LocaleBackend_get_implementation",
+    "stardiv_Toolkit_VCLXPopupMenu_get_implementation",
+    "stardiv_Toolkit_VCLXToolkit_get_implementation",
+    "stoc_FactoryImpl_get_implementation",
+    "svl_FSStorageFactory_get_implementation",
+    "ucb_expand_ExpandContentProviderImpl_get_implementation",
+    "ucb_file_FileProvider_get_implementation",
+    "ucb_OFileAccess_get_implementation",
+    "ucb_tdoc_ContentProvider_get_implementation",
+    "ucb_tdoc_DocumentContentFactory_get_implementation",
+    "ucb_UcbContentProviderProxyFactory_get_implementation",
+    "ucb_UcbStore_get_implementation",
+    "ucb_UniversalContentBroker_get_implementation",
+    "unotools_OTempFileService_get_implementation",
+    "unoxml_CDocumentBuilder_get_implementation",
+    "unoxml_CURI_get_implementation",
+    "unoxml_CXPathAPI_get_implementation",
+    "unoxml_rdfRepository_get_implementation",
+    "vcl_SystemClipboard_get_implementation",
+    "Writer_SwTextDocument_get_implementation",
+    "com_sun_star_comp_svx_FrameToolBoxControl_get_implementation",
+    "com_sun_star_i18n_InputSequenceChecker_get_implementation",
+    "com_sun_star_comp_extensions_SimpleTextFormatter",
+    "com_sun_star_comp_extensions_LoggerPool",
+    "com_sun_star_comp_extensions_FileHandler",
+    "com_sun_star_comp_extensions_PlainTextFormatter",
+    "desktop_SplashScreen_get_implementation",
+    ]
+
 factory_map = {
     'core' : core_factory_list,
     'edit' : edit_factory_list,
@@ -743,6 +934,7 @@ factory_map = {
     'calc' : calc_factory_list,
     'draw' : draw_factory_list,
     'writer' : writer_factory_list,
+    'desktop' : desktop_factory_list,
     }
 
 constructor_map = {
@@ -752,6 +944,7 @@ constructor_map = {
     'calc' : calc_constructor_list,
     'draw' : draw_constructor_list,
     'writer' : writer_constructor_list,
+    'desktop' : desktop_constructor_list,
     }
 
 custom_widgets = [
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index ebfad1358fb5..7e31384f6cd4 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -74,8 +74,13 @@ endif
 
 # defined by platform
 #  gb_CppunitTest_get_filename
+ifeq (,$(DISABLE_DYNLOADING))
 gb_CppunitTest_RUNTIMEDEPS := $(call gb_Executable_get_runtime_dependencies,cppunittester)
 gb_CppunitTest_CPPTESTCOMMAND := $(call gb_Executable_get_target_for_build,cppunittester)
+else
+gb_CppunitTest_RUNTIMEDEPS :=
+gb_CppunitTest_CPPTESTCOMMAND :=
+endif
 
 # i18npool dlopens localedata_* libraries.
 gb_CppunitTest_RUNTIMEDEPS += \
@@ -205,6 +210,11 @@ $(call gb_CppunitTest_get_target,$(1)) : HEADLESS := --headless
 $(call gb_CppunitTest_get_target,$(1)) : EXTRA_ENV_VARS :=
 $$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
 $(call gb_Helper_make_userfriendly_targets,$(1),CppunitTest)
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$$(eval $$(call gb_CppunitTest_use_libraries,$(1),cppunitmain))
+$$(eval $$(call gb_CppunitTest_add_defs,$(1),-D__EMSCRIPTEN__))
+endif
+$(if $(filter $(1),$(gb_CppunitTest_KNOWN)),,gb_CppunitTest_KNOWN += $(1))
 
 endef
 
diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk
index afb76c3a19d8..8474cf22a38f 100644
--- a/solenv/gbuild/ExternalProject.mk
+++ b/solenv/gbuild/ExternalProject.mk
@@ -184,9 +184,9 @@ endef
 #
 # gb_ExternalProject_use_libraries external libraries
 define gb_ExternalProject_use_libraries
-ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)))
 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
-$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
 endif
 ifneq (,$$(filter $$(gb_MERGEDLIBS),$(2)))
 $$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter $$(gb_MERGEDLIBS),$(2)) because they are merged.))
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index d25f48cbaddf..ad2d3218f3c7 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -128,6 +128,9 @@ $(if $(3),$(call gb_Output_error,gb_Library_set_soversion_script: too many argum
 $(call gb_Library__set_soversion_script_platform,$(1),$(2))
 endef
 
+gb_Library__get_component_var = $(call gb_Library__get_workdir_linktargetname,$(1))<>COMPONENTFILE
+gb_Library__get_component = $($(call gb_Library__get_component_var,$(1)))
+
 # The dependency from workdir component target to outdir library should ensure
 # that gb_CppunitTest_use_component can transitively depend on the library.
 # But the component target also must be delivered; use the target
@@ -145,6 +148,7 @@ $(call gb_ComponentTarget_get_target,$(2)) :| \
 	$(call gb_Library_get_target,$(gb_Library__get_name))
 $(call gb_Library_get_clean_target,$(gb_Library__get_name)) : \
 	$(call gb_ComponentTarget_get_clean_target,$(2))
+$(eval $(call gb_Library__get_component_var,$(1)) += $(2))
 endef
 
 # call gb_Library_set_componentfiles,library,componentfiles
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index fc3da68beb06..db7f059f6c8f 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -36,6 +36,12 @@
 #  gb_LinkTarget_INCLUDE
 #  gb_YaccTarget__command(grammar-file, stem-for-message, source-target, include-target)
 
+# For the static build on Windows we have to track system libraries from gb_Library_use_system_win32_libs.
+# Instead of yet an other tracking dep file, this flags these libraries (and some linker parameters) with
+# an @ postfix. But now these must be filtered out, so this defines that filter, just in case we need to
+# change the filter, because it conflicts.
+gb_LinkTarget__syslib = %@
+
 # Detect whether symbols should be enabled for the given gbuild target.
 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
 gb_LinkTarget__symbols_enabled = \
@@ -45,16 +51,20 @@ gb_LinkTarget__symbols_enabled = \
 
 # debug flags, if the LinkTarget is named in the list of libraries of ENABLE_SYMBOLS_FOR
 gb_LinkTarget__get_debugflags= \
-$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
-$(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS), \
-$(gb_COMPILERNOOPTFLAGS))) \
-$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
+    $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
+        $(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS),$(gb_COMPILERNOOPTFLAGS))) \
+    $(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
 
+# T_LDFLAGS is just expanded once. Override the flags here, so that the linker and compiler use the same.
+ifeq (EMSCRIPTEN,$(OS))
+gb_LinkTarget__get_debugldflags=$(call gb_LinkTarget__get_debugflags,$1)
+else
 # similar for LDFLAGS, use linker optimization flags in non-debug case,
 # but moreover strip debug from libraries for which debuginfo is not wanted
 # (some libraries reuse .o files from other libraries, notably unittests)
 gb_LinkTarget__get_stripldflags=$(if $(strip $(CFLAGS)$(CXXFLAGS)$(OBJCFLAGS)$(OBJCXXFLAGS)$(LDFLAGS)),,$(gb_LINKERSTRIPDEBUGFLAGS))
 gb_LinkTarget__get_debugldflags=$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS),$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1)))
+endif
 
 # generic cflags/cxxflags to use (optimization flags, debug flags)
 # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
@@ -597,6 +607,11 @@ $(WORKDIR)/Clean/LinkTarget/% :
 		$(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \
 		$(call gb_LinkTarget_get_target,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_dep_target,$(LINKTARGET)) \
+		$(if $(gb_PARTIAL_BUILD),, \
+			$(call gb_LinkTarget_get_dep_libraries_target,$(LINKTARGET)) \
+			$(call gb_LinkTarget_get_dep_externals_target,$(LINKTARGET)) \
+			$(call gb_LinkTarget_get_dep_statics_target,$(LINKTARGET)) \
+			) \
 		$(call gb_LinkTarget_get_headers_target,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_objects_list,$(LINKTARGET)) \
 		$(call gb_LinkTarget_get_pch_timestamp,$(LINKTARGETMAKEFILENAME)) \
@@ -610,7 +625,7 @@ $(WORKDIR)/Clean/LinkTarget/% :
 # cat the deps of all objects in one file, then we need only open that one file
 # call gb_LinkTarget__command_dep,dep_target,linktargetname
 define gb_LinkTarget__command_dep
-$(call gb_Output_announce,LNK:$(2),$(true),DEP,1)
+$(call gb_Output_announce,LNK:$(2).d,$(true),DEP,1)
 	$(call gb_Trace_StartRange,LNK:$(2),DEP)
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
@@ -673,12 +688,24 @@ $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_headers_target,
 
 endef
 
+define gb_LinkTarget__add_linked_libs
+$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
+
+endef
+
 # it's not possible to use a pattern rule for files in INSTDIR because
 # it would inevitably conflict with the pattern rule for Package
 # (especially since external libraries are delivered via Package)
 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
 define gb_LinkTarget__command_impl
 	$(if $(gb_FULLDEPS),
+		$(if $(DISABLE_DYNLOADING),$(if $(gb_PARTIAL_BUILD),,
+			$(call gb_LinkTarget__command_dep_libraries,$(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp,$(2))
+			mv $(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp $(call gb_LinkTarget_get_dep_libraries_target,$(2))
+			$(call gb_LinkTarget__command_dep_externals,$(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp,$(2))
+			mv $(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp $(call gb_LinkTarget_get_dep_externals_target,$(2))
+			$(call gb_LinkTarget__command_dep_statics,$(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp,$(2))
+			mv $(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp $(call gb_LinkTarget_get_dep_statics_target,$(2))))
 		$(if $(findstring concat-deps,$(2)),,
 			$(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$(2)).tmp,$(2))
 			mv $(call gb_LinkTarget_get_dep_target,$(2)).tmp $(call gb_LinkTarget_get_dep_target,$(2))))
@@ -695,7 +722,36 @@ endef
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
 	$(call gb_LinkTarget__command_dep,$@,$*)
+
+$(dir $(call gb_LinkTarget_get_dep_target,%))/.dir :
+	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+ifeq (,$(gb_PARTIAL_BUILD))
+
+define gb_LinkTarget__static_dep_x_template
+
+define gb_LinkTarget__command_dep_$(1)
+$$(call gb_Output_announce,LNK:$$(2).d.$(1),$$(true),DEP,1)
+mkdir -p $$(dir $$(1)) && \
+TEMPFILE=$$(call var2file,$$(shell $$(gb_MKTEMP)),200,\
+	$$(call gb_LinkTarget__get_all_$(1),$$(2))) && \
+	$$(call gb_Helper_replace_if_different_and_touch,$$$${TEMPFILE},$$(1))
+
+endef
+
+$$(call gb_LinkTarget_get_dep_$(1)_target,%) : ;
+	$$(call gb_LinkTarget__command_dep_$(1),$$@,$$*)
+
+endef # gb_LinkTarget__static_dep_x_template
+
+$(eval $(call gb_LinkTarget__static_dep_x_template,libraries))
+$(eval $(call gb_LinkTarget__static_dep_x_template,externals))
+$(eval $(call gb_LinkTarget__static_dep_x_template,statics))
+
 endif
+endif
+endif # $(gb_FULLDEPS)
 
 # Ok, this is some dark voodoo: When declaring a linktarget with
 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
@@ -851,7 +907,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS :=
 $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS :=
-endif
+endif # $(gb_FULLDEPS)
 
 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := cxx
 
@@ -860,7 +916,7 @@ $(if $(findstring $(INSTDIR),$(1)),$(call gb_LinkTarget__make_installed_rule,$(1
 
 $(call gb_PrecompiledHeader_generate_timestamp_rule,$(2))
 
-endef
+endef # gb_LinkTarget_LinkTarget
 
 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
 define gb_LinkTarget_set_soversion_script
@@ -1022,6 +1078,32 @@ $(call gb_Library_get_target,$(1)) :| $(call gb_Library_get_headers_target,$(1))
 
 endef
 
+define gb_LinkTarget__generate_all_x_accessors
+gb_LinkTarget__get_all_$(1)_var = $$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))<>ALL_$(2)
+gb_LinkTarget__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(1)))
+gb_Library__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Library_get_linktarget,$$(1))))
+gb_Executable__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Executable_get_linktarget,$$(1))))
+gb_ExternalProject__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_ExternalProject__get_workdir_linktargetname,$$(1))))
+gb_CppunitTest__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_CppunitTest__get_workdir_linktargetname,$$(1))))
+
+endef
+
+$(eval $(call gb_LinkTarget__generate_all_x_accessors,libraries,LIBRARIES))
+gb_LinkTarget__filter_lo_libraries = $(filter-out $(gb_LinkTarget__syslib),$(1))
+gb_LinkTarget__get_all_lo_libraries = $(call gb_LinkTarget__filter_lo_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
+gb_LinkTarget__filter_sys_libraries = $(patsubst $(gb_LinkTarget__syslib),%,$(filter $(gb_LinkTarget__syslib),$(1)))
+gb_LinkTarget__get_all_sys_libraries = $(call gb_LinkTarget__filter_sys_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
+$(eval $(call gb_LinkTarget__generate_all_x_accessors,externals,EXTERNALS))
+$(eval $(call gb_LinkTarget__generate_all_x_accessors,statics,STATICS))
+
+# call gb_LinkTarget__register_type,type,linktarget,type list
+define gb_LinkTarget__register_type
+$(foreach type,$(3),$(if $(filter $(type),$(call gb_LinkTarget__get_all_$(1),$(2))),, \
+    $(if $(gb_DEBUG_STATIC),$$(info $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type))) \
+    $$(eval $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type)) \
+))
+endef
+
 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
 define gb_LinkTarget__use_libraries
 
@@ -1035,16 +1117,34 @@ endif
 
 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
 
+$(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(2)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
+    $(eval $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_Library_get_headers_target,$(lib))) \
+    $(call gb_LinkTarget__lib_dummy_depend,$(lib)) \
+))
+
+ifeq (,$(DISABLE_DYNLOADING))
 # depend on the exports of the library, not on the library itself
 # for faster incremental builds when the ABI is unchanged
-ifeq ($(DISABLE_DYNLOADING),)
-$(call gb_LinkTarget_get_target,$(1)) : \
-	$(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib)))
+$(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
+    $(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_exports_target,$(lib))) \
+))
+
+else # $(DISABLE_DYNLOADING)
+ifeq (,$(gb_PARTIAL_BUILD))
+$(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(call gb_LinkTarget__filter_sys_libraries,$(3))
+endif
+ifneq (,$(filter Library StaticLibrary,$(call gb_LinkTarget__get_workdir_linktargetclass,$(1))))
+
+# make silently fails, if the input line gets too long, so we can't use the
+# "target: (foreach lib, (call get_target,lib))" variant and must use eval.
+$(if $(filter-out Library,gb_LinkTarget__get_workdir_linktargetclass,$(1)), \
+    $(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
+        $(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_target,$(lib))) \
+    )))
 endif
 
-$(call gb_LinkTarget_get_headers_target,$(1)) : \
-	$(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
-$(foreach lib,$(2),$(call gb_LinkTarget__lib_dummy_depend,$(lib)))
+$(call gb_LinkTarget__register_type,libraries,$(1),$(3))
+endif # $(DISABLE_DYNLOADING)
 
 endef
 
@@ -1088,9 +1188,9 @@ endef
 
 # call gb_LinkTarget_use_libraries,linktarget,libs
 define gb_LinkTarget_use_libraries
-ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)))
 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
-$$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+$$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk))
 endif
 ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS)))
 ifneq (,$$(filter $(1),$$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library__get_workdir_linktargetname,$(plugin)))))
@@ -1128,13 +1228,22 @@ $(if $(call gb_LinkTarget__is_merged,$(1)),\
 	$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : \
 		LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2)))
 
-ifeq ($(DISABLE_DYNLOADING),)
-$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib)))
-endif
 $(call gb_LinkTarget_get_headers_target,$(1)) : \
 	$(foreach lib,$(2),$(call gb_StaticLibrary_get_headers_target,$(lib)))
 $(foreach lib,$(2),$(call gb_LinkTarget__static_lib_dummy_depend,$(lib)))
 
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+ifneq (,$(filter Library StaticLibrary,$(call gb_LinkTarget__get_workdir_linktargetclass,$(1))))
+$(foreach lib,$(2), \
+    $(if $(gb_DEBUG_STATIC),$$(info $(call gb_LinkTarget_get_target,$(1)): $(call gb_StaticLibrary_get_target,$(lib)))) \
+    $$(eval $(call gb_LinkTarget_get_target,$(1)): $(call gb_StaticLibrary_get_target,$(lib))) \
+)
+endif
+$(call gb_LinkTarget__register_type,statics,$(1),$(2))
+else # $(DISABLE_DYNLOADING)
+$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib)))
+endif
+
 endef
 
 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
@@ -1513,8 +1622,10 @@ endef
 
 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
 define gb_LinkTarget_set_ilibtarget
+ifeq (,$(DISABLE_DYNLOADING))
 $(call gb_LinkTarget_get_clean_target,$(1)) \
 $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET := $(2)
+endif
 
 endef
 
@@ -1531,7 +1642,7 @@ $(2) : $(call gb_LinkTarget_get_target,$(1))
 		touch -r $$< $$@; \
 	else \
 		rm -f $$<; \
-		echo "ERROR: aux-target missing, library deleted, please try running make again"; \
+		echo "ERROR: aux-target $$@ missing, library deleted, please try running make again"; \
 		false; \
 	fi
 
@@ -1741,6 +1852,10 @@ $(if $(filter undefined,$(origin gb_LinkTarget__use_$(2))),\
   $(if $(call gb_LinkTarget__is_merged,$(1)),$(call gb_LinkTarget__use_$(2),$(call gb_Library_get_linktarget,merged))) \
     $(call gb_LinkTarget__use_$(2),$(1)) \
 )
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(call gb_LinkTarget__register_type,externals,$(1),$(2))
+endif
+
 endef
 
 # $(call gb_LinkTarget_use_externals,library,externals)
@@ -1808,9 +1923,9 @@ endef
 #
 # call gb_LinkTarget__set_plugin_for,linktarget,loader,nodep
 define gb_LinkTarget__set_plugin_for
-ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
+ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)))
 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
-$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
+$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
 endif
 ifeq (,$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin)))))
 $$(eval $$(call gb_Output_error,Unknown plugin(s) '$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin))))'. Plugins must be registered in Repository.mk or RepositoryExternal.mk))
@@ -1822,6 +1937,7 @@ ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
 $$(eval $$(call gb_Output_error,Plugin support for build tools not implemented))
 endif
 
+$(if $(filter $(2),$(gb_Library_KNOWNLOADERS)),,gb_Library_KNOWNLOADERS += $(2))
 $(if $(3),,$(call gb_LinkTarget__use_libraries,$(1),$(2),$(2)))
 
 endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 46e875d6d227..40360a296b73 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -111,16 +111,30 @@ gb_JunitTest_get_classsetname = JunitTest/$(1)
 gb_JunitTest_get_target = $(WORKDIR)/JunitTest/$(1)/done
 gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user
 gb_PythonTest_get_target = $(WORKDIR)/PythonTest/$(1)/done
+
+# linktarget = class/object<>some_optional_target, like Library/libswlo.so<>/.../instdir/program/libswlo.so
+# while the target is optional, the workdir functions will always work correctly
 gb_LinkTarget__get_workdir_linktargetname = $(firstword $(subst <>,  ,$(1)))
+gb_LinkTarget__get_workdir_linktargetclass =  $(firstword $(subst /,  ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))))
+gb_LinkTarget__get_workdir_linktargetobject = $(lastword $(subst /,  ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))))
+gb_LinkTarget_get_target = $(lastword $(subst <>,  ,$(1)))
+gb_Executable_get_linktargetfile = $(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$1))
+gb_CppunitTest_get_linktargetfile = $(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$1))
+
 gb_LinkTarget_get_headers_target = \
  $(WORKDIR)/Headers/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))
 gb_LinkTarget_get_objects_list = \
  $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objectlist
 gb_LinkTarget_get_dep_target = \
  $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d
+gb_LinkTarget_get_dep_libraries_target = \
+ $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.libraries
+gb_LinkTarget_get_dep_externals_target = \
+ $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.externals
+gb_LinkTarget_get_dep_statics_target = \
+ $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.statics
 gb_LinkTarget_get_clean_target = \
  $(WORKDIR)/Clean/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))
-gb_LinkTarget_get_target = $(lastword $(subst <>,  ,$(1)))
 gb_LinkTarget_get_pch_timestamp = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(1))/Timestamps/$(1)
 gb_LinkTarget_get_pch_reuse_timestamp = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(1))/Timestamps/$(1)_reuse
 gb_Module_get_nonl10n_target = $(WORKDIR)/Module/nonl10n/$(1)
@@ -391,6 +405,10 @@ define gb_Executable_get_linktarget
 $(call gb_Executable__get_workdir_linktargetname,$(1))<>$(call gb_Executable_get_target,$(1))
 endef
 
+define gb_ExternalProject__get_workdir_linktargetname
+ExternalProject/$(1)
+endef
+
 define gb_Library__get_workdir_linktargetname
 Library/$(call gb_Library_get_filename,$(1))
 endef
@@ -408,6 +426,9 @@ endif # CROSS_COMPILING
 define gb_Library_get_linktarget
 $(call gb_Library__get_workdir_linktargetname,$(1))<>$(call gb_Library_get_target,$(1))
 endef
+define gb_Library_get_dep_libraries_target
+$(call gb_LinkTarget_get_dep_libraries_target,$(call gb_Library_get_linktarget,$(1)))
+endef
 
 define gb_StaticLibrary__get_workdir_linktargetname
 StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1))
diff --git a/solenv/gbuild/extensions/post_SpeedUpTargets.mk b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
index 3db6355ab90d..cd475133a82c 100644
--- a/solenv/gbuild/extensions/post_SpeedUpTargets.mk
+++ b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
@@ -9,7 +9,7 @@
 
 ifneq ($(CROSS_COMPILING),)
 gb_Module_add_targets_for_build :=
-gb_Module_SKIPTARGETS := check slowcheck screenshot subsequentcheck uicheck
+gb_Module_SKIPTARGETS := slowcheck screenshot subsequentcheck uicheck
 endif
 
 ifeq ($(gb_Side),build)
@@ -52,7 +52,6 @@ endif
 
 endif
 
-
 ifneq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 gb_Module_add_target =
 endif
diff --git a/solenv/gbuild/partial_build.mk b/solenv/gbuild/partial_build.mk
index bc0e4a261b7b..da3527ed4a2b 100644
--- a/solenv/gbuild/partial_build.mk
+++ b/solenv/gbuild/partial_build.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Module_make_global_targets,$(wildcard $(module_directory)Module
 
 ifeq ($(DISABLE_DYNLOADING),TRUE)
 $(if $(gb_LinkTarget__Lock),$(shell rm -f $(gb_LinkTarget__Lock)))
+include $(SRCDIR)/solenv/gbuild/static.mk
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk
index ece7a88bd71f..823190490589 100644
--- a/solenv/gbuild/platform/linux.mk
+++ b/solenv/gbuild/platform/linux.mk
@@ -17,12 +17,20 @@ gb_LinkTarget_LDFLAGS += $(gb__LinkTarget_LDFLAGS_zdefs)
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+gb_STDLIBS :=
+
 ifeq ($(DISABLE_DYNLOADING),TRUE)
-gb_STDLIBS := -ldl
+gb_STDLIBS += -ldl -lm
 endif
 
+gb_STDLIBS_CXX :=
+
 ifneq ($(ATOMIC_LIB),)
-gb_STDLIBS_CXX := $(ATOMIC_LIB)
+gb_STDLIBS_CXX += $(ATOMIC_LIB)
+endif
+
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+gb_STDLIBS_CXX += -lstdc++
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index a24cefe1080e..fc484e981bce 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -342,7 +342,7 @@ gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION)
 
 # UnoApiHeadersTarget class
 
-ifneq ($(filter TRUE,$(DISABLE_DYNLOADING)),)
+ifeq ($(DISABLE_DYNLOADING),TRUE)
 gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
 else
 gb_UnoApiHeadersTarget_select_variant = $(2)
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index a117020d91d1..bd61d1f1c348 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -72,10 +72,13 @@ gb_LinkTarget_LDFLAGS += \
 	-Wl,--sysroot=$(SYSBASE)
 endif
 
+ifeq (,$(DISABLE_DYNLOADING))
 gb_LinkTarget_LDFLAGS += \
 	-Wl,-rpath-link,$(SYSBASE)/lib:$(SYSBASE)/usr/lib \
 	-Wl,-z,combreloc \
 
+endif
+
 ifeq ($(HAVE_LD_HASH_STYLE),TRUE)
 gb_LinkTarget_LDFLAGS += \
 	-Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \
@@ -109,6 +112,8 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
 gb_LinkTarget__cmd_lockfile = $(call gb_Executable_get_command,lockfile)
 gb_LinkTarget__Lock := $(WORKDIR)/LinkTarget/link.lock
 gb_LinkTarget__WantLock = $(if $(and $(filter TRUE,$(DISABLE_DYNLOADING)),$(CROSS_COMPILING),$(filter CppunitTest Executable,$(TARGETTYPE))),$(true))
+# In theory would would need to track, if any of the linked objects is C++ code, so for the static build we assume yes :-(
+gb_LinkTarget__NeedsCxxLinker = $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)$(DISABLE_DYNLOADING)),$(true))
 
 # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10
 # we want to use @$(extraobjectlist) in the long run
@@ -120,7 +125,7 @@ gb_LinkTarget__WantLock = $(if $(and $(filter TRUE,$(DISABLE_DYNLOADING)),$(CROS
 define gb_LinkTarget__command_dynamiclink
 $(if $(gb_LinkTarget__WantLock),$(gb_LinkTarget__cmd_lockfile) -r -1 $(gb_LinkTarget__Lock))
 $(call gb_Helper_abbreviate_dirs,\
-	$(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \
+	$(if $(call gb_LinkTarget__NeedsCxxLinker),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \
 		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
 		$(gb_LTOFLAGS) \
 		$(if $(SOVERSIONSCRIPT),-Wl$(COMMA)--soname=$(notdir $(1)) \
@@ -138,13 +143,13 @@ $(call gb_Helper_abbreviate_dirs,\
 		    $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		    $(T_LIBS) \
-		    $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \
+		    $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
-		    , \
+		, \
 		    -Wl$(COMMA)--start-group \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		    $(T_LIBS) \
-		    $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \
+		    $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
 		    -Wl$(COMMA)--no-as-needed \
 		    $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
@@ -152,13 +157,16 @@ $(call gb_Helper_abbreviate_dirs,\
 		-o $(1) \
 	$(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)) \
 	$(if $(gb_LinkTarget__WantLock),; RC=$$? ; rm -f $(gb_LinkTarget__Lock); if test $$RC -ne 0; then exit $$RC; fi))
-	$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
-		$(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
-		$(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \
-			| cut -d' ' -f1-2 \
-			>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
-		$(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
-			$(WORKDIR)/LinkTarget/$(2).exports,$(1))))
+$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
+	$(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
+	$(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \
+		| cut -d' ' -f1-2 \
+		>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
+	$(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
+		$(WORKDIR)/LinkTarget/$(2).exports,$(1))))
+$(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \
+	cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \
+	sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)))
 endef
 
 define gb_LinkTarget__command_staticlink
@@ -294,12 +302,18 @@ endef
 
 gb_CppunitTest_CPPTESTPRECOMMAND := \
     $(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
-gb_CppunitTest_get_filename = libtest_$(1).so
+ifeq (,$(DISABLE_DYNLOADING))
+gb_CppunitTest_get_filename = libtest_$(1)$(gb_Library_PLAINEXT)
+else
+gb_CppunitTest_get_filename = test_$(1)$(gb_Executable_EXT)
+endif
 gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename)
 gb_CppunitTest_malloc_check := -ex 'set environment MALLOC_CHECK_=2; set environment MALLOC_PERTURB_=153'
 
 define gb_CppunitTest_CppunitTest_platform
+ifeq (,$(DISABLE_DYNLOADING))
 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE))
+endif
 
 endef
 
diff --git a/solenv/gbuild/static.mk b/solenv/gbuild/static.mk
new file mode 100644
index 000000000000..800406ed6b31
--- /dev/null
+++ b/solenv/gbuild/static.mk
@@ -0,0 +1,256 @@
+# -*- 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/.
+#
+
+# "spezialgelagerter Sonderfall" :-(
+#
+# *******************************************
+# Use gb_DEBUG_STATIC=t to dump variuos debug info for the static build preparation!
+# *******************************************
+#
+# "Generic" comment from the author:
+# My thought was: the dependency info is already there. Can't be too hard to use it for
+# correct static linkage... well it took more then two weeks to hopefully identify all
+# problems / edge cases. Now I can appreciate the usage bin/lo-all-static-libs even more.
+#
+# This code moved a few times to the various gbuild / make phases: Makefile / module
+# setup (in use_(libraries|externals)), post parsing (like now), make "dependency" tree
+# processing. It currently looks like this is the only working option.
+#
+# For static linking, we must collect all depending libraries, externals and statics to
+# be available at link time. And Libraries and externals can use each other. This could
+# be done "in-line", while make processes the dependency tree and would have the correct
+# order, so no separate tree-walking would be needed.
+# It can't be done while reading / processing the modules, as this happens in no order, so
+# depending modules will be missing.
+#
+# Then there is the (gbuild new) concept of plugin libraries. These depend on some loader
+# libraries, like vcl and vclplug_* or gie. For a shared library build, these plugins are
+# just dlopen'ed, but for a static build, any linked binary must also link the plugins, which
+# turns plugins + loaders into a dependency cycle. The implemented solution is to just add
+# plugins to executables, if these depend on a loader library. This results in the additional
+# rule: nothing non-plugin is allowed to depend on a plugins (see gb_Library_set_plugin_for).
+#
+# And we can't add these dependencies while make is already processing the Executables,
+# because these contain additional eval'ed targets, which we can't create in make recipes.
+# This is especially true for externals (see gb_LinkTarget__use_* in RepositoryExternal.mk).
+# We also can't add all plugins to all executables, as we have multiple helper
+# binaries, which are needed early and don't depend on plugins.
+#
+# So the only option left seems to be to walk the dependency tree ourself and expand all
+# the libraries and externals and then add the plugins to the executables. Statics are
+# handled after that, since these won't need extra dependencies not already known.
+# It's a bit fragile in theory, as you can add "gbuild-undetectable" dependencies to any
+# target in the modules, which would need some manual adjustment, but currently that
+# doesn't seem to happen in any breaking way and it works to link multiple Executable
+# with large and small expanded dependency lists.
+#
+# Then there is the special static "components" library, which simply depends on all build
+# components. In theory these could be limited per-module (Writer, Calc, etc.), but currently
+# this is not implemented and instead solenv/bin/native-code.py is used, so actually
+# everything is build and "cleaned up" at link time, which is especially expensive for WASM.
+# That library is currently just used for Emscripten, but could be used generally for
+# static builds.
+#
+# There is already a lot of $(info ...) protected by the already mentioned $(gb_DEBUG_STATIC).
+
+ifeq ($(true),$(gb_FULLDEPS))
+
+ifeq (,$(gb_PARTIAL_BUILD))
+
+$(foreach lib,$(gb_Library_KNOWNLIBS),$(if $(call gb_Library__get_component,$(lib)), \
+    $(eval $(call gb_Library_use_libraries,components,$(lib)))))
+
+define gb_LinkTarget__add_x_template
+
+# call gb_LinkTarget__add_$(1),linktarget,objects
+define gb_LinkTarget__add_$(1)
+$$(foreach item,$$(2),$$(if $$(filter $$(item),GBUILD_TOUCHED $$(call gb_LinkTarget__get_all_$(1),$$(1))),,
+    $$(if $(gb_DEBUG_STATIC),$$(info $$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))) += $$(item)))
+    $$(eval $$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))) += $$(item))
+))
+endef
+
+endef # gb_LinkTarget__add_x_template
+
+ifneq (,$(gb_DEBUG_STATIC))
+$(info $(call gb_LinkTarget__add_x_template,libraries))
+$(info $(call gb_LinkTarget__add_x_template,externals))
+$(info $(call gb_LinkTarget__add_x_template,statics))
+endif
+$(eval $(call gb_LinkTarget__add_x_template,libraries))
+$(eval $(call gb_LinkTarget__add_x_template,externals))
+$(eval $(call gb_LinkTarget__add_x_template,statics))
+
+# call gb_LinkTarget__add_linktargets,linktarget,class,func,objects
+define gb_LinkTarget__add_linktargets
+$(call gb_LinkTarget__add_$(3),$(1),$(4))
+$(foreach item,$(foreach mapped,$(4),$(call gb_$(2)__get_workdir_linktargetname,$(mapped))),
+    $(call gb_LinkTarget__add_libraries,$(1),$(call gb_LinkTarget__get_all_libraries,$(item)))
+    $(call gb_LinkTarget__add_externals,$(1),$(call gb_LinkTarget__get_all_externals,$(item)))
+    $(call gb_LinkTarget__add_statics,$(1),$(call gb_LinkTarget__get_all_statics,$(item)))
+)
+endef
+
+# contains the list of all touched workdir_linktargetname(s)
+gb_LinkTarget__ALL_TOUCHED =
+
+define gb_LinkTarget__add_touch
+$(eval $(call gb_LinkTarget__get_all_libraries_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED)
+$(eval $(call gb_LinkTarget__get_all_externals_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED)
+$(eval $(call gb_LinkTarget__get_all_statics_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED)
+gb_LinkTarget__ALL_TOUCHED += $(1)
+
+endef
+
+define gb_LinkTarget__remove_touch
+$(call gb_LinkTarget__get_all_libraries_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1)))
+$(call gb_LinkTarget__get_all_externals_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1)))
+$(call gb_LinkTarget__get_all_statics_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1)))
+
+endef
+
+# call gb_LinkTarget__fill_all_deps.linktargetname
+define gb_LinkTarget__fill_all_deps
+$(if $(filter GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_lo_libraries,$(1))),,
+
+    # LO has quite a few dependency loops, so touch first to break them
+    $(call gb_LinkTarget__add_touch,$(1))
+
+    # Add lo libraries
+    $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_lo_libraries,$(1))),
+        $(call gb_LinkTarget__fill_all_deps,$(call gb_Library_get_linktarget,$(item)))
+        $(call gb_LinkTarget__add_libraries,$(1),$(call gb_Library__get_all_libraries,$(item)))
+        $(call gb_LinkTarget__add_externals,$(1),$(call gb_Library__get_all_externals,$(item)))
+        $(call gb_LinkTarget__add_statics,$(1),$(call gb_Library__get_all_statics,$(item)))
+    )
+
+    # Add (win32) system libraries
+    $(call gb_LinkTarget__add_libraries,$(1),$(call gb_LinkTarget__get_all_sys_libraries,$(1)))
+
+    # Add externals
+    $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))),
+        $(call gb_LinkTarget__fill_all_deps,$(call gb_ExternalProject__get_workdir_linktargetname,$(item)))
+        $(call gb_LinkTarget__add_libraries,$(1),$(call gb_ExternalProject__get_all_libraries,$(item)))
+        $(call gb_LinkTarget__add_externals,$(1),$(call gb_ExternalProject__get_all_externals,$(item)))
+        $(call gb_LinkTarget__add_statics,$(1),$(call gb_ExternalProject__get_all_statics,$(item)))
+    )
+
+    # Add statics
+    $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))),
+        $(call gb_LinkTarget__fill_all_deps,$(call gb_StaticLibrary_get_linktarget,$(item)))
+        $(call gb_LinkTarget__add_libraries,$(1),$(call gb_StaticLibrary__get_all_libraries,$(item)))
+        $(call gb_LinkTarget__add_externals,$(1),$(call gb_StaticLibrary__get_all_externals,$(item)))
+        $(call gb_LinkTarget__add_statics,$(1),$(call gb_StaticLibrary__get_all_statics,$(item)))
+    )
+
+    $(if $(gb_DEBUG_STATIC),
+        $(info gb_LinkTarget__fill_all_deps libraries for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_libraries,$(1)))
+        $(info gb_LinkTarget__fill_all_deps externals for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_externals,$(1)))
+        $(info gb_LinkTarget__fill_all_deps statics   for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_statics,$(1)))
+    )
+)
+
+endef
+
+
+# call gb_LinkTarget__expand_executable,linktarget
+define gb_LinkTarget__expand_executable
+$(call gb_LinkTarget__fill_all_deps,$(1))
+
+# 1. Check if cppuhelper loader for components is requested and add the needed plugin dependences
+#    This is a *HACK*, so we don't have to recursively check loader libraries
+# 2. Find any other loader libraries and add the needed plugin dependences
+$(if $(filter cppuhelper,$(filter $(gb_Library_KNOWNLOADERS),$(call gb_LinkTarget__get_all_libraries,$(1)))),
+    $(call gb_LinkTarget__add_linktargets,$(1),Library,libraries,$(call gb_Library__get_plugins,cppuhelper)))
+$(foreach loader,$(filter $(filter-out cppuhelper,$(gb_Library_KNOWNLOADERS)),$(call gb_LinkTarget__get_all_libraries,$(1))),
+    $(call gb_LinkTarget__add_linktargets,$(1),Library,libraries,$(call gb_Library__get_plugins,$(loader))))
+
+$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1))),
+    $(foreach lib,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1))),
+        $(call gb_LinkTarget__add_statics,$(1),$(call gb_Library__get_all_statics,$(lib))))
+    $(eval $(call gb_LinkTarget_use_libraries,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1))))))
+
+$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))),
+    $(foreach external,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))),
+        $(call gb_LinkTarget__add_statics,$(1),$(call gb_ExternalProject__get_all_statics,$(external))))
+    $(eval $(call gb_LinkTarget_use_externals,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))))))
+
+$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))),
+    $(eval $(call gb_LinkTarget_use_static_libraries,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))))))
+
+# Some fixes for the _use_external_project(s) mess
+$(if $(filter icui28n icuuc,$(call gb_LinkTarget__get_all_externals,$(1))),
+    $(call gb_LinkTarget_use_externals,$(1),icudata))
+$(if $(filter orcus-parser,$(call gb_LinkTarget__get_all_externals,$(1))),
+    $(call gb_LinkTarget_use_static_libraries,$(1),boost_filesystem))
+
+$(if $(gb_DEBUG_STATIC),
+    $(info gb_LinkTarget__expand_executable libraries for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_libraries,$(1)))
+    $(info gb_LinkTarget__expand_executable externals for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_externals,$(1)))
+    $(info gb_LinkTarget__expand_executable statics   for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_statics,$(1)))
+)
+
+endef
+
+$(foreach lib,$(gb_Library_KNOWNLIBS), \
+    $(eval $(call gb_LinkTarget__fill_all_deps,$(call gb_Library_get_linktarget,$(lib)))))
+$(foreach exec,$(gb_Executable_KNOWN), \
+    $(eval $(call gb_LinkTarget__expand_executable,$(call gb_Executable_get_linktarget,$(exec)))))
+$(foreach cppunit,$(gb_CppunitTest_KNOWN), \
+    $(eval $(call gb_LinkTarget__expand_executable,$(call gb_CppunitTest_get_linktarget,$(cppunit)))))
+$(foreach workdir_linktargetname,$(gb_LinkTarget__ALL_TOUCHED), \
+    $(eval $(call gb_LinkTarget__remove_touch,$(workdir_linktargetname))))
+
+else # $(gb_PARTIAL_BUILD)
+
+# call gb_LinkTarget__expand_executable_template,class
+define gb_LinkTarget__expand_executable_template
+
+gb_$(1)__get_dep_libraries_target = $$(call gb_LinkTarget_get_dep_libraries_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1)))
+gb_$(1)__get_dep_externals_target = $$(call gb_LinkTarget_get_dep_externals_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1)))
+gb_$(1)__get_dep_statics_target = $$(call gb_LinkTarget_get_dep_statics_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1)))
+
+# call gb_$(1)__has_any_dependencies,item
+define gb_$(1)__has_any_dependencies
+$$(if $$(strip $$(filter-out GBUILD_TOUCHED,
+    $$(call gb_$(1)__get_all_libraries,$$(1))
+    $$(call gb_$(1)__get_all_externals,$$(1))
+    $$(call gb_$(1)__get_all_statics,$$(1)))),$$(1))
+
+endef
+
+# call gb_$(1)__expand_deps,item
+define gb_$(1)__expand_deps
+$$(if $$(call gb_$(1)__has_any_dependencies,$$(1)),
+    $$(if $$(shell cat $$(call gb_$(1)__get_dep_libraries_target,$$(1)) 2>/dev/null),
+        $$(eval $$(call gb_$(1)_use_libraries,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_libraries_target,$$(1))))))
+    $$(if $$(shell cat $$(call gb_$(1)__get_dep_externals_target,$$(1)) 2>/dev/null),
+        $$(eval $$(call gb_$(1)_use_externals,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_externals_target,$$(1))))))
+    $$(if $$(shell cat $$(call gb_$(1)__get_dep_statics_target,$$(1)) 2>/dev/null), \
+        $$(eval $$(call gb_$(1)_use_static_libraries,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_statics_target,$$(1))))))
+)
+
+endef
+
+endef # gb_LinkTarget__expand_executable_template
+
+ifneq (,$(gb_DEBUG_STATIC))
+$(info $(call gb_LinkTarget__expand_executable_template,Executable))
+$(info $(call gb_LinkTarget__expand_executable_template,CppunitTest))
+endif
+$(eval $(call gb_LinkTarget__expand_executable_template,Executable))
+$(eval $(call gb_LinkTarget__expand_executable_template,CppunitTest))
+
+$(foreach exec,$(gb_Executable_KNOWN),$(eval $(call gb_Executable__expand_deps,$(exec))))
+$(foreach cppunit,$(gb_CppunitTest_KNOWN),$(eval $(call gb_CppunitTest__expand_deps,$(cppunit))))
+
+endif # $(gb_PARTIAL_BUILD)
+endif # $(gb_FULLDEPS)
+
+# vim: set noet sw=4 ts=4:
diff --git a/static/CustomTarget_components.mk b/static/CustomTarget_components.mk
new file mode 100644
index 000000000000..dd9d8367eff5
--- /dev/null
+++ b/static/CustomTarget_components.mk
@@ -0,0 +1,34 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,static/components))
+
+static_WORKDIR := $(call gb_CustomTarget_get_workdir,static)
+postprocess_WORKDIR := $(call gb_CustomTarget_get_workdir,postprocess)
+
+$(call gb_CustomTarget_get_target,static/components): \
+    $(static_WORKDIR)/component_maps.cxx \
+
+$(static_WORKDIR)/component_maps.cxx: \
+    $(SRCDIR)/solenv/bin/native-code.py \
+    | $(static_WORKDIR)/.dir
+	$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
+	$(call gb_Helper_abbreviate_dirs, \
+            $(call gb_ExternalExecutable_get_command,python) $< \
+            $(if $(ENABLE_SERVICES_RDB_FROM_BUILD), \
+                -c $(postprocess_WORKDIR)/services_constructors.list, \
+                -g core -g writer -g desktop) \
+        ) > $@
+
+ifeq ($(ENABLE_SERVICES_RDB_FROM_BUILD),TRUE)
+$(static_WORKDIR)/component_maps.cxx: $(postprocess_WORKDIR)/services_constructors.list
+endif
+
+# vim: set noet sw=4:
diff --git a/static/Library_components.mk b/static/Library_components.mk
new file mode 100644
index 000000000000..07b4fd593611
--- /dev/null
+++ b/static/Library_components.mk
@@ -0,0 +1,22 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,components))
+
+$(eval $(call gb_Library_set_plugin_for,components,cppuhelper))
+

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list