From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6E1F0158020 for ; Fri, 25 Nov 2022 02:38:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7ECA0E0940; Fri, 25 Nov 2022 02:38:33 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 63A1DE0940 for ; Fri, 25 Nov 2022 02:38:33 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 55A95340FAE for ; Fri, 25 Nov 2022 02:38:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A8AB3692 for ; Fri, 25 Nov 2022 02:38:30 +0000 (UTC) From: "Anna Figueiredo Gomes" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anna Figueiredo Gomes" Message-ID: <1669343647.637fee59f92658dcacab882c31237635a79ff53f.anna-cli@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/dotnet-utils.eclass X-VCS-Directories: eclass/ X-VCS-Committer: anna-cli X-VCS-Committer-Name: Anna Figueiredo Gomes X-VCS-Revision: 637fee59f92658dcacab882c31237635a79ff53f X-VCS-Branch: dev Date: Fri, 25 Nov 2022 02:38:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9cbd2036-f843-40ec-ad7b-9ee483faaaf7 X-Archives-Hash: 3354e40195bd839269d6d8b7ad4f8db9 commit: 637fee59f92658dcacab882c31237635a79ff53f Author: Anna (navi) Figueiredo Gomes navirc com> AuthorDate: Fri Nov 25 02:34:07 2022 +0000 Commit: Anna Figueiredo Gomes tutanota com> CommitDate: Fri Nov 25 02:34:07 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=637fee59 dotnet-utils.eclass: SLOT and runtime ARCH support Signed-off-by: Anna (navi) Figueiredo Gomes navirc.com> eclass/dotnet-utils.eclass | 56 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/eclass/dotnet-utils.eclass b/eclass/dotnet-utils.eclass index 26a968035..61ccf8f11 100644 --- a/eclass/dotnet-utils.eclass +++ b/eclass/dotnet-utils.eclass @@ -3,9 +3,9 @@ # @ECLASS: dotnet-utils.eclass # @MAINTAINER: -# anna-cli@tutanota.com +# anna@navirc.com # @AUTHOR: -# Anna Figueiredo Gomes +# Anna Figueiredo Gomes # @SUPPORTED_EAPIS: 7 8 # @BLURB: common functions and variables for dotnet builds @@ -19,8 +19,23 @@ esac inherit multiprocessing -BDEPEND=">=virtual/dotnet-sdk-6.0" -EXPORT_FUNCTIONS src_unpack src_prepare src_compile +# @ECLASS_VARIABLE: DOTNET_SLOT +# @DESCRIPTION: +# Allows for choosing a slot for dotnet +# @DEFAULT_UNSET + +if [[ -z "${DOTNET_SLOT}" ]]; then + die "DOTNET_SLOT not set." +fi + +# Temporary, use the virtual once you can have multiple virtuals installed at once +BDEPEND+=" || ( dev-dotnet/dotnet-sdk:${DOTNET_SLOT} dev-dotnet/dotnet-sdk-bin:${DOTNET_SLOT} )" +EXPORT_FUNCTIONS src_unpack src_prepare src_compile pkg_setup + +# @ECLASS_VARIABLE: DOTNET_EXECUTABLE +# @DESCRIPTION: +# Holds the right executable name +# @DEFAULT_UNSET # @ECLASS_VARIABLE: DOTNET_CLI_TELEMETRY_OPTOUT # @DESCRIPTION: @@ -36,7 +51,7 @@ export MSBUILDDISABLENODEREUSE=1 export DOTNET_NOLOGO=1 # Needed otherwise the binaries break -RESTRICT="strip" +RESTRICT+=" strip" # @ECLASS_VARIABLE: NUGETS # @DEFAULT_UNSET @@ -83,6 +98,30 @@ nuget_uris() { done } +dotnet-utils_pkg_setup() { + case "${ARCH}" in + *amd64) + DOTNET_RUNTIME="linux-x64" + ;; + *arm) + DOTNET_RUNTIME="linux-arm" + ;; + *arm64) + DOTNET_RUNTIME="linux-arm64" + ;; + *) + die "Unsupported arch: ${ARCH}" + ;; + esac + + for _dotnet in dotnet-{${DOTNET_SLOT},bin-${DOTNET_SLOT}}; do + if type $_dotnet 1> /dev/null 2>&1; then + DOTNET_EXECUTABLE=$_dotnet + break + fi + done +} + # @FUNCTION: edotnet # @USAGE: [[command] ...] # @DESCRIPTION: @@ -93,7 +132,7 @@ edotnet() { local ret - set -- dotnet "${@}" -maxcpucount:$(makeopts_jobs) + set -- "$DOTNET_EXECUTABLE" "${@}" --runtime "${DOTNET_RUNTIME}" -maxcpucount:$(makeopts_jobs) echo "${@}" >&2 "${@}" ret=${?} @@ -130,7 +169,6 @@ dotnet-utils_src_unpack() { dotnet-utils_src_prepare() { debug-print-function ${FUNCNAME} "$@" edotnet restore \ - --runtime linux-x64 \ --source "${DISTDIR}" || die default } @@ -141,13 +179,9 @@ dotnet-utils_src_prepare() { dotnet-utils_src_compile() { debug-print-function ${FUNCNAME} "$@" - addpredict /opt/dotnet-sdk-bin-6.0/metadata - edotnet publish \ - --nologo \ --no-restore \ --configuration Release \ - --runtime linux-x64 \ "-p:Version=${PV}" \ -p:DebugType=embedded \ --self-contained || die