[Libreoffice-commits] core.git: Branch 'feature/windows-cross-build' - 37 commits - bin/get_config_variables canvas/source comphelper/Library_comphelper.mk comphelper/source compilerplugins/clang config_host.mk.in configure.ac connectivity/Module_connectivity.mk cui/source dbaccess/Library_dba.mk dbaccess/source dbaccess/util distro-configs/Jenkins distro-configs/LibreOfficeWin64.conf external/gpgmepp external/libassuan external/libgpg-error external/libjpeg-turbo external/liblangtag framework/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_dark_svg icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_dark_svg icon-themes/sifr_svg icon-themes/sukapura icon-themes/sukapura_svg include/comphelper include/svtools include/toolkit include/vcl Makefile.gbuild Makefile.in oox/source postprocess/CustomTarget_images .mk postprocess/CustomTarget_registry.mk postprocess/Module_postprocess.mk postprocess/Rdb_services.mk RepositoryExternal.mk Repository.mk RepositoryModule_build.mk sc/source sd/qa sfx2/source shell/Module_shell.mk solenv/bin solenv/clang-format solenv/gbuild solenv/gcc-wrappers solenv/sanitizers svtools/inc svtools/source svx/Module_svx.mk sw/CppunitTest_sw_core_accessibilitycheck.mk sw/CppunitTest_sw_core_crsr.mk sw/CppunitTest_sw_core_doc.mk sw/CppunitTest_sw_core_frmedt.mk sw/CppunitTest_sw_core_layout.mk sw/CppunitTest_sw_core_objectpositioning.mk sw/CppunitTest_sw_core_text.mk sw/CppunitTest_sw_core_txtnode.mk sw/CppunitTest_sw_core_unocore.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_fodfexport.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTes t_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_rtfexport2.mk sw/CppunitTest_sw_rtfexport3.mk sw/CppunitTest_sw_rtfexport4.mk sw/CppunitTest_sw_rtfexport5.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_txtexport.mk sw/CppunitTest_sw_uibase_dochdl.mk sw/CppunitTest_sw_uibase_frmdlg.mk sw/CppunitTest_sw_uibase_shells.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export3.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CppunitTest_sw_xhtmlexport.mk sw/Library_swqahelper.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/qa sw/source unotest/Module_unotest.mk unoxml/Module_unoxml.mk vcl/Library_vcl.mk vcl/Library_vclplug_win.mk vcl/source vcl/unx vcl/workben xmloff/Module_xmloff.mk

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 31 15:37:38 UTC 2020


Rebased ref, commits from common ancestor:
commit 186506d7f583b6e600e49b1d7c362a2f469a1721
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Jul 29 12:04:03 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:08 2020 +0200

    cross-build: fix Java NI linking
    
    LibreOffice has a JNI component on Windows and Linux, the
    officebean. Therefore we need a host JDK for linkage to the
    jawt, and a build JDK to compile the Java code.
    
    Change-Id: I4138628ab3ea2ef5900a5b4e9281050ae84e4eb5

diff --git a/config_host.mk.in b/config_host.mk.in
index d3d269394380..ce4e70a9bc5e 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -266,7 +266,6 @@ export HARFBUZZ_LIBS=$(gb_SPACE)@HARFBUZZ_LIBS@
 export GSSAPI_LIBS=@GSSAPI_LIBS@
 export GSTREAMER_1_0_CFLAGS=$(gb_SPACE)@GSTREAMER_1_0_CFLAGS@
 export GSTREAMER_1_0_LIBS=$(gb_SPACE)@GSTREAMER_1_0_LIBS@
-export GTHREAD_CFLAGS=$(gb_SPACE)@GTHREAD_CFLAGS@
 export GTK3_CFLAGS=$(gb_SPACE)@GTK3_CFLAGS@
 export GTK3_LIBS=$(gb_SPACE)@GTK3_LIBS@
 export USING_X11=@USING_X11@
@@ -319,15 +318,18 @@ export IWYU_PATH=@IWYU_PATH@
 export JAVACOMPILER=@JAVACOMPILER@
 export JAVADOC=@JAVADOC@
 export JAVADOCISGJDOC=@JAVADOCISGJDOC@
-export JAVAFLAGS=@JAVAFLAGS@
+export JAVACFLAGS=@JAVACFLAGS@
 export JAVAIFLAGS=@JAVAIFLAGS@
+export JAVAIFLAGS_FOR_BUILD=@JAVAIFLAGS@
 export JAVA_CLASSPATH_NOT_SET=@JAVA_CLASSPATH_NOT_SET@
 export JAVAINTERPRETER=@JAVAINTERPRETER@
 export JAVA_HOME=@JAVA_HOME@
+export JAVA_HOME_FOR_BUILD=@JAVA_HOME_FOR_BUILD@
 export JAVA_SOURCE_VER=@JAVA_SOURCE_VER@
 export JAVA_TARGET_VER=@JAVA_TARGET_VER@
 export JAWTLIB=@JAWTLIB@
 export JDK=@JDK@
+export JDK_FOR_BUILD=@JDK_FOR_BUILD@
 export JFREEREPORT_JAR=@JFREEREPORT_JAR@
 export JITC_PROCESSOR_TYPE=@JITC_PROCESSOR_TYPE@
 export JVM_ONE_PATH_CHECK=@JVM_ONE_PATH_CHECK@
diff --git a/configure.ac b/configure.ac
index 07db4ae16c72..213196745b54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4886,7 +4886,18 @@ if test "$cross_compiling" = "yes"; then
     sub_conf_opts=""
     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
-    test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
+    test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
+    if test -n "$ENABLE_JAVA"; then
+        if test "$_os" != "iOS" -a "$_os" != "Android"; then
+            if ! echo "$with_build_platform_configure_options" | grep -q -- '--with-jdk-home='; then
+                AC_MSG_ERROR([Missing build JDK (see --with-build-platform-configure-options, --with-jdk-home and use 'cygpath -ms' on Windows)!])
+            fi
+        else
+            test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
+        fi
+    else
+        sub_conf_opts="$sub_conf_opts --without-java"
+    fi
     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
@@ -4906,7 +4917,6 @@ if test "$cross_compiling" = "yes"; then
         --disable-skia \
         --enable-icecream="$enable_icecream" \
         --without-doxygen \
-        --without-java \
         --without-webdav \
         --with-parallelism="$with_parallelism" \
         --with-theme="$with_theme" \
@@ -4958,15 +4968,51 @@ if test "$cross_compiling" = "yes"; then
     mkdir -p ../config_build
     mv config_host/*.h ../config_build
 
+    # all these will get a _FOR_BUILD postfix
+    DIRECT_FOR_BUILD_SETTINGS="
+        CC
+        CXX
+        ILIB
+        JAVA_HOME
+        JAVAIFLAGS
+        JDK
+        LIBO_BIN_FOLDER
+        LIBO_LIB_FOLDER
+        LIBO_URE_LIB_FOLDER
+        LIBO_URE_MISC_FOLDER
+        OS
+        SDKDIRNAME
+        SYSTEM_LIBXML
+        SYSTEM_LIBXSLT
+"
+    # these overwrite host config with build config
+    OVERWRITING_SETTINGS="
+        ANT
+        ANT_HOME
+        ANT_LIB
+        JAVA_SOURCE_VER
+        JAVA_TARGET_VER
+        JAVACFLAGS
+        JAVACOMPILER
+        JAVADOC
+        JAVADOCISGJDOC
+"
+    # these need some special handling
+    EXTRA_HANDLED_SETTINGS="
+        INSTDIR
+        INSTROOT
+        PATH
+        WORKDIR
+"
     OLD_PATH=$PATH
-    . ./bin/get_config_variables CC CXX ILIB INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
+    . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
     BUILD_PATH=$PATH
     PATH=$OLD_PATH
 
     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
     echo "$line" >>build-config
 
-    for V in CC CXX ILIB LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
+    for V in $DIRECT_FOR_BUILD_SETTINGS; do
         VV='$'$V
         VV=`eval "echo $VV"`
         if test -n "$VV"; then
@@ -4975,6 +5021,15 @@ if test "$cross_compiling" = "yes"; then
         fi
     done
 
+    for V in $OVERWRITING_SETTINGS; do
+        VV='$'$V
+        VV=`eval "echo $VV"`
+        if test -n "$VV"; then
+            line=${V}='${'${V}:-$VV'}'
+            echo "$line" >>build-config
+        fi
+    done
+
     for V in INSTDIR INSTROOT WORKDIR; do
         VV='$'$V
         VV=`eval "echo $VV"`
@@ -7661,11 +7716,9 @@ dnl ===================================================================
 dnl Checks for JDK.
 dnl ===================================================================
 
-# Note that JAVA_HOME as for now always means the *build* platform's
-# JAVA_HOME. Whether all the complexity here actually is needed any
-# more or not, no idea.
+# Whether all the complexity here actually is needed any more or not, no idea.
 
-if test "$ENABLE_JAVA" != ""; then
+if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
     _gij_longver=0
     AC_MSG_CHECKING([the installed JDK])
     if test -n "$JAVAINTERPRETER"; then
@@ -7701,21 +7754,27 @@ if test "$ENABLE_JAVA" != ""; then
             # set to limit VM usage for JunitTests
             JAVAIFLAGS=-Xmx64M
             # set to limit VM usage for javac
-            JAVAFLAGS=-J-Xmx128M
+            JAVACFLAGS=-J-Xmx128M
         fi
     else
         AC_MSG_ERROR([Java not found. You need at least JDK 9])
     fi
 else
-    dnl Java disabled
-    JAVA_HOME=
-    export JAVA_HOME
+    if test -z "$ENABLE_JAVA"; then
+        dnl Java disabled
+        JAVA_HOME=
+        export JAVA_HOME
+    elif test "$cross_compiling" = "yes"; then
+        # Just assume compatibility of build and host JDK
+        JDK=$JDK_FOR_BUILD
+        JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
+    fi
 fi
 
 dnl ===================================================================
 dnl Checks for javac
 dnl ===================================================================
-if test "$ENABLE_JAVA" != ""; then
+if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
     javacompiler="javac"
     : ${JAVA_SOURCE_VER=8}
     : ${JAVA_TARGET_VER=8}
@@ -7742,7 +7801,7 @@ fi
 dnl ===================================================================
 dnl Checks for javadoc
 dnl ===================================================================
-if test "$ENABLE_JAVA" != ""; then
+if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
     if test -z "$with_jdk_home"; then
         AC_PATH_PROG(JAVADOC, javadoc)
     else
@@ -7768,6 +7827,7 @@ if test "$ENABLE_JAVA" != ""; then
     JAVADOCISGJDOC="yes"
     fi
 fi
+AC_SUBST(JAVADOC)
 AC_SUBST(JAVADOCISGJDOC)
 
 if test "$ENABLE_JAVA" != ""; then
@@ -7995,16 +8055,18 @@ if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
 fi
 SOLARINC="$SOLARINC $JAVAINC"
 
+AC_SUBST(JAVACFLAGS)
 AC_SUBST(JAVACOMPILER)
-AC_SUBST(JAVADOC)
 AC_SUBST(JAVAINTERPRETER)
 AC_SUBST(JAVAIFLAGS)
-AC_SUBST(JAVAFLAGS)
+AC_SUBST(JAVAIFLAGS_FOR_BUILD)
 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
 AC_SUBST(JAVA_HOME)
+AC_SUBST(JAVA_HOME_FOR_BUILD)
+AC_SUBST(JDK)
+AC_SUBST(JDK_FOR_BUILD)
 AC_SUBST(JAVA_SOURCE_VER)
 AC_SUBST(JAVA_TARGET_VER)
-AC_SUBST(JDK)
 
 
 dnl ===================================================================
@@ -12512,7 +12574,7 @@ dnl ===================================================================
 dnl Test for the presence of Ant and that it works
 dnl ===================================================================
 
-if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
+if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
     ANT_HOME=; export ANT_HOME
     WITH_ANT_HOME=; export WITH_ANT_HOME
     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
@@ -12603,8 +12665,6 @@ EOF
         PathFormat "$ANT"
         ANT="$formatted_path"
     fi
-    AC_SUBST(ANT_HOME)
-    AC_SUBST(ANT)
 
     dnl Checking for ant.jar
     if test "$ANT_HOME" != "NO_ANT_HOME"; then
@@ -12638,7 +12698,6 @@ EOF
         ANT_LIB="$formatted_path"
         AC_MSG_RESULT([Ant lib directory found.])
     fi
-    AC_SUBST(ANT_LIB)
 
     ant_minver=1.6.0
     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
@@ -12660,9 +12719,13 @@ EOF
 
     rm -f conftest* core core.* *.core
 fi
+AC_SUBST(ANT)
+AC_SUBST(ANT_HOME)
+AC_SUBST(ANT_LIB)
 
 OOO_JUNIT_JAR=
-if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
+HAMCREST_JAR=
+if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
     AC_MSG_CHECKING([for JUnit 4])
     if test "$with_junit" = "yes"; then
         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
@@ -12692,13 +12755,9 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
     fi
     rm -f conftest.class conftest.java
     if test $OOO_JUNIT_JAR != ""; then
-    BUILD_TYPE="$BUILD_TYPE QADEVOOO"
+        BUILD_TYPE="$BUILD_TYPE QADEVOOO"
     fi
-fi
-AC_SUBST(OOO_JUNIT_JAR)
 
-HAMCREST_JAR=
-if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
     AC_MSG_CHECKING([for included Hamcrest])
     printf 'import org.hamcrest.BaseDescription;' > conftest.java
     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
@@ -12729,6 +12788,7 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
     fi
     rm -f conftest.class conftest.java
 fi
+AC_SUBST(OOO_JUNIT_JAR)
 AC_SUBST(HAMCREST_JAR)
 
 
diff --git a/solenv/gbuild/JavaClassSet.mk b/solenv/gbuild/JavaClassSet.mk
index cff4299bf06e..cf84cf6c9ca4 100644
--- a/solenv/gbuild/JavaClassSet.mk
+++ b/solenv/gbuild/JavaClassSet.mk
@@ -17,7 +17,7 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-gb_JavaClassSet_JAVACCOMMAND = $(ICECREAM_RUN) $(JAVACOMPILER) $(JAVAFLAGS) \
+gb_JavaClassSet_JAVACCOMMAND = $(ICECREAM_RUN) $(JAVACOMPILER) $(JAVACFLAGS) \
     -encoding utf8 \
     --release $(1) \
     $(if $(JAVA_CLASSPATH_NOT_SET),-Xlint:-options)
commit 84271b94a12666320ecc3447f0eefc3b16aaa4b7
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jul 14 23:06:03 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    WIN cross: fix gpg-related library builds
    
    Cross compiling these libraries requires to supply the cross-
    compiler via the CC_FOR_BUILD environment variable. Since we have
    to use the gcc-wrappers, we now need two different invocations
    with different inclues and libraries, but just have fixed
    environment variables. Also, the CC_FOR_BUILD clashes with LO's
    own variant, but that is easy to fix.
    
    So this change includes:
    - gcc-wrappers: new option --wrapper-env-prefix to add a prefix
      to the environment variable names
    - gcc-wrappers: new option --wrapper-print-cmdline to dump the
      real command called, when a verbose build is executed
    - gcc-wrappers: default to exe, if the output has no extension
    - unify build flags for gpg related libraries
    
    Change-Id: I4e6a6ba3c6e09237c8ffefa40ce61131290a3852

diff --git a/config_host.mk.in b/config_host.mk.in
index 00288ccb6968..d3d269394380 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -62,6 +62,7 @@ export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
 export CAIRO_CFLAGS=$(gb_SPACE)@CAIRO_CFLAGS@
 export CAIRO_LIBS=$(gb_SPACE)@CAIRO_LIBS@
 export CC=@CC@
+export CC_FOR_BUILD=@CC_FOR_BUILD@
 export CCACHE_DEPEND_MODE=@CCACHE_DEPEND_MODE@
 export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@
 export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@
@@ -107,6 +108,7 @@ export CURL_LIBS=$(gb_SPACE)@CURL_LIBS@
 export CUSTOM_BRAND_DIR=@CUSTOM_BRAND_DIR@
 export CUSTOM_BRAND_IMAGES=@CUSTOM_BRAND_IMAGES@
 export CXX=@CXX@
+export CXX_FOR_BUILD=@CXX_FOR_BUILD@
 export CXX_X64_BINARY=@CXX_X64_BINARY@
 export CXX_X86_BINARY=@CXX_X86_BINARY@
 @x_CXXFLAGS@ export CXXFLAGS=@CXXFLAGS@
@@ -304,6 +306,7 @@ export ICU_RECLASSIFIED_PREPEND_SET_EMPTY=@ICU_RECLASSIFIED_PREPEND_SET_EMPTY@
 export ICU_UCHAR_TYPE=@ICU_UCHAR_TYPE@
 export INTROSPECTION_SCANNER=@INTROSPECTION_SCANNER@
 export ILIB=@ILIB@
+export ILIB_FOR_BUILD=@ILIB_FOR_BUILD@
 export INSTALLDIR=@INSTALLDIR@
 export INSTALLDIRNAME=@INSTALLDIRNAME@
 export INSTALL_NAME_TOOL=@INSTALL_NAME_TOOL@
diff --git a/configure.ac b/configure.ac
index 1749a9919080..07db4ae16c72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4959,14 +4959,14 @@ if test "$cross_compiling" = "yes"; then
     mv config_host/*.h ../config_build
 
     OLD_PATH=$PATH
-    . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
+    . ./bin/get_config_variables CC CXX ILIB INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
     BUILD_PATH=$PATH
     PATH=$OLD_PATH
 
     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
     echo "$line" >>build-config
 
-    for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
+    for V in CC CXX ILIB LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
         VV='$'$V
         VV=`eval "echo $VV"`
         if test -n "$VV"; then
@@ -5018,6 +5018,8 @@ AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
 AC_SUBST(SDKDIRNAME_FOR_BUILD)
 AC_SUBST(WORKDIR_FOR_BUILD)
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CXX_FOR_BUILD)
 
 dnl ===================================================================
 dnl Check for syslog header
@@ -13239,8 +13241,12 @@ if test "$build_os" = "cygwin"; then
         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
     fi
 
-    AC_SUBST(ILIB)
+    if test "$cross_compiling" != "yes"; then
+        ILIB_FOR_BUILD="$ILIB"
+    fi
 fi
+AC_SUBST(ILIB)
+AC_SUBST(ILIB_FOR_BUILD)
 
 # ===================================================================
 # Creating bigger shared library to link against
diff --git a/external/gpgmepp/ExternalProject_gpgmepp.mk b/external/gpgmepp/ExternalProject_gpgmepp.mk
index c2263413ee18..313f1e41be83 100644
--- a/external/gpgmepp/ExternalProject_gpgmepp.mk
+++ b/external/gpgmepp/ExternalProject_gpgmepp.mk
@@ -21,12 +21,11 @@ $(eval $(call gb_ExternalProject_use_externals,gpgmepp,\
 ))
 
 ifeq ($(COM),MSC)
-gb_ExternalProject_gpgmepp_host := $(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32)
-gb_ExternalProject_gpgmepp_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
-$(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_get_target,cpp)
+$(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_get_target_for_build,cpp)
 	$(call gb_Trace_StartRange,gpgmepp,EXTERNAL)
-	$(call gb_ExternalProject_run,build,\
-		autoreconf \
+	$(call gb_ExternalProject_run,build, \
+		$(gb_WIN_GPG_cross_setup_exports) \
+		&& autoreconf \
 		&& ./configure \
 		   --disable-shared \
 		   --disable-languages \
@@ -38,8 +37,7 @@ $(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_
 				$(if $(ENABLE_OPTIMIZED), \
 					$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
 				$(if $(call gb_Module__symbols_enabled,gpgmepp),$(gb_DEBUGINFO_FLAGS))' \
-           --host=$(gb_ExternalProject_gpgmepp_host) \
-		   RC='windres -O COFF --target=$(gb_ExternalProject_gpgmepp_target) --preprocessor='\''$(call gb_Executable_get_target,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\' \
+		   $(gb_WIN_GPG_platform_switches) \
 		   MAKE=$(MAKE) \
 	    && $(MAKE) \
 	)
diff --git a/external/libassuan/ExternalProject_libassuan.mk b/external/libassuan/ExternalProject_libassuan.mk
index 565d38ff9a1c..e4e24aeac7fd 100644
--- a/external/libassuan/ExternalProject_libassuan.mk
+++ b/external/libassuan/ExternalProject_libassuan.mk
@@ -19,13 +19,13 @@ $(eval $(call gb_ExternalProject_use_externals,libassuan,\
        libgpg-error \
 ))
 
+
 ifeq ($(COM),MSC)
-gb_ExternalProject_libassuan_host := $(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32)
-gb_ExternalProject_libassuan_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
-$(call gb_ExternalProject_get_state_target,libassuan,build): $(call gb_Executable_get_target,cpp)
+$(call gb_ExternalProject_get_state_target,libassuan,build): $(call gb_Executable_get_target_for_build,cpp)
 	$(call gb_Trace_StartRange,libassuan,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	  autoreconf \
+	  $(gb_WIN_GPG_cross_setup_exports) \
+	  && autoreconf \
 	  && ./configure \
 		--enable-static \
 		--disable-shared \
@@ -34,8 +34,7 @@ $(call gb_ExternalProject_get_state_target,libassuan,build): $(call gb_Executabl
 		CXXFLAGS="$(CXXFLAGS)" \
 		GPG_ERROR_CFLAGS="$(GPG_ERROR_CFLAGS)" \
 		GPG_ERROR_LIBS="$(GPG_ERROR_LIBS)" \
-        --host=$(gb_ExternalProject_libassuan_host) \
-		RC='windres -O COFF --target=$(gb_ExternalProject_libassuan_target) --preprocessor='\''$(call gb_Executable_get_target,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\' \
+		$(gb_WIN_GPG_platform_switches) \
 		MAKE=$(MAKE) \
 	  && $(MAKE) \
 	)
diff --git a/external/libgpg-error/ExternalProject_libgpg-error.mk b/external/libgpg-error/ExternalProject_libgpg-error.mk
index cf0b594dca24..736079c77aec 100644
--- a/external/libgpg-error/ExternalProject_libgpg-error.mk
+++ b/external/libgpg-error/ExternalProject_libgpg-error.mk
@@ -16,20 +16,18 @@ $(eval $(call gb_ExternalProject_register_targets,libgpg-error,\
 $(eval $(call gb_ExternalProject_use_autoconf,libgpg-error,build))
 
 ifeq ($(COM),MSC)
-gb_ExternalProject_libgpg-error_host := $(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32)
-gb_ExternalProject_libgpg-error_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
-$(call gb_ExternalProject_get_state_target,libgpg-error,build): $(call gb_Executable_get_target,cpp)
+$(call gb_ExternalProject_get_state_target,libgpg-error,build): $(call gb_Executable_get_target_for_build,cpp)
 	$(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		MAKE=$(MAKE) ./configure \
+		$(gb_WIN_GPG_cross_setup_exports) \
+		&& MAKE=$(MAKE) ./configure \
 			--enable-static \
 			--disable-shared \
 			--disable-rpath \
 			--disable-languages \
 			--disable-doc \
 			--disable-tests \
-			--host=$(gb_ExternalProject_libgpg-error_host) \
-			RC='windres -O COFF --target=$(gb_ExternalProject_libgpg-error_target) --preprocessor='\''$(call gb_Executable_get_target,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\' \
+			$(gb_WIN_GPG_platform_switches) \
 	    && $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,libgpg-error,EXTERNAL)
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index bdd8173d6106..c31127ee3bbe 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -12587,8 +12587,6 @@ smoketest/libtest.cxx
 smoketest/smoketest.cxx
 solenv/bin/concat-deps.c
 solenv/gbuildtojson/gbuildtojson.cxx
-solenv/gcc-wrappers/g++.cxx
-solenv/gcc-wrappers/gcc.cxx
 solenv/gcc-wrappers/wrapper.cxx
 soltools/cpp/_cpp.c
 soltools/cpp/_eval.c
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index bd621fdd41a2..b66063f270eb 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -598,10 +598,10 @@ endef
 gb_AUTOCONF_WRAPPERS = \
 	REAL_CC="$(shell cygpath -w $(filter-out -%,$(CC)))" \
 	REAL_CC_FLAGS="$(filter -%,$(CC))" \
-	CC="$(call gb_Executable_get_target,gcc-wrapper)" \
+	CC="$(call gb_Executable_get_target,gcc-wrapper) $(if $(verbose),--wrapper-print-cmdline)" \
 	REAL_CXX="$(shell cygpath -w $(filter-out -%,$(CXX)))" \
 	REAL_CXX_FLAGS="$(filter -%,$(CXX))" \
-	CXX="$(call gb_Executable_get_target,g++-wrapper)" \
+	CXX="$(call gb_Executable_get_target,g++-wrapper) $(if $(verbose),--wrapper-print-cmdline)" \
     LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo"
 
 gb_ExternalProject_INCLUDE := \
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 05de2691a03e..5a02731bac7b 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -361,4 +361,12 @@ define gb_Helper_extend_ld_path
 $(gb_Helper_set_ld_path)';$(shell cygpath $(gb_MAKE_CYGPATH) $(1))'
 endef
 
+# common macros to build GPG related libraries
+# we explicitly have to replace cygwin with mingw32 for the host, but the build must stay cygwin, or cmd.exe processes will be spawned
+gb_WIN_GPG_WINDRES_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
+gb_WIN_GPG_platform_switches := --build=$(BUILD_PLATFORM) --host=$(subst cygwin,mingw32,$(HOST_PLATFORM))
+gb_WIN_GPG_cross_setup_exports = export REAL_BUILD_CC="$(CC_FOR_BUILD)" \
+    && export CC_FOR_BUILD="$(call gb_Executable_get_target_for_build,gcc-wrapper) $(if $(verbose),--wrapper-print-cmdline) --wrapper-env-prefix=REAL_BUILD_ $(SOLARINC) -L$(subst ;, -L,$(ILIB_FOR_BUILD))" \
+    && export RC='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor='\''$(call gb_Executable_get_target_for_build,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\'
+
 # vim: set noet sw=4:
diff --git a/solenv/gcc-wrappers/g++.cxx b/solenv/gcc-wrappers/g++.cxx
index 626b1643590c..2f99d4606ac7 100644
--- a/solenv/gcc-wrappers/g++.cxx
+++ b/solenv/gcc-wrappers/g++.cxx
@@ -9,19 +9,21 @@
 
 #include "wrapper.hxx"
 
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[])
+{
     vector<string> rawargs(argv + 1, argv + argc);
 
-    string command=getexe("REAL_CXX");
-    string flags=getexe("REAL_CXX_FLAGS", true);
+    string env_prefix; // defaults to REAL_
+    bool verbose = false;
+    string args = processccargs(rawargs, env_prefix, verbose);
 
-    string args=flags.empty() ? string() : flags + " ";
-    args += processccargs(rawargs);
+    string command = getexe(env_prefix + "CXX");
+    string flags = getexe(env_prefix + "CXX_FLAGS", true);
+    args.insert(0, flags.empty() ? string() : flags + " ");
 
     setupccenv();
 
-    return startprocess(command,args);
-
+    return startprocess(command, args, verbose);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/gcc-wrappers/gcc.cxx b/solenv/gcc-wrappers/gcc.cxx
index f34c2dba8c99..8accb8216a11 100644
--- a/solenv/gcc-wrappers/gcc.cxx
+++ b/solenv/gcc-wrappers/gcc.cxx
@@ -9,19 +9,21 @@
 
 #include "wrapper.hxx"
 
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[])
+{
     vector<string> rawargs(argv + 1, argv + argc);
 
-    string command=getexe("REAL_CC");
-    string flags=getexe("REAL_CC_FLAGS", true);
+    string env_prefix; // defaults to REAL_
+    bool verbose = false;
+    string args = processccargs(rawargs, env_prefix, verbose);
 
-    string args=flags.empty() ? string() : flags + " ";
-    args += processccargs(rawargs);
+    string command = getexe(env_prefix + "CC");
+    string flags = getexe(env_prefix + "CC_FLAGS", true);
+    args.insert(0, flags.empty() ? string() : flags + " ");
 
     setupccenv();
 
-    return startprocess(command,args);
-
+    return startprocess(command, args, verbose);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index b156c89dc220..786b8687bb87 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -82,7 +82,13 @@ void setupccenv() {
     }
 }
 
-string processccargs(vector<string> rawargs) {
+string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
+{
+    // default env var prefix
+    env_prefix = "REAL_";
+    verbose = false;
+    bool env_prefix_next_arg = false;
+
     // suppress the msvc banner
     string args=" -nologo";
     // TODO: should these options be enabled globally?
@@ -101,6 +107,13 @@ string processccargs(vector<string> rawargs) {
     string linkargs(" -link -debug");
 
     for(vector<string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
+        if (env_prefix_next_arg)
+        {
+            env_prefix = *i;
+            env_prefix_next_arg = false;
+            continue;
+        }
+
         args.append(" ");
         if(*i == "-o") {
             // TODO: handle more than just exe output
@@ -121,6 +134,11 @@ string processccargs(vector<string> rawargs) {
                 linkargs.append(" -dll -out:");
                 linkargs.append(*i);
             }
+            else if (dot == string::npos)
+            {
+                args.append("-Fe");
+                args.append(*i + ".exe");
+            }
             else
             {
                 cerr << "unknown -o argument - please adapt gcc-wrapper for \""
@@ -159,14 +177,41 @@ string processccargs(vector<string> rawargs) {
         }
         else if(*i == "-Werror")
             args.append("-WX");
+        else if (*i == "--wrapper-print-cmdline")
+            verbose = true;
         else
-            args.append(*i);
+        {
+            size_t pos = i->find("=");
+            if (0 == i->compare(0, pos, "--wrapper-env-prefix"))
+            {
+                if (pos == string::npos)
+                    env_prefix_next_arg = true;
+                else if (pos + 1 == i->length())
+                {
+                    // bailout - missing arg
+                    env_prefix_next_arg = true;
+                    break;
+                }
+                else
+                    env_prefix = i->substr(pos + 1);
+            }
+            else
+                args.append(*i);
+        }
     }
+
+    if (env_prefix_next_arg)
+    {
+        cerr << "wrapper-env-prefix needs an argument!" << endl;
+        exit(1);
+    }
+
     args.append(linkargs);
     return args;
 }
 
-int startprocess(string command, string args) {
+int startprocess(string command, string args, bool verbose)
+{
     STARTUPINFO si;
     PROCESS_INFORMATION pi;
     SECURITY_ATTRIBUTES sa;
@@ -200,7 +245,8 @@ int startprocess(string command, string args) {
 
     auto cmdline = "\"" + command + "\" " + args;
 
-    //cerr << "CMD= " << command << " " << args << endl;
+    if (verbose)
+        cerr << "CMD= " << command << " " << args << endl;
 
     // Commandline may be modified by CreateProcess
     char* cmdlineBuf=_strdup(cmdline.c_str());
diff --git a/solenv/gcc-wrappers/wrapper.hxx b/solenv/gcc-wrappers/wrapper.hxx
index 789bc9280267..208d9b82c449 100644
--- a/solenv/gcc-wrappers/wrapper.hxx
+++ b/solenv/gcc-wrappers/wrapper.hxx
@@ -20,9 +20,9 @@ string getexe(string exename, bool maybeempty = false);
 
 void setupccenv();
 
-string processccargs(vector<string> rawargs);
+string processccargs(vector<string> rawargs, string& env_prefix, bool& verbose);
 
-int startprocess(string command, string args);
+int startprocess(string command, string args, bool verbose);
 
 #endif // INCLUDED_SOLENV_GCC_WRAPPERS_WRAPPER_HXX
 
commit 37b61107ac75fc44659506402074303cf2973ed0
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Jul 18 04:00:00 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    WIN cross: fix libjpeg-turbo build
    
    Change-Id: Iae4696df714ba27c0053f7ca3eb485816e8e58c7

diff --git a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
index a6c8f0d77a2f..a5cd4c57ddc7 100644
--- a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
+++ b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
@@ -28,8 +28,8 @@ $(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) :
 	$(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL)
 	$(call gb_ExternalProject_run,configure,\
 		MAKE=$(MAKE) ./configure \
-			--build=$(if $(filter WNT,$(OS)),$(if $(filter INTEL,$(CPUNAME)),i686-pc-cygwin,x86_64-pc-cygwin),$(BUILD_PLATFORM)) \
-			--host=$(if $(filter WNT,$(OS)),$(if $(filter INTEL,$(CPUNAME)),i686-pc-cygwin,x86_64-pc-cygwin),$(HOST_PLATFORM)) \
+			--build=$(BUILD_PLATFORM) \
+			--host=$(HOST_PLATFORM) \
 			--with-pic \
 			--enable-static \
 			--disable-shared \
commit 10cb62000a6a692ab5c51a73cfcc83d4cb373a61
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 17 23:05:15 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    image-sort: add --quiet option for build-tools
    
    Otherwise you'll get many warnings for missing images, because the
    cross-toolset target just builds some small part of LO.
    
    This also converts the program to use argparse.
    
    Change-Id: I22adda23ab3a25bced871a87d38373543cd5ae72

diff --git a/postprocess/CustomTarget_images.mk b/postprocess/CustomTarget_images.mk
index 0d2db4f7b2bb..42ddfdadd8c7 100644
--- a/postprocess/CustomTarget_images.mk
+++ b/postprocess/CustomTarget_images.mk
@@ -115,6 +115,7 @@ $(packimages_DIR)/sorted.lst : \
 	$(call gb_Helper_abbreviate_dirs, \
 		$(call gb_ExternalExecutable_get_command,python) \
 			$(SRCDIR)/solenv/bin/image-sort.py \
+			$(if $(filter build,$(gb_Side)),--quiet) \
 			$< $(INSTROOT)/$(gb_UIConfig_INSTDIR) $@)
 	$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
 
diff --git a/solenv/bin/image-sort.py b/solenv/bin/image-sort.py
index ce69db3e64a4..d45037e25c7f 100644
--- a/solenv/bin/image-sort.py
+++ b/solenv/bin/image-sort.py
@@ -18,17 +18,19 @@
 #
 
 import sys, os, re
+import argparse
 
 global_list = []
 global_hash = {}
-base_path = None
+args = None
 
 def read_icons(fname):
-    global base_path
+    global args
     images = []
-    full_path = os.path.join(base_path, fname)
+    full_path = os.path.join(args.base_path, fname)
     if not os.path.exists(full_path):
-        print("Skipping non-existent {}\n".format(full_path))
+        if not args.quiet:
+            print("Skipping non-existent {}\n".format(full_path), file=sys.stderr)
         return images
     with open(full_path) as fp:
         for line in fp:
@@ -116,34 +118,37 @@ def chew_controlfile(ifile):
         else:
             filelist.append(line)
 
-if len(sys.argv) == 1:
-    print("image-sort <image-sort.lst> /path/to/OOOo/source/root\n")
-    sys.exit(1)
-
+parser = argparse.ArgumentParser()
 # where the control file lives
-control = sys.argv[1]
+parser.add_argument('control_file', metavar='image-sort.lst', type=open,
+                    help='the sort control file')
 # where the uiconfigs live
-base_path = sys.argv[2]
-# output
-if len(sys.argv) > 3:
-    output = open(sys.argv[3], 'w')
+parser.add_argument('base_path', metavar='directory',
+                    help='path to the UIConfigs directory')
+parser.add_argument('output', metavar='output file', type=argparse.FileType('w'),
+                    nargs='?', default=None, help='optionally write to this output file')
+parser.add_argument("-q", "--quiet", action="store_true",
+                    help="don't print status messages to stdout")
+
+args = parser.parse_args()
+
+if args.output is not None:
     close_output = True
 else:
-    output = sys.stdout
+    args.output = sys.stdout
     close_output = False
 
-with open(control) as controlfile:
-    chew_controlfile(controlfile)
+chew_controlfile(args.control_file)
 
 for icon in global_list:
     if not icon.startswith('sc_'):
-        output.write(icon + "\n")
+        args.output.write(icon + "\n")
 
 for icon in global_list:
     if icon.startswith('sc_'):
-        output.write(icon + "\n")
+        args.output.write(icon + "\n")
 
 if close_output:
-    output.close()
+    args.output.close()
 
 # dnl vim:set shiftwidth=4 softtabstop=4 expandtab:
commit e44a312f84fbc920c5bc5fa117a5ad3ffdb5a75c
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 17 22:14:39 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    Fix the minimal build-tools target
    
    The revert commits change the build-tools target for a DESKTOP
    build to build the complete LO. This restores the original,
    minimal one and also adds a whitelist of allowd build types.
    
    OpenCL needs a configure switch, as it's status is also stored
    in a config header, so preventing the build is not enough.
    
    This also reverts:
    - commit 802161a505272732566210e9ebbd8fe1b23fb86d
    - commit 02d931a59e2966d0c2736db8dee7be3e3dcd6bae
    
    Change-Id: Ibfcb0c54e72da1b7c2e63c082ea6586520a787fa

diff --git a/Makefile.gbuild b/Makefile.gbuild
index c90a9feee3a9..cd7fc973c287 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -18,12 +18,7 @@ include $(BUILDDIR)/config_$(gb_Side).mk
 
 include $(SRCDIR)/solenv/gbuild/gbuild.mk
 
-# If cross-compiling to a DESKTOP platform, just use RepositoryModule_host.mk on the build platform, too
-ifeq ($(gb_Side)-$(filter DESKTOP,$(BUILD_TYPE_FOR_HOST)),build-DESKTOP)
-$(eval $(call gb_Module_make_global_targets,$(SRCDIR)/RepositoryModule_host.mk))
-else
 $(eval $(call gb_Module_make_global_targets,$(SRCDIR)/RepositoryModule_$(gb_Side).mk))
-endif
 
 upload-symbols:
 	bin/upload_symbols.py $(WORKDIR)/symbols.zip $(BREAKPAD_SYMBOL_CONFIG) "$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)"
diff --git a/Makefile.in b/Makefile.in
index 7d12aff6ffa7..8b8267fcb6db 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -294,7 +294,7 @@ cross-toolset: bootstrap fetch
 ifneq ($(OS),iOS)
 	$(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(BUILDDIR)/Makefile fetch
 endif
-	$(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(if $(filter DESKTOP,$(BUILD_TYPE)),build,build-tools)
+	$(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
 
 install-gdb-printers:
 ifneq ($(filter-out WNT MACOSX iOS,$(OS)),)
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 096fbea6bebf..3d025d714329 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3881,7 +3881,7 @@ $(call gb_Executable_add_runtime_dependencies,gengal,\
 	$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
 	$(if $(filter MACOSX,$(OS)),$(call gb_Library_get_target,vclplug_osx)) \
 	$(if $(filter WNT,$(OS)),$(call gb_Library_get_target,vclplug_win)) \
-	$(call gb_Package_get_target_for_build,postprocess_images) \
+	$(if $(filter host,$(gb_Side)),$(call gb_Package_get_target,postprocess_images)) \
 	$(call gb_Package_get_target_for_build,postprocess_registry) \
 	$(INSTROOT_FOR_BUILD)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
 	$(INSTROOT_FOR_BUILD)/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,fundamental) \
diff --git a/RepositoryModule_build.mk b/RepositoryModule_build.mk
index 9537ccd1d770..34322743197e 100644
--- a/RepositoryModule_build.mk
+++ b/RepositoryModule_build.mk
@@ -55,6 +55,41 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
 	unotools \
 	ure \
 	xmlreader \
+	$(call gb_Helper_optional_for_host,DESKTOP, \
+		$(if $(WITH_GALLERY_BUILD), \
+			avmedia \
+			basic \
+			canvas \
+			configmgr \
+			connectivity \
+			cppcanvas \
+			drawinglayer \
+			editeng \
+			emfio \
+			filter \
+			framework \
+			linguistic \
+			officecfg \
+			package \
+			postprocess \
+			sfx2 \
+			shell \
+			sot \
+			svgio \
+			svl \
+			svtools \
+			svx \
+			toolkit \
+			ucb \
+			unoxml \
+			uui \
+			vcl \
+			xmloff \
+			xmlscript \
+		) \
+		helpcompiler \
+		xmlhelp \
+	) \
 	$(call gb_Helper_optional,QADEVOOO,qadevOOo) \
 ))
 
diff --git a/configure.ac b/configure.ac
index 26451f60a87c..1749a9919080 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1584,6 +1584,11 @@ AC_ARG_ENABLE(ldap,
         [Disable LDAP support.]),
 ,enable_ldap=yes)
 
+AC_ARG_ENABLE(opencl,
+    AS_HELP_STRING([--disable-opencl],
+        [Disable OpenCL support.]),
+,enable_opencl=yes)
+
 dnl ===================================================================
 dnl Optional Packages (--with/without-)
 dnl ===================================================================
@@ -3587,7 +3592,9 @@ if test "$_os" = "WINNT"; then
             WIN_MULTI_ARCH=""
             WIN_OTHER_ARCH=""
         fi
-    else
+    fi
+
+    if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
         test_cl_exe "build" "$MSVC_BUILD_PATH"
     fi
@@ -4885,20 +4892,66 @@ if test "$cross_compiling" = "yes"; then
     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
     # Don't bother having configure look for stuff not needed for the build platform anyway
     ./configure \
+        --build="$build_alias" \
         --disable-cups \
+        --disable-firebird-sdbc \
         --disable-gpgmepp \
         --disable-gstreamer-1-0 \
         --disable-gtk3 \
+        --disable-online-update \
+        --disable-opencl \
+        --disable-pch \
         --disable-pdfimport \
         --disable-postgresql-sdbc \
+        --disable-skia \
         --enable-icecream="$enable_icecream" \
-        --with-parallelism="$with_parallelism" \
         --without-doxygen \
         --without-java \
+        --without-webdav \
+        --with-parallelism="$with_parallelism" \
+        --with-theme="$with_theme" \
+        --with-tls=openssl \
         $sub_conf_opts \
         --srcdir=$srcdir \
         2>&1 | sed -e 's/^/    /'
     test -f ./config_host.mk 2>/dev/null || exit
+
+    # filter accepted build types
+    BUILD_TARGETS_WHITELIST="
+        AVMEDIA
+        BOOST
+        CLUCENE
+        DBCONNECTIVITY
+        DESKTOP
+        DYNLOADING
+        EPOXY
+        EXPAT
+        GLM
+        GRAPHITE
+        HARFBUZZ
+        ICU
+        LCMS2
+        LIBJPEG_TURBO
+        LIBLANGTAG
+        LibO
+        LIBFFI
+        LIBPN
+        LIBXML2
+        LIBXSLT
+        MDDS
+        NATIVE
+        OPENSSL
+        ORCUS
+        PYTHON
+        SCRIPTING
+        ZLIB
+"
+    # converts BUILD_TYPE and whitelist into non-whitespace, newlined lists, to use grep as a filter
+    BUILD_TARGETS_WHITELIST=$(echo "$BUILD_TARGETS_WHITELIST" | sed -e '/^ *$/d' -e 's/ *//')
+    BUILD_TARGETS="$(sed -ne '/^export BUILD_TYPE=/ { s/.*=// ; s/ /\n/gp }' config_host.mk)"
+    BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$BUILD_TARGETS_WHITELIST" | tr '\n' ' ')"
+    sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
+
     cp config_host.mk ../config_build.mk
     cp config_host_lang.mk ../config_build_lang.mk
     mv config.log ../config.Build.log
