.NET Bindings: Upgrade --enable-dotnet to --with-dotnet
This commit changes the existing --enable-dotnet switch into --with-dotnet, allowing users to pass in a different dotnet executable than the one on their PATH, similar to --with-java. This is used to determine the variables DOTNET and DOTNET_ROOT. Change-Id: Ia4f02dfdbd33d7629a800a076f758b26bb186d9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169656 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
parent
67afda8955
commit
5f4083ffa9
3 changed files with 72 additions and 21 deletions
|
@ -137,6 +137,8 @@ export DISABLE_CVE_TESTS=@DISABLE_CVE_TESTS@
|
|||
export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@
|
||||
export DISABLE_PYTHON=@DISABLE_PYTHON@
|
||||
export DOCDIR=@DOCDIR@
|
||||
DOTNET=@DOTNET@
|
||||
DOTNET_ROOT=@DOTNET_ROOT@
|
||||
export DOXYGEN=@DOXYGEN@
|
||||
export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
|
||||
export DRAGONBOX_CFLAGS=@DRAGONBOX_CFLAGS@
|
||||
|
@ -170,7 +172,7 @@ export ENABLE_DBGUTIL=@ENABLE_DBGUTIL@
|
|||
export ENABLE_DBUS=@ENABLE_DBUS@
|
||||
export ENABLE_DCONF=@ENABLE_DCONF@
|
||||
export ENABLE_DEBUG=@ENABLE_DEBUG@
|
||||
export ENABLE_DOTNET=@ENABLE_DOTNET@
|
||||
ENABLE_DOTNET=@ENABLE_DOTNET@
|
||||
SYSTEM_DRAGONBOX=@SYSTEM_DRAGONBOX@
|
||||
SYSTEM_FROZEN=@SYSTEM_FROZEN@
|
||||
export ENABLE_EPOXY=@ENABLE_EPOXY@
|
||||
|
|
87
configure.ac
87
configure.ac
|
@ -2177,10 +2177,6 @@ AC_ARG_ENABLE(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.]))
|
||||
|
||||
dnl ===================================================================
|
||||
dnl Optional Packages (--with/without-)
|
||||
dnl ===================================================================
|
||||
|
@ -2840,6 +2836,12 @@ AC_ARG_WITH(keep-awake,
|
|||
If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
|
||||
and caffeinate on macOS]))
|
||||
|
||||
AC_ARG_WITH(dotnet,
|
||||
AS_HELP_STRING([--with-dotnet=<absolute path to dotnet executable>],
|
||||
[Specify the dotnet executable used to build .NET bindings and components.
|
||||
Requires .NET SDK 8 or higher. To disable building .NET components, use
|
||||
--without-dotnet or --with-dotnet=no.]))
|
||||
|
||||
dnl ===================================================================
|
||||
dnl Branding
|
||||
dnl ===================================================================
|
||||
|
@ -3587,15 +3589,16 @@ COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
|
|||
dnl ===================================================================
|
||||
dnl .NET support
|
||||
dnl ===================================================================
|
||||
|
||||
AC_MSG_CHECKING([whether to build with .NET support])
|
||||
if test "$enable_dotnet" != "no"; then
|
||||
if test "$with_dotnet" != no; then
|
||||
if test "$DISABLE_SCRIPTING" = TRUE; then
|
||||
AC_MSG_RESULT([no, overridden by --disable-scripting])
|
||||
with_dotnet=no
|
||||
ENABLE_DOTNET=""
|
||||
enable_dotnet=no
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
ENABLE_DOTNET="TRUE"
|
||||
ENABLE_DOTNET=TRUE
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
|
@ -3603,26 +3606,72 @@ else
|
|||
fi
|
||||
|
||||
if test "$ENABLE_DOTNET" = TRUE; then
|
||||
AC_PATH_PROG(DOTNET, dotnet)
|
||||
if test "$DOTNET" != ""; then
|
||||
AC_MSG_CHECKING([whether .NET SDK is installed])
|
||||
DOTNET_SDK_VERSION=`dotnet --list-sdks`
|
||||
if test "$DOTNET_SDK_VERSION" != ""; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_FEATURE_DOTNET)
|
||||
if test -n "$with_dotnet" && test "$with_dotnet" != yes; then
|
||||
dnl the user explicitly asks for a particular dotnet executable here
|
||||
|
||||
AC_MSG_CHECKING([for dotnet])
|
||||
PathFormat "$with_dotnet"
|
||||
DOTNET="$formatted_path_unix"
|
||||
|
||||
if test -f "$DOTNET"; then
|
||||
dnl the user provided dotnet is valid
|
||||
AC_MSG_RESULT([$formatted_path])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
dnl since the user wants to use a particular dotnet executable,
|
||||
dnl error out and let them correct the path instead of silently disabling.
|
||||
|
||||
AC_MSG_ERROR([$DOTNET is not a valid dotnet executable])
|
||||
ENABLE_DOTNET=""
|
||||
fi
|
||||
else
|
||||
ENABLE_DOTNET=""
|
||||
dnl no specific path to dotnet provided, try looking in $PATH
|
||||
|
||||
AC_PATH_PROGS(DOTNET, [dotnet dotnet.exe])
|
||||
PathFormat "$DOTNET"
|
||||
DOTNET="$formatted_path_unix"
|
||||
|
||||
if test -z "$DOTNET"; then
|
||||
dnl since the user does not specify any particular dotnet
|
||||
dnl silently disable here instead of erroring out, to prevent
|
||||
dnl breaking their build, as --with-dotnet is enabled by default.
|
||||
|
||||
AC_MSG_WARN([dotnet not found, disabling .NET support])
|
||||
ENABLE_DOTNET=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$DOTNET"; then
|
||||
dnl the dotnet executable was found, but no guarantees on whether
|
||||
dnl it contains SDK version 8 or higher unless we check.
|
||||
|
||||
AC_MSG_CHECKING([for .NET SDK 8 or higher])
|
||||
dotnet_sdk_ver_major=`"$DOTNET" --version | "$AWK" -F. '{ print $1 }'`
|
||||
if test "$dotnet_sdk_ver_major" -ge 8; then
|
||||
dnl the SDK seems valid, get the root directory
|
||||
|
||||
dotnet_sdk_ver=`"$DOTNET" --version | "$SED" 's/\r//g'`
|
||||
dotnet_sdk_dir=`"$DOTNET" --list-sdks | "$AWK" -F [[]][[]] "/^$dotnet_sdk_ver/"'{ print $2 }' | "$SED" 's/\r//g'`
|
||||
PathFormat "$dotnet_sdk_dir"
|
||||
DOTNET_ROOT=`dirname "$formatted_path_unix"`
|
||||
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
dnl silently disable for same reason as before
|
||||
|
||||
AC_MSG_RESULT([no, disabling .NET support])
|
||||
ENABLE_DOTNET=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ENABLE_DOTNET)
|
||||
if test "$ENABLE_DOTNET" != TRUE; then
|
||||
DOTNET=""
|
||||
DOTNET_ROOT=""
|
||||
fi
|
||||
|
||||
dnl set ENABLE_DOTNET="TRUE" for build-time and run-time .NET support
|
||||
dnl set ENABLE_DOTNET="" for no .NET support at all
|
||||
AC_SUBST(ENABLE_DOTNET)
|
||||
AC_SUBST(DOTNET)
|
||||
AC_SUBST(DOTNET_ROOT)
|
||||
|
||||
dnl ===================================================================
|
||||
dnl Java support
|
||||
|
|
|
@ -55,7 +55,7 @@ $(call gb_DotnetLibrary_get_target,%) :
|
|||
echo "$(DOTNET_ITEM_ELEMENTS)" >> $$P && \
|
||||
echo "</ItemGroup>" >> $$P && \
|
||||
echo "</Project>" >> $$P && \
|
||||
dotnet build $$P $(DOTNET_BUILD_FLAGS) \
|
||||
"$(DOTNET)" build $$P $(DOTNET_BUILD_FLAGS) \
|
||||
-o $(call gb_DotnetLibrary_get_workdir,$*) \
|
||||
> $@.log 2>&1 || \
|
||||
(echo \
|
||||
|
|
Loading…
Reference in a new issue