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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D8B12158020 for ; Sat, 26 Nov 2022 10:54:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2CAA1E09C9; Sat, 26 Nov 2022 10:54:34 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 08E89E09C3 for ; Sat, 26 Nov 2022 10:54:34 +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 523ED341499 for ; Sat, 26 Nov 2022 10:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5B27876B for ; Sat, 26 Nov 2022 10:54:30 +0000 (UTC) From: "Florian Schmaus" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Florian Schmaus" Message-ID: <1669343647.637fee59f92658dcacab882c31237635a79ff53f.flow@gentoo> Subject: [gentoo-commits] repo/proj/guru:master commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/dotnet-utils.eclass X-VCS-Directories: eclass/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: 637fee59f92658dcacab882c31237635a79ff53f X-VCS-Branch: master Date: Sat, 26 Nov 2022 10:54: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: 23c145da-3cb1-47f7-9a52-bfb47a633754 X-Archives-Hash: 951fd068268b1b8d33330c9ce882cba2 commit: 637fee59f92658dcacab882c31237635a79ff53f Author: Anna (navi) Figueiredo Gomes navirc com> AuthorDate: Fri Nov 25 02:34:07 2022 +0000 Commit: Florian Schmaus gentoo org> 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