commit: d08dfaa5f73407400e4c2cf7f8d9752280e4d55c Author: Maciej Barć <xgqt <AT> gentoo <DOT> org> AuthorDate: Sat Feb 3 14:17:30 2024 +0000 Commit: Maciej Barć <xgqt <AT> gentoo <DOT> org> CommitDate: Sat Feb 10 16:24:45 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d08dfaa5
eclass/dotnet-pkg-base.eclass: set DOTNET_ROOT export proper DOTNET_ROOT for wanted DOTNET_PKG_COMPAT Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org> eclass/dotnet-pkg-base.eclass | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/eclass/dotnet-pkg-base.eclass b/eclass/dotnet-pkg-base.eclass index beefd1efd2da..a2d95f15a2fb 100644 --- a/eclass/dotnet-pkg-base.eclass +++ b/eclass/dotnet-pkg-base.eclass @@ -228,28 +228,27 @@ dotnet-pkg-base_get-runtime() { # # Used by "dotnet-pkg_pkg_setup" from the "dotnet-pkg" eclass. dotnet-pkg-base_setup() { - local dotnet_compat_impl - local dotnet_compat_impl_path - for dotnet_compat_impl in dotnet{,-bin}-${DOTNET_PKG_COMPAT} ; do - dotnet_compat_impl_path="$(type -P "${dotnet_compat_impl}")" + local -a impl_dirs=( + "${EPREFIX}/usr/$(get_libdir)/dotnet-sdk-${DOTNET_PKG_COMPAT}" + "${EPREFIX}/opt/dotnet-sdk-bin-${DOTNET_PKG_COMPAT}" + ) + local impl_exe + + local impl_dir + for impl_dir in "${impl_dirs[@]}" ; do + impl_exe="${impl_dir}/dotnet" + + if [[ -d "${impl_dir}" ]] && [[ -x "${impl_exe}" ]] ; then + DOTNET_PKG_EXECUTABLE="${impl_exe}" + DOTNET_ROOT="${impl_dir}" - if [[ -n ${dotnet_compat_impl_path} ]] ; then - DOTNET_PKG_EXECUTABLE="${dotnet_compat_impl}" break fi done - # Link "DOTNET_PKG_EXECUTABLE" to "dotnet" only for the package build. - local dotnet_spoof_path="${T}/dotnet_spoof/${DOTNET_PKG_COMPAT}" - mkdir -p "${dotnet_spoof_path}" || die - ln -s "${dotnet_compat_impl_path}" "${dotnet_spoof_path}/dotnet" || die - export PATH="${dotnet_spoof_path}:${PATH}" - - einfo "Using dotnet SDK \"${DOTNET_PKG_EXECUTABLE}\" from \"${dotnet_compat_impl_path}\"." - - # The picked "DOTNET_PKG_EXECUTABLE" should set "DOTNET_ROOT" internally - # and not rely upon this environment variable. - unset DOTNET_ROOT + einfo "Setting .NET SDK \"DOTNET_ROOT\" to \"${DOTNET_ROOT}\"" + export DOTNET_ROOT + export PATH="${DOTNET_ROOT}:${PATH}" DOTNET_PKG_RUNTIME="$(dotnet-pkg-base_get-runtime)" DOTNET_PKG_CONFIGURATION="$(dotnet-pkg-base_get-configuration)"