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 8E54015817D for ; Thu, 13 Jun 2024 21:33:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AA6C3E2AFA; Thu, 13 Jun 2024 21:32:56 +0000 (UTC) Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (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 3BDADE2A7D for ; Thu, 13 Jun 2024 21:32:56 +0000 (UTC) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8A1E1240101 for ; Thu, 13 Jun 2024 23:32:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1718314374; bh=1Zl92TfRJpK0vOFYAiUwXdod1EMiwmCrb7JKOp+hyhU=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:From; b=T96ogOTQra9U2iD+Qm8LQeEB4uV1bxUWWXvknhj91bCPc7bBTBAvYMHA3SJ3rqJ+O P5iVGkM6soDh0Z9c8r45BKAPelsS6E+JcbG/jFc9TWM9JYxTglgj2On91WXEGAeIrv uLZHrCOOekHreYSihEYqZdat2vsKGBxo6yVYRSR7mjqtaoabThWL30nASEsHwFZZ6o oyMN6Dly1549RNhuxFjFmyE5khKogSZm3wmwh5VoLyEXArwWE8Fk6YA0dbd2vuZDPt pl/kw9recqv1SbqkOU788gY9Mhm9gPqqs4dYsQq+MkGS9hIDEOz5E2QMHLIH8/hspV ktF5iknc26uAw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4W0bH94wrVz9rxB for ; Thu, 13 Jun 2024 23:32:53 +0200 (CEST) Date: Thu, 13 Jun 2024 21:32:50 +0000 From: Lucio Sauer To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] cargo.eclass: Add cargo_target_dir helper function Message-ID: <7afchawnwsvh54fkyedgu727xddihslxk44tjbmtiobr5llmph@rzoy2fteogxc> References: <20240613150530.24679-1-chewi@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2r7xczllh2uuojc2" Content-Disposition: inline In-Reply-To: <20240613150530.24679-1-chewi@gentoo.org> X-Archives-Salt: f8e62235-4a9d-48c2-86bf-2435b3f79abe X-Archives-Hash: eba0cb2e63f2b3175970003faaa18aaf --2r7xczllh2uuojc2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 13, 2024 at 04:03:44PM +0100, James Le Cuirot wrote: > Several Cargo-based ebuilds cannot use cargo_src_install for various > reasons and manually install binaries from within the target directory > instead. It is common to see `target/$(usex debug debug release)`, but > this lacks the target ABI when cross-compiling, so provide a helper > function. >=20 > There are some multilib Cargo-based ebuilds that always set the target > ABI, even when not cross-compiling. It would be simpler to do this in > general, so once ebuilds have been updated to use this new helper, I > might change the eclass again accordingly. >=20 > Signed-off-by: James Le Cuirot > --- > eclass/cargo.eclass | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass > index 40d98211ce7f9..2036fb635d569 100644 > --- a/eclass/cargo.eclass > +++ b/eclass/cargo.eclass > @@ -319,6 +319,16 @@ _cargo_gen_git_config() { > fi > } > =20 > +# @FUNCTION: cargo_target_dir > +# @DESCRIPTION: > +# Return the directory within target that contains the build, e.g. > +# target/aarch64-unknown-linux-gnu/release. > +cargo_target_dir() { > + local abi > + tc-is-cross-compiler && abi=3D$(rust_abi) > + echo "${CARGO_TARGET_DIR:-target}${abi+/}${abi}/$(usex debug debug rele= ase)" > +} > + How about giving this function an optional parameter that gets passed to rust_abi so that you can get the build directory for targets other than CHOST? What initially motivated this suggestion is a quirk in app-misc/anki's build system together with your recent change to cargo.eclass 375da3684, which enables cross-compilation by setting environment variables. Here, I first build the 'build system runner' for CBUILD, which then compiles the actual package for CHOST. I think I can avoid explicitly setting --target $(rust ${CBUILD}) for the runner for now, but it would be handy to easily get the build directory for CBUILD in the future! --=20 Lucio Sauer > # @FUNCTION: cargo_src_unpack > # @DESCRIPTION: > # Unpacks the package and the cargo registry. > --=20 > 2.45.1 >=20 >=20 --2r7xczllh2uuojc2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEElFlueg0TS/aEyc5qVWii3aYMopcFAmZrZX9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk0 NTk2RTdBMEQxMzRCRjY4NEM5Q0U2QTU1NjhBMkREQTYwQ0EyOTcACgkQVWii3aYM opc9zAf8Ckn8Uy9NJRj5hXDq+dk6xGYg1QL5N2cEDi5fu0hlcUBDtdOfSbJIqQ8B PxpkOj+1/gKtL+YvcDjJ32vT/Xz9QIgVrJRCTrc25RqYHUf6LF8/pSvTHLpfLQWS CDcYZr5xfNA0hSigoRGxdWTCs0bHyUIcoUsJUB85FO8dRWS7LdCOP37E/mHpkZCv WO1CUptt8mzmwt6R79euRSkfMoa4ug9I/nKy0CYwhfEKLH25jDSeO7yP9tUhG+3G bQNFdzoBE19fhFBaCNswL3eFl62tICuRq5VLbYYv9wNr8hUyACk/XxL2JWXJIvWc apMzfT3PrXZrnnSWO/xxJldDyNQCgA== =pngx -----END PGP SIGNATURE----- --2r7xczllh2uuojc2--