@@ -8755,13 +8808,6 @@ else
     AC_MSG_RESULT([internal])
     SYSTEM_LIBXSLT=
     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
-
-    if test "$cross_compiling" = "yes"; then
-        AC_PATH_PROG(XSLTPROC, xsltproc, no)
-        if test "$XSLTPROC" = "no"; then
-            AC_MSG_ERROR([xsltproc is required])
-        fi
-    fi
 fi
 AC_SUBST(SYSTEM_LIBXSLT)
 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
@@ -11075,7 +11121,7 @@ dnl =================================================
 dnl Check whether to build with OpenCL support.
 dnl =================================================
 
-if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
+if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
     # platform (optional at run-time, used through clew).
     BUILD_TYPE="$BUILD_TYPE OPENCL"
diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk
index 6a5dd926331b..a8b195aa01f7 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -82,12 +82,14 @@ $(eval $(call gb_Module_add_targets,connectivity,\
 ))
 endif
 
+ifeq ($(gb_Side),host)
 ifeq ($(ENABLE_MARIADBC),TRUE)
 $(eval $(call gb_Module_add_targets,connectivity,\
 	Configuration_mysql \
 	Library_mysqlc \
 ))
 endif
+endif
 
 ifneq ($(BUILD_POSTGRESQL_SDBC),)
 $(eval $(call gb_Module_add_targets,connectivity,\
diff --git a/external/liblangtag/ExternalProject_liblangtag.mk b/external/liblangtag/ExternalProject_liblangtag.mk
index 060c6f3601a8..51dc4f4b0c68 100644
--- a/external/liblangtag/ExternalProject_liblangtag.mk
+++ b/external/liblangtag/ExternalProject_liblangtag.mk
@@ -33,7 +33,8 @@ $(call gb_ExternalProject_get_state_target,liblangtag,build):
 				$(if $(ENABLE_OPTIMIZED), \
 					$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
 				$(if $(call gb_Module__symbols_enabled,liblangtag),$(gb_DEBUGINFO_FLAGS))' \
-		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) "ac_cv_va_copy=no") \
+		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+		    $(if $(filter WNT,$(OS)),"lt_cv_c99_vsnprintf=yes" "ac_cv_va_copy=yes","ac_cv_va_copy=no")) \
 		LIBXML2_CFLAGS="$(LIBXML_CFLAGS)" \
 		LIBXML2_LIBS="$(if $(filter WNT,$(OS)),-L$(call gb_UnpackedTarball_get_dir,libxml2)/win32/bin.msvc -llibxml2,$(LIBXML_LIBS))" \
 		$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________URELIB) \
diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk
index a5b520992786..e3930b8217c4 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -311,15 +311,18 @@ postprocess_FILES_main += \
 		# VCL-unixdesktop.xcu must come after VCL.xcu
 else ifeq (WNT,$(OS))
 postprocess_FILES_main += \
-	$(call gb_XcuModuleTarget_get_target,connectivity/registry/ado)/org/openoffice/Office/DataAccess/Drivers-ado.xcu \
 	$(postprocess_MOD)/org/openoffice/Inet-wnt.xcu \
 	$(postprocess_MOD)/org/openoffice/Office/Accelerators-unxwnt.xcu \
 	$(postprocess_MOD)/org/openoffice/Office/Common-wnt.xcu \
 	$(postprocess_MOD)/org/openoffice/Office/Paths-unxwnt.xcu \
 	$(postprocess_MOD)/org/openoffice/ucb/Configuration-win.xcu
 		# Inet-wnt.xcu must come after Inet.xcu
+ifeq ($(gb_Side),host)
+postprocess_FILES_main += \
+	$(call gb_XcuModuleTarget_get_target,connectivity/registry/ado)/org/openoffice/Office/DataAccess/Drivers-ado.xcu
 postprocess_DRIVERS += ado
 endif
+endif
 ifneq ($(WITH_WEBDAV),)
 postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/ucb/Configuration-webdav.xcu
 endif
@@ -340,11 +343,13 @@ postprocess_FILES_main += \
 postprocess_DRIVERS += firebird_sdbc
 endif
 
+ifeq ($(gb_Side),host)
 ifeq ($(ENABLE_MARIADBC),TRUE)
 postprocess_FILES_main += \
 	$(call gb_XcuModuleTarget_get_target,connectivity/registry/mysqlc)/org/openoffice/Office/DataAccess/Drivers-mysqlc.xcu
 postprocess_DRIVERS += mysqlc
 endif
+endif
 
 ifneq (,$(SYSTEM_LIBEXTTEXTCAT_DATA))
 postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/Office/Paths-externallibexttextcatdata.xcu
diff --git a/postprocess/Module_postprocess.mk b/postprocess/Module_postprocess.mk
index 4671cbc84508..c1aa1dbc7e87 100644
--- a/postprocess/Module_postprocess.mk
+++ b/postprocess/Module_postprocess.mk
@@ -13,11 +13,16 @@ $(eval $(call gb_Module_Module,postprocess))
 # is reused in Package_registry!
 
 $(eval $(call gb_Module_add_targets,postprocess,\
-	CustomTarget_images \
 	CustomTarget_registry \
-	Package_images \
 	Rdb_services \
 ))
+ifeq ($(gb_Side),host)
+$(eval $(call gb_Module_add_targets,postprocess,\
+	CustomTarget_images \
+	Package_images \
+))
+endif
+
 $(eval $(call gb_Module_add_l10n_targets,postprocess,\
 	Package_registry \
 ))
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 71f9421f6a90..1d9e50a7ce9e 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -9,30 +9,75 @@
 
 $(eval $(call gb_Rdb_Rdb_install,services))
 
+#
+# "minimal" list of services for cross-compiling build tools
+#
 $(eval $(call gb_Rdb_add_components,services,\
-	animations/source/animcore/animcore \
 	$(call gb_Helper_optional,AVMEDIA,avmedia/util/avmedia) \
-	chart2/source/controller/chartcontroller \
-	chart2/source/chartcore \
+	$(call gb_Helper_optional,SCRIPTING,basic/util/sb) \
 	canvas/source/factory/canvasfactory \
 	canvas/source/simplecanvas/simplecanvas \
 	canvas/source/vcl/vclcanvas \
+	$(if $(ENABLE_CAIRO_CANVAS),canvas/source/cairo/cairocanvas) \
+	$(if $(ENABLE_OPENGL_CANVAS),canvas/source/opengl/oglcanvas) \
+	$(if $(filter WNT,$(OS)), \
+		canvas/source/directx/directx9canvas \
+		canvas/source/directx/gdipluscanvas \
+	) \
 	comphelper/util/comphelp \
 	configmgr/source/configmgr \
+	$(if $(filter DBCONNECTIVITY,$(BUILD_TYPE)), \
+		connectivity/source/dbtools/dbtools \
+		connectivity/source/drivers/dbase/dbase \
+	) \
 	cppcanvas/source/uno/mtfrenderer \
+	drawinglayer/drawinglayer \
+	emfio/emfio \
+	filter/source/config/cache/filterconfig1 \
+	filter/source/graphic/graphicfilter \
+	filter/source/svg/svgfilter \
+	framework/util/fwk \
+	i18npool/source/search/i18nsearch \
+	i18npool/util/i18npool \
+	package/source/xstor/xstor \
+	package/util/package2 \
+	sax/source/expatwrap/expwrap \
+	sot/util/sot \
+	svgio/svgio \
+	svl/source/fsstor/fsstorage \
+	svl/source/passwordcontainer/passwordcontainer \
+	svl/util/svl \
+	svtools/util/svt \
+	svx/util/svxcore \
+	toolkit/util/tk \
+	ucb/source/core/ucb1 \
+	ucb/source/ucp/file/ucpfile1 \
+	unotools/util/utl \
+	unoxml/source/service/unoxml \
+	uui/util/uui \
+	vcl/vcl.common \
+	$(if $(filter ANDROID,$(OS)),vcl/vcl.android) \
+	$(if $(DISABLE_GUI),vcl/vcl.headless) \
+	$(if $(filter iOS,$(OS)),vcl/vcl.ios) \
+	$(if $(filter MACOSX,$(OS)),vcl/vcl.macosx) \
+	$(if $(filter WNT,$(OS)),vcl/vcl.windows) \
+))
+
+ifeq ($(gb_Side),host)
+
+$(eval $(call gb_Rdb_add_components,services,\
+	animations/source/animcore/animcore \
+	chart2/source/controller/chartcontroller \
+	chart2/source/chartcore \
 	cui/util/cui \
 	desktop/source/deployment/deployment \
-	drawinglayer/drawinglayer \
 	dtrans/util/mcnttype \
 	embeddedobj/util/embobj \
 	eventattacher/source/evtatt \
-	filter/source/config/cache/filterconfig1 \
-	filter/source/graphic/graphicfilter \
 	filter/source/msfilter/msfilter \
 	filter/source/odfflatxml/odfflatxml \
 	filter/source/pdf/pdffilter \
 	filter/source/storagefilterdetect/storagefd \
-	filter/source/svg/svgfilter \
 	filter/source/t602/t602filter \
 	filter/source/textfilterdetect/textfd \
 	filter/source/xmlfilteradaptor/xmlfa \
@@ -41,10 +86,7 @@ $(eval $(call gb_Rdb_add_components,services,\
 	filter/source/xsltfilter/xsltfilter \
 	formula/util/for \
 	$(call gb_Helper_optional,DESKTOP,fpicker/source/office/fps_office) \
-	framework/util/fwk \
 	hwpfilter/source/hwp \
-	i18npool/source/search/i18nsearch \
-	i18npool/util/i18npool \
 	lingucomponent/source/hyphenator/hyphen/hyphen \
 	lingucomponent/source/languageguessing/guesslang \
 	$(if $(filter-out iOS,$(OS)), \
@@ -57,9 +99,6 @@ $(eval $(call gb_Rdb_add_components,services,\
 	    lotuswordpro/util/lwpfilter \
 	) \
 	oox/util/oox \
-	package/source/xstor/xstor \
-	package/util/package2 \
-	sax/source/expatwrap/expwrap \
 	sc/util/sc \
 	sc/util/scd \
 	sc/util/scfilt \
@@ -73,40 +112,25 @@ $(eval $(call gb_Rdb_add_components,services,\
 	sdext/source/minimizer/minimizer \
 	sfx2/util/sfx \
 	slideshow/util/slideshow \
-	sot/util/sot \
 	starmath/util/sm \
 	starmath/util/smd \
-	svl/source/fsstor/fsstorage \
-	svl/source/passwordcontainer/passwordcontainer \
-	svl/util/svl \
-	svtools/util/svt \
-	svgio/svgio \
-	emfio/emfio \
 	svx/util/svx \
-	svx/util/svxcore \
 	svx/util/textconversiondlgs \
 	sw/util/msword \
 	sw/util/sw \
 	sw/util/swd \
-	toolkit/util/tk \
 	ucb/source/sorter/srtrs1 \
-	ucb/source/core/ucb1 \
 	ucb/source/cacher/cached1 \
 	$(if $(ENABLE_LIBCMIS),ucb/source/ucp/cmis/ucpcmis1) \
 	ucb/source/ucp/expand/ucpexpand1 \
 	ucb/source/ucp/ext/ucpext \
-	ucb/source/ucp/file/ucpfile1 \
 	$(if $(ENABLE_CURL),ucb/source/ucp/ftp/ucpftp1) \
 	ucb/source/ucp/hierarchy/ucphier1 \
 	ucb/source/ucp/image/ucpimage \
 	ucb/source/ucp/package/ucppkg1 \
 	ucb/source/ucp/tdoc/ucptdoc1 \
 	UnoControls/util/ctl \
-	unotools/util/utl \
 	unoxml/source/rdf/unordf \
-	unoxml/source/service/unoxml \
-	uui/util/uui \
-	vcl/vcl.common \
 	xmloff/source/transform/xof \
 	xmloff/util/xo \
 	xmlscript/util/xmlscript \
@@ -127,16 +151,11 @@ $(eval $(call gb_Rdb_add_components,services,\
 	writerperfect/source/calc/wpftcalc \
 	$(if $(filter MACOSX,$(OS)), \
 		$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
-		fpicker/source/aqua/fps_aqua \
 		shell/source/backends/macbe/macbe1 \
-		vcl/vcl.macosx \
 	) \
 	$(if $(filter iOS MACOSX,$(OS)), \
 		lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \
 	) \
-	$(if $(filter iOS,$(OS)), \
-		vcl/vcl.ios \
-	) \
 	$(if $(filter WNT,$(OS)), \
 		avmedia/source/win/avmediawin \
 		dtrans/source/generic/dtrans \
@@ -147,13 +166,6 @@ $(eval $(call gb_Rdb_add_components,services,\
 		shell/source/backends/wininetbe/wininetbe1 \
 		shell/source/win32/simplemail/smplmail \
 		shell/source/win32/syssh \
-		vcl/vcl.windows \
-	) \
-	$(if $(DISABLE_GUI), \
-		vcl/vcl.headless \
-	) \
-	$(if $(filter ANDROID,$(OS)), \
-		vcl/vcl.android \
 	) \
 	$(if $(filter-out WNT,$(OS)), \
 		embeddedobj/source/msole/emboleobj \
@@ -169,7 +181,6 @@ $(eval $(call gb_Rdb_add_components,services,\
 	) \
 	$(call gb_Helper_optional,SCRIPTING, \
 		basctl/util/basctl \
-		basic/util/sb \
 		sc/util/vbaobj \
 		scripting/source/basprov/basprov \
 		scripting/source/dlgprov/dlgprov \
@@ -186,16 +197,6 @@ $(eval $(call gb_Rdb_add_components,services,\
 			wizards/com/sun/star/wizards/letter/letter \
 		) \
 	) \
-	$(if $(ENABLE_CAIRO_CANVAS), \
-		canvas/source/cairo/cairocanvas \
-	) \
-	$(if $(filter WNT,$(OS)), \
-		canvas/source/directx/directx9canvas \
-		canvas/source/directx/gdipluscanvas \
-	) \
-	$(if $(ENABLE_OPENGL_CANVAS), \
-        canvas/source/opengl/oglcanvas \
-	) \
 	$(if $(ENABLE_GIO), \
 		shell/source/sessioninstall/losessioninstall \
 		ucb/source/ucp/gio/ucpgio \
@@ -233,18 +234,16 @@ $(eval $(call gb_Rdb_add_components,services,\
 	dbaccess/util/dba \
 ))
 
-ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
+ifneq (,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
 
 $(eval $(call gb_Rdb_add_components,services,\
 	extensions/source/dbpilots/dbp \
 	extensions/source/propctrlr/pcr \
 	connectivity/source/cpool/dbpool2 \
-	connectivity/source/dbtools/dbtools \
 	$(if $(filter WNT,$(OS)), \
 		connectivity/source/drivers/ado/ado \
 	) \
 	connectivity/source/drivers/calc/calc \
-	connectivity/source/drivers/dbase/dbase \
 	$(if $(ENABLE_EVOAB2), \
 		connectivity/source/drivers/evoab2/evoab \
 	) \
@@ -340,4 +339,6 @@ $(eval $(call gb_Rdb_add_components,services,\
 ))
 endif
 
+endif # $(gb_Side),host
+
 # vim: set noet sw=4 ts=4:
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index a223aae617e0..e6d66355c27e 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -9,6 +9,14 @@
 
 $(eval $(call gb_Module_Module,shell))
 
+ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
+$(eval $(call gb_Module_add_targets,shell,\
+	Executable_lngconvex \
+))
+endif
+
+ifeq ($(gb_Side),host)
+
 $(eval $(call gb_Module_add_targets,shell,\
 	$(if $(filter-out MACOSX WNT,$(OS)),Library_desktopbe) \
 	Library_localebe \
@@ -99,7 +107,6 @@ endif
 ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
 
 $(eval $(call gb_Module_add_targets,shell,\
-	Executable_lngconvex \
 	Library_syssh \
 ))
 
@@ -120,4 +127,6 @@ $(eval $(call gb_Module_add_l10n_targets,shell,\
     AllLangMoTarget_shell \
 ))
 
+endif # $(gb_Side) == host
+
 # vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/solenv/gbuild/extensions/pre_BuildTools.mk b/solenv/gbuild/extensions/pre_BuildTools.mk
index 9e5b8df11814..c45be554a128 100644
--- a/solenv/gbuild/extensions/pre_BuildTools.mk
+++ b/solenv/gbuild/extensions/pre_BuildTools.mk
@@ -13,6 +13,7 @@ gb_BUILD_TOOLS = \
 	$(foreach executable, \
 		bestreversemap \
 		cfgex \
+		climaker \
 		cpp \
 		cppumaker \
 		gencoll_rule \
@@ -35,6 +36,7 @@ gb_BUILD_TOOLS = \
 			gengal \
 			HelpIndexer \
 			HelpLinker \
+			lngconvex \
 		) \
 	,$(call gb_Executable_get_runtime_dependencies,$(executable))) \
 	$(foreach executable, \
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index b9bde52cdc01..bd621fdd41a2 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -543,13 +543,13 @@ $(eval $(call gb_Helper_make_dep_targets,\
 
 ifeq ($(gb_FULLDEPS),$(true))
 # FIXME this is used before TargetLocations is read?
-gb_WinResTarget__command_target = $(WORKDIR)/LinkTarget/Executable/makedepend.exe
+gb_WinResTarget__command_target = $(WORKDIR_FOR_BUILD)/LinkTarget/Executable/makedepend.exe
 define gb_WinResTarget__command_dep
 $(call gb_Output_announce,RC:$(2),$(true),DEP,1)
 	$(call gb_Trace_StartRange,RC:$(2),DEP)
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
-	$(call gb_Executable_get_target,makedepend) \
+	$(call gb_Executable_get_target_for_build,makedepend) \
 		$(INCLUDE) \
 		$(DEFS) \
 		$(RCFILE) \
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index 2040a906891f..599f842d480e 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -22,9 +22,14 @@ $(eval $(call gb_Module_Module,svx))
 $(eval $(call gb_Module_add_targets,svx,\
     Library_svx \
     Library_svxcore \
+))
+
+ifeq ($(gb_Side),host)
+$(eval $(call gb_Module_add_targets,svx,\
     Library_textconversiondlgs \
     UIConfig_svx \
 ))
+endif
 
 $(eval $(call gb_Module_add_l10n_targets,svx,\
     AllLangMoTarget_svx \
diff --git a/unotest/Module_unotest.mk b/unotest/Module_unotest.mk
index a47ca5d4b694..bdffe8e8ac14 100644
--- a/unotest/Module_unotest.mk
+++ b/unotest/Module_unotest.mk
@@ -10,6 +10,7 @@
 
 $(eval $(call gb_Module_Module,unotest))
 
+ifeq ($(gb_Side),host)
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,unotest,\
 	Library_unobootstrapprotector \
@@ -29,5 +30,6 @@ $(eval $(call gb_Module_add_targets,unotest,\
 ))
 endif
 endif
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/unoxml/Module_unoxml.mk b/unoxml/Module_unoxml.mk
index 5008d828c13b..8c55b830e42a 100644
--- a/unoxml/Module_unoxml.mk
+++ b/unoxml/Module_unoxml.mk
@@ -21,8 +21,13 @@ $(eval $(call gb_Module_Module,unoxml))
 
 $(eval $(call gb_Module_add_targets,unoxml,\
     Library_unoxml \
+))
+
+ifeq ($(gb_Side),host)
+$(eval $(call gb_Module_add_targets,unoxml,\
     Library_unordf \
 ))
+endif
 
 $(eval $(call gb_Module_add_slowcheck_targets,unoxml,\
     CppunitTest_unoxml_domtest \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 5de32bcae51c..915cf896582a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -726,8 +726,11 @@ $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc))
 
 # HACK: dependency on icon themes so running unit tests don't
 # prevent delivering these by having open file handles on WNT
+ifeq ($(gb_Side),host)
 $(eval $(call gb_Library_use_package,vcl,postprocess_images))
 endif
+endif # $(OS) == WNT
+
 
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 ifeq ($(USING_X11),TRUE)
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index 2e169ded83e7..057c6506c17a 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -104,6 +104,8 @@ $(eval $(call gb_Library_add_nativeres,vclplug_win,vcl/salsrc))
 
 # HACK: dependency on icon themes so running unit tests don't
 # prevent delivering these by having open file handles on WNT
+ifeq ($(gb_Side),host)
 $(eval $(call gb_Library_use_package,vclplug_win,postprocess_images))
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/xmloff/Module_xmloff.mk b/xmloff/Module_xmloff.mk
index 16cf0f817889..bc6f1e47b2e9 100644
--- a/xmloff/Module_xmloff.mk
+++ b/xmloff/Module_xmloff.mk
@@ -22,9 +22,14 @@ $(eval $(call gb_Module_Module,xmloff))
 $(eval $(call gb_Module_add_targets,xmloff,\
 	CustomTarget_generated \
     Library_xo \
+))
+
+ifeq ($(gb_Side),host)
+$(eval $(call gb_Module_add_targets,xmloff,\
     Library_xof \
     Package_dtd \
 ))
+endif
 
 $(eval $(call gb_Module_add_check_targets,xmloff,\
 	$(if $(MERGELIBS),, \
commit 29226c0b3271d6092029f084764c8de799ca49f9
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 17 23:03:59 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    WIN drop --enable-64bit to select Windows target
    
    This changes the Windows build to use the default configure switch
    to select the target / host of the compiled binaries to get the
    possibility to cross compile on Windows the "default" way.
    
    Note that selecting i686-pc-cygwin on x86_64 doesn't do a cross-
    compilation, as no special build tools are needed, because x86_64
    can run x86 binaries just fine.
    
    A consequence of the change is the default target host, which is
    now the same then the build system, instead of the previous x86
    default.
    
    Change-Id: I5584f34f665573ebac40d5d7753d96addeb84dbb

diff --git a/configure.ac b/configure.ac
index 5a934a064082..26451f60a87c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1440,11 +1440,6 @@ AC_ARG_ENABLE(ccache,
 ]),
 ,)
 
-AC_ARG_ENABLE(64-bit,
-    AS_HELP_STRING([--enable-64-bit],
-        [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
-         At the moment meaningful only for Windows.]), ,)
-
 libo_FUZZ_ARG_ENABLE(online-update,
     AS_HELP_STRING([--enable-online-update],
         [Enable the online update service that will check for new versions of
@@ -3315,19 +3310,65 @@ reg_get_value_64()
     reg_get_value "64" "$1"
 }
 
-if test "$_os" = "WINNT"; then
-    AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
-    if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
-        AC_MSG_RESULT([no])
-        WINDOWS_SDK_ARCH="x86"
+case "$host_os" in
+cygwin*)
+    COM=MSC
+    USING_X11=
+    OS=WNT
+    RTL_OS=Windows
+    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
+        P_SEP=";"
     else
-        AC_MSG_RESULT([yes])
-        WINDOWS_SDK_ARCH="x64"
-        BITNESS_OVERRIDE=64
+        P_SEP=:
     fi
+    case "$host_cpu" in
+    x86_64)
+        CPUNAME=X86_64
+        RTL_ARCH=X86_64
+        PLATFORMID=windows_x86_64
+        WINDOWS_X64=1
+        SCPDEFS="$SCPDEFS -DWINDOWS_X64"
+        WIN_HOST_ARCH="x64"
+        WIN_MULTI_ARCH="x86"
+        WIN_HOST_BITS=64
+        ;;
+    i*86)
+        CPUNAME=INTEL
+        RTL_ARCH=x86
+        PLATFORMID=windows_x86
+        WIN_HOST_ARCH="x86"
+        WIN_HOST_BITS=32
+        WIN_OTHER_ARCH="x64"
+        ;;
+    *)
+        AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
+        ;;
+    esac
+
+    case "$build_cpu" in
+    x86_64) WIN_BUILD_ARCH="x64" ;;
+    i*86) WIN_BUILD_ARCH="x86" ;;
+    *)
+        AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
+        ;;
+    esac
+
+    SCPDEFS="$SCPDEFS -D_MSC_VER"
+    ;;
+esac
+
+# multi-arch is an arch, which can execute on the host (x86 on x64), while
+# other-arch won't, but wouldn't break the build (x64 on x86).
+if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
+    AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
 fi
+
+
 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
-    cross_compiling="yes"
+    # 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"
+    fi
 fi
 if test "$cross_compiling" = "yes"; then
     export CROSS_COMPILING=TRUE
@@ -3479,6 +3520,47 @@ find_msvc()
     fi
 }
 
+test_cl_exe()
+{
+    AC_MSG_CHECKING([$1 compiler])
+
+    CL_PATH="$2"
+    CL_EXE_PATH="$2/cl.exe"
+
+    if test ! -f "$CL_EXE_PATH"; then
+        if test "$1" = "multi-arch"; then
+            AC_MSG_WARN([no compiler (cl.exe) in $2])
+            return 1
+        else
+            AC_MSG_ERROR([no compiler (cl.exe) in $2])
+        fi
+    fi
+
+    dnl ===========================================================
+    dnl  Check for the corresponding mspdb*.dll
+    dnl ===========================================================
+
+    # MSVC 15.0 has libraries from 14.0?
+    mspdbnum="140"
+
+    if test ! -e "$2/mspdb${mspdbnum}.dll"; then
+        AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
+    fi
+
+    # The compiles has to find its shared libraries
+    OLD_PATH="$PATH"
+    TEMP_PATH=`cygpath -d "$2"`
+    PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
+
+    if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
+        AC_MSG_ERROR([no compiler (cl.exe) in $2])
+    fi
+
+    PATH="$OLD_PATH"
+
+    AC_MSG_RESULT([$CL_EXE_PATH])
+}
+
 SOLARINC=
 MSBUILD_PATH=
 DEVENV=
@@ -3492,21 +3574,31 @@ if test "$_os" = "WINNT"; then
             AC_MSG_ERROR([no Visual Studio 2019 installation found])
         fi
     fi
+    AC_MSG_RESULT([])
 
-    if test "$BITNESS_OVERRIDE" = ""; then
-        if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
-            VC_PRODUCT_DIR=$vctest/VC
-        else
-            AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
+    VC_PRODUCT_DIR="$vctest/VC"
+    COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
+
+    # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
+    if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
+        MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
+        test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
+        if test $? -ne 0; then
+            WIN_MULTI_ARCH=""
+            WIN_OTHER_ARCH=""
         fi
     else
-        if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
-            VC_PRODUCT_DIR=$vctest/VC
-        else
-            AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
-        fi
+        MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
+        test_cl_exe "build" "$MSVC_BUILD_PATH"
+    fi
+
+    # host must be last, as it sets CL_PATH
+    if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
+        MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
+        test_cl_exe "host" "$MSVC_HOST_PATH"
+    else
+        MSVC_HOST_PATH="$MSVC_BUILD_PATH"
     fi
-    AC_MSG_RESULT([$VC_PRODUCT_DIR])
 
     AC_MSG_CHECKING([for short pathname of VC product directory])
     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
@@ -3540,13 +3632,13 @@ if test "$_os" = "WINNT"; then
         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
     else
         if test "$vcnumwithdot" = "16.0"; then
-            if test "$BITNESS_OVERRIDE" = ""; then
+            if test "$WIN_BUILD_ARCH" != "x64"; then
                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
             else
                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
             fi
         else
-            if test "$BITNESS_OVERRIDE" = ""; then
+            if test "$WIN_BUILD_ARCH" != "x64"; then
                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
             else
                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
@@ -3563,55 +3655,11 @@ if test "$_os" = "WINNT"; then
         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
     fi
 
-    dnl ===========================================================
-    dnl  Check for the corresponding mspdb*.dll
-    dnl ===========================================================
-
-    VC_HOST_DIR=
-    MSPDB_PATH=
-    CL_PATH=
-
-    if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
-        VC_HOST_DIR="HostX64"
-        MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
-    else
-        VC_HOST_DIR="HostX86"
-        MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
-    fi
-
-    if test "$BITNESS_OVERRIDE" = ""; then
-        CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
-    else
-        CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
-    fi
-
-    # MSVC 15.0 has libraries from 14.0?
-    mspdbnum="140"
-
-    if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
-        AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
-    fi
-
-    dnl The path needs to be added before cl is called
-    TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
-    PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
-
-    AC_MSG_CHECKING([cl.exe])
-
-    # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
-    # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
-    # location, isn't it likely that lots of other things needs changes, too, and just setting CC
-    # is not enough?
-
     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
     dnl needed when building CLR code:
     if test -z "$MSVC_CXX"; then
-        if test -f "$CL_PATH/cl.exe"; then
-            MSVC_CXX="$CL_PATH/cl.exe"
-        fi
-
         # This gives us a posix path with 8.3 filename restrictions
-        MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
+        MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
     fi
 
     if test -z "$CC"; then
@@ -3625,16 +3673,7 @@ if test "$_os" = "WINNT"; then
 
     if test -n "$CC"; then
         # Remove /cl.exe from CC case insensitive
-        AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
-        if test "$BITNESS_OVERRIDE" = ""; then
-           COMPATH="$VC_PRODUCT_DIR"
-        else
-            if test -n "$VC_PRODUCT_DIR"; then
-                COMPATH=$VC_PRODUCT_DIR
-            fi
-        fi
-
-        COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
+        AC_MSG_NOTICE([found Visual C++ $vcyear])
 
         export INCLUDE=`cygpath -d "$COMPATH\Include"`
 
@@ -3691,16 +3730,13 @@ if test "$_os" = "WINNT"; then
     BUILD_X64=
     CXX_X64_BINARY=
 
-    if test "$BITNESS_OVERRIDE" = ""; then
-        AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
-        if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
-             test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
-            if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
-                BUILD_X64=TRUE
-                CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
-            fi
-        fi
-        if test "$BUILD_X64" = TRUE; then
+    if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
+        AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
+        if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
+             -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
+        then
+            BUILD_X64=TRUE
+            CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
             AC_MSG_RESULT([found])
         else
             AC_MSG_RESULT([not found])
@@ -3717,26 +3753,17 @@ if test "$_os" = "WINNT"; then
     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
     # needed to support TWAIN scan on both 32- and 64-bit systems
 
-    BUILD_X86=
-
-    if test "$BITNESS_OVERRIDE" = "64"; then
+    if test "$WIN_HOST_ARCH" = "x64"; then
         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
-        if test -n "$CXX_X86_BINARY"; then
-            BUILD_X86=TRUE
-            AC_MSG_RESULT([preset])
-        elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
+        if test -n "$WIN_MULTI_ARCH"; then
             BUILD_X86=TRUE
-            CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
+            CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
             CXX_X86_BINARY+=" /arch:SSE"
             AC_MSG_RESULT([found])
         else
-            CXX_X86_BINARY=
             AC_MSG_RESULT([not found])
             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
         fi
-    else
-        BUILD_X86=TRUE
-        CXX_X86_BINARY=$MSVC_CXX
     fi
     AC_SUBST(BUILD_X86)
     AC_SUBST(CXX_X86_BINARY)
@@ -4309,34 +4336,7 @@ aix*)
     ;;
 
 cygwin*)
-    COM=MSC
-    USING_X11=
-    OS=WNT
-    RTL_OS=Windows
-    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
-        P_SEP=";"
-    else
-        P_SEP=:
-    fi
-    case "$host_cpu" in
-    i*86|x86_64)
-        if test "$BITNESS_OVERRIDE" = 64; then
-            CPUNAME=X86_64
-            RTL_ARCH=X86_64
-            PLATFORMID=windows_x86_64
-            WINDOWS_X64=1
-            SCPDEFS="$SCPDEFS -DWINDOWS_X64"
-        else
-            CPUNAME=INTEL
-            RTL_ARCH=x86
-            PLATFORMID=windows_x86
-        fi
-        ;;
-    *)
-        AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
-        ;;
-    esac
-    SCPDEFS="$SCPDEFS -D_MSC_VER"
+    # Already handled
     ;;
 
 darwin*|macos*)
@@ -5901,7 +5901,7 @@ if test "$_os" = "WINNT"; then
 
         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
             have_windows_sdk_libs=yes
-        elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
+        elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
             have_windows_sdk_libs=yes
         else
             have_windows_sdk_libs=no
@@ -5948,13 +5948,13 @@ the  Windows SDK are installed.])
     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
-            WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
+            WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
         fi
         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
-            WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
+            WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
         fi
         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
-            WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
+            WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
         fi
     fi
     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
@@ -5982,19 +5982,19 @@ if test "$build_os" = "cygwin"; then
 
     find_winsdk
     if test -n "$winsdkbinsubdir" \
-        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
+        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
     then
-        MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
+        MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
-    elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
-        MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
+    elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
+        MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
     elif test -f "$winsdktest/Bin/midl.exe"; then
         MIDL_PATH=$winsdktest/Bin
         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
     fi
     if test ! -f "$MIDL_PATH/midl.exe"; then
-        AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
+        AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
     else
         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
     fi
@@ -6036,11 +6036,11 @@ if test "$build_os" = "cygwin"; then
     AC_MSG_CHECKING([for al.exe])
     find_winsdk
     if test -n "$winsdkbinsubdir" \
-        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
+        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
     then
-        AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
-    elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
-        AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
+        AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
+    elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
+        AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
     elif test -f "$winsdktest/Bin/al.exe"; then
         AL_PATH="$winsdktest/Bin"
     fi
@@ -6066,15 +6066,15 @@ if test "$build_os" = "cygwin"; then
     find_dotnetsdk46
     PathFormat "$frametest"
     frametest="$formatted_path"
-    if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
+    if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
         DOTNET_FRAMEWORK_HOME="$frametest"
     else
         find_winsdk
-        if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
+        if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
             DOTNET_FRAMEWORK_HOME="$winsdktest"
         fi
     fi
-    if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
+    if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
         AC_MSG_ERROR([mscoree.lib not found])
     fi
     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
@@ -6268,7 +6268,7 @@ else
     SAL_TYPES_SIZEOFINT=4
     SAL_TYPES_SIZEOFLONG=4
     SAL_TYPES_SIZEOFLONGLONG=8
-    if test "$BITNESS_OVERRIDE" = ""; then
+    if test $WIN_HOST_BITS -eq 32; then
         SAL_TYPES_SIZEOFPOINTER=4
     else
         SAL_TYPES_SIZEOFPOINTER=8
@@ -7467,6 +7467,7 @@ AC_ARG_WITH(ucrt-dir,
         A zip archive including those files is available from Microsoft site:
         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
 ,)
+
 UCRT_REDISTDIR="$with_ucrt_dir"
 if test $_os = "WINNT"; then
     find_msvc_x64_dlls
@@ -7478,7 +7479,7 @@ if test $_os = "WINNT"; then
     done
     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
     MSVC_DLLS="$msvcdlls"
-    MSM_PATH=`win_short_path_for_make "$msmdir"`
+    test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
     # MSVC 15.3 changed it to VC141
     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
@@ -7525,19 +7526,13 @@ if test "$ENABLE_JAVA" != ""; then
 
     # Windows-specific tests
     if test "$build_os" = "cygwin"; then
-        if test "$BITNESS_OVERRIDE" = 64; then
-            bitness=64
-        else
-            bitness=32
-        fi
-
         if test -z "$with_jdk_home"; then
             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
-            reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
+            reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
             if test -n "$regvalue"; then
                 ver=$regvalue
-                reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
+                reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
                 reg_jdk_home=$regvalue
             fi
 
@@ -7545,7 +7540,7 @@ if test "$ENABLE_JAVA" != ""; then
                 with_jdk_home="$reg_jdk_home"
                 howfound="found automatically"
             else
-                AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
+                AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $WIN_HOST_BITS-bit JDK >= 9])
             fi
         else
             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
@@ -7575,12 +7570,12 @@ if test "$ENABLE_JAVA" != ""; then
     dnl Check that the JDK found is correct architecture (at least 2 reasons to
     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
     dnl loaded by java to run JunitTests:
-    if test "$build_os" = "cygwin"; then
+    if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
         shortjdkhome=`cygpath -d "$with_jdk_home"`
-        if test "$BITNESS_OVERRIDE" = 64 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
+        if test $WIN_HOST_BITS -eq 64 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
-        elif test "$BITNESS_OVERRIDE" = "" -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
+        elif test $WIN_HOST_BITS -eq 32 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
         fi
@@ -7636,7 +7631,7 @@ if test "$ENABLE_JAVA" != ""; then
             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
 
             if test "$_jdk_ver" -lt 10900; then
-                AC_MSG_ERROR([JDK is too old, you need at least 9])
+                AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
             fi
             if test "$_jdk_ver" -gt 10900; then
                 JAVA_CLASSPATH_NOT_SET=TRUE
@@ -10693,18 +10688,17 @@ dnl testing assembler path
 dnl ***************************************
 ML_EXE=""
 if test "$_os" = "WINNT"; then
-    if test "$BITNESS_OVERRIDE" = ""; then
-        assembler=ml.exe
-    else
-        assembler=ml64.exe
-    fi
+    case "$WIN_HOST_ARCH" in
+    x86) assembler=ml.exe ;;
+    x64) assembler=ml64.exe ;;
+    esac
 
     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
-    if test -f "$CL_PATH/$assembler"; then
-        ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
+    if test -f "$MSVC_HOST_PATH/$assembler"; then
+        ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
         AC_MSG_RESULT([$ML_EXE])
     else
-        AC_MSG_ERROR([not found])
+        AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
     fi
 fi
 
@@ -11238,11 +11232,7 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
                 dnl explicitly set -m32/-m64
-                if test "$BITNESS_OVERRIDE" = ""; then
-                    CLANG_CC="$CLANG_CC -m32"
-                else
-                    CLANG_CC="$CLANG_CC -m64"
-                fi
+                CLANG_CC="$CLANG_CC -m$WIN_HOST_BITS"
                 CLANG_CXX="$CLANG_CC"
                 AC_MSG_RESULT([$CLANG_CC])
             else
@@ -11528,8 +11518,6 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
         if test "$_os" != "WINNT"; then
             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
-        elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
-            AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
         fi
     fi
     ENABLE_GPGMEPP=TRUE
@@ -13187,37 +13175,22 @@ if test "$build_os" = "cygwin"; then
         ILIB="$ILIB;$JAVA_HOME/lib"
     fi
     ILIB1=-link
-    if test "$BITNESS_OVERRIDE" = 64; then
-        ILIB="$ILIB;$COMPATH/lib/x64"
-        ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
-        ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
-        ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
-        if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
-            ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
-            ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
-        fi
-        PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
-        ucrtlibpath_formatted=$formatted_path
-        ILIB="$ILIB;$ucrtlibpath_formatted"
-        ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
-    else
-        ILIB="$ILIB;$COMPATH/lib/x86"
-        ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
-        ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
-        ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
-        if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
-            ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
-            ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
-        fi
-        PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
-        ucrtlibpath_formatted=$formatted_path
-        ILIB="$ILIB;$ucrtlibpath_formatted"
-        ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
-    fi
+    ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
+    ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
+    ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
+    ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
+    if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
+        ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
+        ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
+    fi
+    PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
+    ucrtlibpath_formatted=$formatted_path
+    ILIB="$ILIB;$ucrtlibpath_formatted"
+    ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
     else
-        ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
+        ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
     fi
 
     AC_SUBST(ILIB)
@@ -13351,7 +13324,7 @@ dnl ===================================================================
 dnl Checking for active Antivirus software.
 dnl ===================================================================
 
-if test $_os = WINNT ; then
+if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
     AC_MSG_CHECKING([for active Antivirus software])
     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
@@ -13397,11 +13370,7 @@ if test "$build_os" = "cygwin"; then
         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
     fi
-    if test "$BITNESS_OVERRIDE" = 64; then
-        ATL_LIB="$ATL_LIB/x64"
-    else
-        ATL_LIB="$ATL_LIB/x86"
-    fi
+    ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
 
@@ -13466,9 +13435,9 @@ else
         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
             LO_PATH=`cygpath -p -m "$PATH"`
         fi
-        if test "$BITNESS_OVERRIDE" = 64; then
+        if test -n "$WIN_MULTI_ARCH"; then
             # needed for msi packaging
-            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
+            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_MULTI_ARCH" "before"
         fi
         # .NET 4.6 and higher don't have bin directory
         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
@@ -13478,20 +13447,12 @@ else
         pathmunge "$CSC_PATH" "before"
         pathmunge "$MIDL_PATH" "before"
         pathmunge "$AL_PATH" "before"
-        pathmunge "$MSPDB_PATH" "before"
-        if test "$MSPDB_PATH" != "$CL_PATH" ; then
-            pathmunge "$CL_PATH" "before"
-        fi
+        pathmunge "$CL_PATH" "before"
         if test -n "$MSBUILD_PATH" ; then
             pathmunge "$MSBUILD_PATH" "before"
         fi
-        if test "$BITNESS_OVERRIDE" = 64; then
-            pathmunge "$COMPATH/bin/amd64" "before"
-            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
-        else
-            pathmunge "$COMPATH/bin" "before"
-            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
-        fi
+        pathmunge "$MSVC_HOST_PATH" "before"
+        pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
         if test "$ENABLE_JAVA" != ""; then
             if test -d "$JAVA_HOME/jre/bin/client"; then
                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
diff --git a/distro-configs/Jenkins/windows_msc_dbgutil_32 b/distro-configs/Jenkins/windows_msc_dbgutil_32
index 59e083ee952a..6d0e6df2facb 100644
--- a/distro-configs/Jenkins/windows_msc_dbgutil_32
+++ b/distro-configs/Jenkins/windows_msc_dbgutil_32
@@ -1,4 +1,4 @@
+--host=i686-pc-cygwin
 --enable-dbgutil
 --disable-symbols
---disable-64-bit
 --disable-dependency-tracking
diff --git a/distro-configs/LibreOfficeWin64.conf b/distro-configs/LibreOfficeWin64.conf
index 8e1a73ffb653..7c3c1ae4e5ac 100644
--- a/distro-configs/LibreOfficeWin64.conf
+++ b/distro-configs/LibreOfficeWin64.conf
@@ -1,4 +1,4 @@
---enable-64-bit
+--host=x86_64-pc-cygwin
 --without-junit
 --without-helppack-integration
 --enable-extension-integration
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 7409cffa1f40..05de2691a03e 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -345,29 +345,20 @@ endif
 # Helper class
 
 ifeq ($(GNUMAKE_WIN_NATIVE),TRUE)
-gb_Helper_set_ld_path := PATH="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$$PATH"
-
-define gb_Helper_prepend_ld_path
-PATH="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$(1);$$PATH"
-endef
-
-# $(1): one directory pathname to append to the ld path
-define gb_Helper_extend_ld_path
-$(gb_Helper_set_ld_path)';$(shell cygpath -w $(1))'
-endef
-
+gb_MAKE_CYGPATH := -w
 else
-gb_Helper_set_ld_path := PATH="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$$PATH"
+gb_MAKE_CYGPATH := -u
+endif
+
+gb_Helper_set_ld_path := PATH="$(shell cygpath $(gb_MAKE_CYGPATH) $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath $(gb_MAKE_CYGPATH) $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER));$$PATH"
 
 define gb_Helper_prepend_ld_path
-PATH="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$(1):$$PATH"
+PATH="$(shell cygpath $(gb_MAKE_CYGPATH) $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath $(gb_MAKE_CYGPATH) $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER));$(1);$$PATH"
 endef
 
 # $(1): one directory pathname to append to the ld path
 define gb_Helper_extend_ld_path
-$(gb_Helper_set_ld_path):$(shell cygpath -u $(1))
+$(gb_Helper_set_ld_path)';$(shell cygpath $(gb_MAKE_CYGPATH) $(1))'
 endef
 
-endif
-
 # vim: set noet sw=4:
commit 7c98eda4b938b2942255e080f82de26c64b040eb
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Jul 30 03:06:57 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jul 31 17:35:07 2020 +0200

    cross-compile: fix PATH handling for host
    
    Reading and exporting the PATH variable will result in a bunch of
    error, so we have to work with full patch when using the grep and
    sed commands. Since we just want the PATH for the rest of the host
    config run, we can simply restore it.
    
    Change-Id: I970f3bddece01c1f20ab9db7d55569e5df190675

diff --git a/bin/get_config_variables b/bin/get_config_variables
index 60a2bdc04788..aa8198a44f4f 100644
--- a/bin/get_config_variables
+++ b/bin/get_config_variables
@@ -11,13 +11,19 @@ elif [ "$glv_var" = "--host" ] ; then
     shift
 fi
 
+# full path, in case we export a "wrong" PATH
+test -n "$GREP" && glv_grep="$GREP" || glv_grep=$(command -v grep)
+test -n "$SED" && glv_sed="$SED" || glv_sed=$(command -v sed)
+
 while [ -n "$1" ] ; do
     glv_var="$1"
     shift
-    glv_value=$(grep "^ *export ${glv_var}=" ${glv_config} | sed -e "s/[^=]*=//")
+    glv_value=$("${glv_grep}" "^ *export ${glv_var}=" ${glv_config} | "${glv_sed}" -e 's/[^=]*=//')
     export ${glv_var}="${glv_value}"
 done
 
 unset glv_var
 unset glv_value
 unset glv_config
+unset glv_sed
+unset glv_grep
diff --git a/configure.ac b/configure.ac
index 59ec7ec58bf1..5a934a064082 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4904,7 +4904,14 @@ if test "$cross_compiling" = "yes"; then
     mv config.log ../config.Build.log
     mkdir -p ../config_build
     mv config_host/*.h ../config_build
+
+    OLD_PATH=$PATH
     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
+    BUILD_PATH=$PATH
+    PATH=$OLD_PATH
+
+    line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
+    echo "$line" >>build-config
 
     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
         VV='$'$V
@@ -4925,9 +4932,6 @@ if test "$cross_compiling" = "yes"; then
         fi
     done
 
-    line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
-    echo "$line" >>build-config
-
     )
     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
     test -f config_build.mk || AC_MSG_ERROR([A file called config_build.mk was supposed to have been copied here, but it isn't found])
commit b81e86dac77a8d6b29e4fb82c42e1a0b592af5be
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jul 31 11:07:19 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jul 31 17:06:38 2020 +0200

    ofz#24521 fix qpwfuzzer
    
    Change-Id: Ia9490a07f4567df62cb5a08cb1859390d2a1ca1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99873
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/workben/qpwfuzzer.cxx b/vcl/workben/qpwfuzzer.cxx
index 6cfecf4f20cd..0246f840df8b 100644
--- a/vcl/workben/qpwfuzzer.cxx
+++ b/vcl/workben/qpwfuzzer.cxx
@@ -27,6 +27,7 @@ void * com_sun_star_i18n_NativeNumberSupplier_get_implementation( void *, void *
 void * com_sun_star_i18n_NumberFormatCodeMapper_get_implementation( void *, void * );
 void * com_sun_star_i18n_Transliteration_get_implementation( void *, void * );
 void * emfio_emfreader_XEmfParser_get_implementation( void *, void * );
+void * i18npool_CalendarImpl_get_implementation( void *, void * );
 }
 
 const lib_to_factory_mapping *
@@ -55,6 +56,7 @@ lo_get_constructor_map(void)
         { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation },
         { "com_sun_star_i18n_Transliteration_get_implementation", com_sun_star_i18n_Transliteration_get_implementation },
         { "emfio_emfreader_XEmfParser_get_implementation", emfio_emfreader_XEmfParser_get_implementation},
+        { "i18npool_CalendarImpl_get_implementation", i18npool_CalendarImpl_get_implementation},
         { 0, 0 }
     };
 
commit ecd2c8f36090e62a2ab6181681792d9b367505e9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jul 31 15:33:31 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jul 31 17:06:13 2020 +0200

    ofz#24527 fix pptfuzzer
    
    Change-Id: I661bfc42b0e05d9dddd35b21c4074727562e5a0a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99877
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/workben/pptfuzzer.cxx b/vcl/workben/pptfuzzer.cxx
index bafb284dd56f..97d988cc0445 100644
--- a/vcl/workben/pptfuzzer.cxx
+++ b/vcl/workben/pptfuzzer.cxx
@@ -44,6 +44,8 @@ void * com_sun_star_animations_TransitionFilter_get_implementation( void *, void
 void * com_sun_star_comp_comphelper_OPropertyBag( void *, void * );
 void * com_sun_star_comp_uui_UUIInteractionHandler_get_implementation( void *, void * );
 void * emfio_emfreader_XEmfParser_get_implementation( void *, void * );
+void * i18npool_CalendarImpl_get_implementation( void *, void * );
+void * i18npool_Calendar_gregorian_get_implementation( void *, void * );
 void * unoxml_rdfRepository_get_implementation( void *, void * );
 void * unoxml_CURI_get_implementation( void *, void * );
 void * unoxml_CLiteral_get_implementation( void *, void * );
@@ -108,6 +110,8 @@ lo_get_constructor_map(void)
         { "com_sun_star_comp_comphelper_OPropertyBag", com_sun_star_comp_comphelper_OPropertyBag },
         { "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", com_sun_star_comp_uui_UUIInteractionHandler_get_implementation },
         { "emfio_emfreader_XEmfParser_get_implementation", emfio_emfreader_XEmfParser_get_implementation},
+        { "i18npool_CalendarImpl_get_implementation", i18npool_CalendarImpl_get_implementation},
+        { "i18npool_Calendar_gregorian_get_implementation", i18npool_Calendar_gregorian_get_implementation},
         { "unoxml_rdfRepository_get_implementation", unoxml_rdfRepository_get_implementation },
         { "unoxml_CURI_get_implementation", unoxml_CURI_get_implementation },
         { "unoxml_CLiteral_get_implementation", unoxml_CLiteral_get_implementation },
commit 491fa499d6b957b9c8f03fece5ed06d5932e9448
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Jul 31 15:04:57 2020 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Jul 31 16:45:06 2020 +0200

    tdf#135212 Don't crash when unable to create clipboard
    
    Gracefully handle the case where the SalInstance returns an
    empty Reference when trying to create clipboard.
    
    Primary selection support on Wayland has only recently been
    added to the relevant KDE components ([1], [2]), and an empty
    Reference would be returned for the qt5/kf5 VCL plugin when
    trying to create create a clipboard for primary selection
    in a Plasma Wayland session with that functionality not yet being
    available.
    
    Regression from commit 05d286e0065ff1c10e75827ac4726b5a74747128
    ("vcl/clipboard: create instances with uno constructors", 2020-07-07).
    
    [1] https://invent.kde.org/plasma/kwayland-server/-/merge_requests/15
    [2] https://invent.kde.org/plasma/kwin/-/merge_requests/27
    
    Change-Id: Ia9016f56b775003b2ffe81a6f3bf44f411ad39a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99871
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index 7e5f36f67f7d..bd89a1404e01 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -193,7 +193,8 @@ vcl_SystemClipboard_get_implementation(
 {
     SolarMutexGuard aGuard;
     auto xClipboard = ImplGetSVData()->mpDefInst->CreateClipboard( args );
-    xClipboard->acquire();
+    if (xClipboard.is())
+        xClipboard->acquire();
     return xClipboard.get();
 }
 
commit aed92491f356b008fe1cd25b5cd6cc43279db3a3
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 31 14:46:13 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Jul 31 16:31:00 2020 +0200

    tdf#134965 sw: avoid RemoveFollowFlowLine() SNAFU
    
    A follow-flow-line SwRowFrame is deleted in RemoveFollowFlowLine()
    while it is being iterated in stack frame #18.
    
    0  SwRowFrame::~SwRowFrame() (this=0xaa035b0, __in_chrg=<optimized out>) at sw/source/core/layout/tabfrm.cxx:3807
    1  SwFrame::DestroyFrame(SwFrame*) (pFrame=0xaa035b0) at sw/source/core/layout/ssfrm.cxx:389
    2  SwTabFrame::RemoveFollowFlowLine() (this=0x9c16790) at sw/source/core/layout/tabfrm.cxx:945
    3  SwTabFrame::MakeAll(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2203
    4  SwFrame::PrepareMake(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
    5  SwFrame::Calc(OutputDevice*) const (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
    6  SwFrame::PrepareMake(OutputDevice*) (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
    7  SwFrame::Calc(OutputDevice*) const (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
    8  SwFrame::PrepareMake(OutputDevice*) (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
    9  SwFrame::Calc(OutputDevice*) const (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
    10 SwFrame::PrepareMake(OutputDevice*) (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list