From 4031659233958a5bf93ea86e8fe117fd0dd45c10 Mon Sep 17 00:00:00 2001 From: RMZeroFour Date: Wed, 12 Jun 2024 21:25:42 +0530 Subject: [PATCH] .NET Bindings: Switch for old windows CLI bindings This commit adds an --enable-cli/--disable-cli switch to autoconf to control generation of the old CLI bindings (Windows only). It is enabled by default, to not be a breaking change to users just yet. Over time, when the old bindings are deprecated in favor of the new .NET bindings, it could be set to disabled by default. Change-Id: Ib60b372459cb0c735275ed17d004d037279357eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168751 Tested-by: Jenkins Reviewed-by: Hossein --- Repository.mk | 16 ++-- cli_ure/Module_cli_ure.mk | 2 + config_host.mk.in | 1 + configure.ac | 158 ++++++++++++++++++---------------- odk/CustomTarget_check.mk | 4 +- odk/Module_odk.mk | 2 +- testtools/Module_testtools.mk | 2 + unoil/Module_unoil.mk | 2 + 8 files changed, 107 insertions(+), 80 deletions(-) diff --git a/Repository.mk b/Repository.mk index 18ebd4372f31..c4e8b8d3299e 100644 --- a/Repository.mk +++ b/Repository.mk @@ -89,7 +89,9 @@ $(eval $(call gb_Helper_register_executables,NONE, \ )) $(eval $(call gb_Helper_register_executables_for_install,SDK,sdk, \ - $(if $(filter MSC,$(COM)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),climaker)) \ + $(if $(ENABLE_CLI),\ + $(if $(filter MSC,$(COM)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),climaker)) \ + ) \ cppumaker \ javamaker \ netmaker \ @@ -591,14 +593,16 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \ swqahelper \ wpftqahelper \ precompiled_system \ - $(if $(filter MSC,$(COM)),cli_cppuhelper) \ + $(if $(ENABLE_CLI),$(if $(filter MSC,$(COM)),cli_cppuhelper)) \ $(if $(filter $(OS),ANDROID),lo-bootstrap) \ $(if $(filter $(OS),MACOSX),OOoSpotlightImporter) \ )) $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \ affine_uno_uno \ - $(if $(filter MSC,$(COM)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),cli_uno)) \ + $(if $(ENABLE_CLI),\ + $(if $(filter MSC,$(COM)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),cli_uno)) \ + ) \ i18nlangtag \ $(if $(ENABLE_JAVA), \ java_uno \ @@ -862,7 +866,7 @@ endif # Other packages could be potentially autoinstalled. $(eval $(call gb_Helper_register_packages, \ test_unittest \ - cli_basetypes_copy \ + $(if $(ENABLE_CLI),cli_basetypes_copy) \ extras_wordbook \ instsetoo_native_setup \ $(if $(ENABLE_OOENV),instsetoo_native_ooenv) \ @@ -905,7 +909,9 @@ $(eval $(call gb_Helper_register_packages_for_install,postgresqlsdbc,\ $(eval $(call gb_Helper_register_packages_for_install,sdk,\ odk_share_readme \ odk_share_readme_generated \ - $(if $(filter WNT,$(OS)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),odk_cli)) \ + $(if $(ENABLE_CLI),\ + $(if $(filter WNT,$(OS)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),odk_cli)) \ + ) \ odk_config \ $(if $(filter WNT,$(OS)),odk_config_win) \ odk_docs \ diff --git a/cli_ure/Module_cli_ure.mk b/cli_ure/Module_cli_ure.mk index ba18aecd1e4b..b1cdc680d9db 100644 --- a/cli_ure/Module_cli_ure.mk +++ b/cli_ure/Module_cli_ure.mk @@ -9,6 +9,7 @@ $(eval $(call gb_Module_Module,cli_ure)) +ifeq ($(ENABLE_CLI),TRUE) ifeq ($(COM),MSC) ifneq ($(CPUNAME)_$(CROSS_COMPILING),AARCH64_TRUE) $(eval $(call gb_Module_add_targets,cli_ure,\ @@ -24,5 +25,6 @@ $(eval $(call gb_Module_add_targets,cli_ure,\ )) endif endif +endif # vim: set noet sw=4 ts=4: diff --git a/config_host.mk.in b/config_host.mk.in index b9a7cbfb4cae..f5666b16aa13 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -154,6 +154,7 @@ export DEFAULT_CRASHDUMP_VALUE=@DEFAULT_CRASHDUMP_VALUE@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@ export ENABLE_CAIRO_RGBA=@ENABLE_CAIRO_RGBA@ export ENABLE_CIPHER_OPENSSL_BACKEND=@ENABLE_CIPHER_OPENSSL_BACKEND@ +export ENABLE_CLI=@ENABLE_CLI@ export ENABLE_CLUCENE=@ENABLE_CLUCENE@ export ENABLE_LIBCMIS=@ENABLE_LIBCMIS@ export ENABLE_COINMP=@ENABLE_COINMP@ diff --git a/configure.ac b/configure.ac index 43036fd9dfc7..50f26eba6611 100644 --- a/configure.ac +++ b/configure.ac @@ -2165,6 +2165,11 @@ AC_ARG_ENABLE(customtarget-components, AS_HELP_STRING([--enable-customtarget-components], [Generates the static UNO object constructor mapping from the build.])) +AC_ARG_ENABLE(cli, + AS_HELP_STRING([--disable-cli], + [Disable the generation of old CLI bindings.]), +,enable_cli=yes) + AC_ARG_ENABLE(dotnet, AS_HELP_STRING([--enable-dotnet], [Enables or disables .NET 8.0 support and bindings generation.])) @@ -7127,83 +7132,92 @@ if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.]) fi - dnl Check csc.exe - AC_MSG_CHECKING([for csc.exe]) - find_csc - PathFormat "$csctest" - csctest_unix="$formatted_path_unix" - if test -f "$csctest_unix/csc.exe"; then - CSC_PATH="$csctest" - fi - if test ! -f "$csctest_unix/csc.exe"; then - AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe]) - else - AC_MSG_RESULT([$CSC_PATH/csc.exe]) - fi - - CSC_PATH=`win_short_path_for_make "$CSC_PATH"` - - dnl Check al.exe - AC_MSG_CHECKING([for al.exe]) - if test -n "$winsdkbinsubdir" \ - -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe" - then - AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH" - elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then - AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH" - elif test -f "$winsdktest_unix/Bin/al.exe"; then - AL_PATH="$winsdktest/Bin" - fi - - if test -z "$AL_PATH"; then - find_al - PathFormat "$altest" - altest_unix="$formatted_path_unix" - if test -f "$altest_unix/bin/al.exe"; then - AL_PATH="$altest/bin" - elif test -f "$altest_unix/al.exe"; then - AL_PATH="$altest" - fi - fi - PathFormat "$AL_PATH" - if test ! -f "$formatted_path_unix/al.exe"; then - AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe]) - else - AC_MSG_RESULT([$AL_PATH/al.exe]) - fi - - AL_PATH=`win_short_path_for_make "$AL_PATH"` - - dnl Check mscoree.lib / .NET Framework dir - AC_MSG_CHECKING(.NET Framework) - find_dotnetsdk - PathFormat "$frametest" - frametest="$formatted_path_unix" - if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then - DOTNET_FRAMEWORK_HOME="$frametest" - else - if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then - DOTNET_FRAMEWORK_HOME="$winsdktest" - fi - fi - PathFormat "$DOTNET_FRAMEWORK_HOME" - if test ! -f "$formatted_path_unix/lib/mscoree.lib" -a ! -f "$formatted_path_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$formatted_path_unix/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then - AC_MSG_ERROR([mscoree.lib not found]) - fi - AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME]) - PathFormat "$MIDL_PATH" MIDL_PATH="$formatted_path" - PathFormat "$AL_PATH" - AL_PATH="$formatted_path" + if test "$enable_cli" = yes; then + dnl Check csc.exe + AC_MSG_CHECKING([for csc.exe]) + find_csc + PathFormat "$csctest" + csctest_unix="$formatted_path_unix" + if test -f "$csctest_unix/csc.exe"; then + CSC_PATH="$csctest" + fi + if test ! -f "$csctest_unix/csc.exe"; then + AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe]) + else + AC_MSG_RESULT([$CSC_PATH/csc.exe]) + fi + + CSC_PATH=`win_short_path_for_make "$CSC_PATH"` + + dnl Check al.exe + AC_MSG_CHECKING([for al.exe]) + if test -n "$winsdkbinsubdir" \ + -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe" + then + AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH" + elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then + AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH" + elif test -f "$winsdktest_unix/Bin/al.exe"; then + AL_PATH="$winsdktest/Bin" + fi + + if test -z "$AL_PATH"; then + find_al + PathFormat "$altest" + altest_unix="$formatted_path_unix" + if test -f "$altest_unix/bin/al.exe"; then + AL_PATH="$altest/bin" + elif test -f "$altest_unix/al.exe"; then + AL_PATH="$altest" + fi + fi + PathFormat "$AL_PATH" + if test ! -f "$formatted_path_unix/al.exe"; then + AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe]) + else + AC_MSG_RESULT([$AL_PATH/al.exe]) + fi + + AL_PATH=`win_short_path_for_make "$AL_PATH"` + + dnl Check mscoree.lib / .NET Framework dir + AC_MSG_CHECKING(.NET Framework) + find_dotnetsdk + PathFormat "$frametest" + frametest="$formatted_path_unix" + if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then + DOTNET_FRAMEWORK_HOME="$frametest" + else + if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then + DOTNET_FRAMEWORK_HOME="$winsdktest" + fi + fi + PathFormat "$DOTNET_FRAMEWORK_HOME" + if test ! -f "$formatted_path_unix/lib/mscoree.lib" -a ! -f "$formatted_path_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$formatted_path_unix/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then + AC_MSG_ERROR([mscoree.lib not found]) + fi + AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME]) + + PathFormat "$AL_PATH" + AL_PATH="$formatted_path" + + PathFormat "$DOTNET_FRAMEWORK_HOME" + DOTNET_FRAMEWORK_HOME="$formatted_path" + + PathFormat "$CSC_PATH" + CSC_PATH="$formatted_path" - PathFormat "$DOTNET_FRAMEWORK_HOME" - DOTNET_FRAMEWORK_HOME="$formatted_path" - - PathFormat "$CSC_PATH" - CSC_PATH="$formatted_path" + ENABLE_CLI="TRUE" + else + ENABLE_CLI="" + fi +else + ENABLE_CLI="" fi +AC_SUBST(ENABLE_CLI) dnl =================================================================== dnl Testing for C++ compiler and version... diff --git a/odk/CustomTarget_check.mk b/odk/CustomTarget_check.mk index 7354219968c4..0966fa577462 100644 --- a/odk/CustomTarget_check.mk +++ b/odk/CustomTarget_check.mk @@ -27,8 +27,8 @@ odk_PLATFORM := $(if $(filter WNT,$(OS)),windows,\ $(gb_CustomTarget_workdir)/odk/check/checkbin : \ $(SRCDIR)/odk/util/check.pl \ $(if $(DOXYGEN),$(call gb_GeneratedPackage_get_target,odk_doxygen)) \ - $(foreach exe,$(if $(filter WNT,$(OS)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),climaker)) cppumaker \ - javamaker uno-skeletonmaker unoapploader unoidl-read unoidl-write,\ + $(foreach exe,$(if $(ENABLE_CLI),$(if $(filter WNT,$(OS)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),climaker))) \ + cppumaker javamaker uno-skeletonmaker unoapploader unoidl-read unoidl-write,\ $(call gb_Executable_get_target,$(exe))) \ $(if $(filter WNT,$(OS)),$(call gb_Package_get_target,odk_cli)) \ $(call gb_Package_get_target,odk_config) \ diff --git a/odk/Module_odk.mk b/odk/Module_odk.mk index 9cf68f5d025b..d30c7164776a 100644 --- a/odk/Module_odk.mk +++ b/odk/Module_odk.mk @@ -34,7 +34,7 @@ $(eval $(call gb_Module_add_targets,odk,\ ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,odk,\ - $(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),Package_cli) \ + $(if $(ENABLE_CLI),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),Package_cli)) \ CustomTarget_config_win \ Package_config_win \ )) diff --git a/testtools/Module_testtools.mk b/testtools/Module_testtools.mk index a1b84e175b30..2ef90a01c0ec 100644 --- a/testtools/Module_testtools.mk +++ b/testtools/Module_testtools.mk @@ -29,11 +29,13 @@ $(eval $(call gb_Module_add_targets,testtools,\ )) endif +ifeq ($(ENABLE_CLI),TRUE) ifeq ($(COM),MSC) $(eval $(call gb_Module_add_targets,testtools,\ CustomTarget_bridgetest_climaker \ )) endif +endif $(eval $(call gb_Module_add_check_targets,testtools,\ CustomTarget_uno_test \ diff --git a/unoil/Module_unoil.mk b/unoil/Module_unoil.mk index 23b15181437a..12d8122d981f 100644 --- a/unoil/Module_unoil.mk +++ b/unoil/Module_unoil.mk @@ -16,6 +16,7 @@ $(eval $(call gb_Module_add_targets,unoil,\ )) endif +ifeq ($(ENABLE_CLI),TRUE) ifeq ($(COM),MSC) ifneq ($(CPUNAME)_$(CROSS_COMPILING),AARCH64_TRUE) $(eval $(call gb_Module_add_targets,unoil,\ @@ -23,5 +24,6 @@ $(eval $(call gb_Module_add_targets,unoil,\ )) endif endif +endif # vim:set noet sw=4 ts=4: