public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "orbea" <orbea@riseup.net>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/libressl:master commit in: dev-lang/rust/files/, dev-lang/rust/
Date: Mon, 12 Feb 2024 23:16:03 +0000 (UTC)	[thread overview]
Message-ID: <1707772383.7e57bc091cd779e3685effa0648edaf105c03a8c.orbea@gentoo> (raw)

commit:     7e57bc091cd779e3685effa0648edaf105c03a8c
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Mon Feb 12 21:13:03 2024 +0000
Commit:     orbea <orbea <AT> riseup <DOT> net>
CommitDate: Mon Feb 12 21:13:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=7e57bc09

dev-lang/rust: sync ::gentoo

Signed-off-by: orbea <orbea <AT> riseup.net>

 .../rust/files/1.74.1-cross-compile-libz.patch     | 19 +++++++++
 dev-lang/rust/metadata.xml                         |  8 ++++
 dev-lang/rust/rust-1.74.1.ebuild                   | 47 +++++++++++++++++-----
 3 files changed, 63 insertions(+), 11 deletions(-)

diff --git a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch
new file mode 100644
index 0000000..f2a881b
--- /dev/null
+++ b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch
@@ -0,0 +1,19 @@
+https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
+https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
+
+diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
+index f606fa483ca..8a2e1c40e8b 100644
+--- a/compiler/rustc_llvm/build.rs
++++ b/compiler/rustc_llvm/build.rs
+@@ -237,10 +237,7 @@ fn main() {
+     // of llvm-config, not the target that we're attempting to link.
+     let mut cmd = Command::new(&llvm_config);
+     cmd.arg(llvm_link_arg).arg("--libs");
+-
+-    if !is_crossed {
+-        cmd.arg("--system-libs");
+-    }
++    cmd.arg("--system-libs");
+ 
+     if (target.starts_with("arm") && !target.contains("freebsd"))
+         || target.starts_with("mips-")

diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml
index e28f627..65d7703 100644
--- a/dev-lang/rust/metadata.xml
+++ b/dev-lang/rust/metadata.xml
@@ -5,6 +5,14 @@
 		<email>gyakovlev@gentoo.org</email>
 		<name>Georgy Yakovlev</name>
 	</maintainer>
+	<maintainer type="person" proxied="yes">
+		<email>randy@electronsweatshop.com</email>
+		<name>Randy Barlow</name>
+	</maintainer>
+	<maintainer type="person" proxied="yes">
+		<email>navi@vlhl.dev</email>
+		<name>Anna Figueiredo Gomes</name>
+	</maintainer>
 	<maintainer type="project">
 		<email>rust@gentoo.org</email>
 		<name>Rust Project</name>

diff --git a/dev-lang/rust/rust-1.74.1.ebuild b/dev-lang/rust/rust-1.74.1.ebuild
index eee5354..d6fd639 100644
--- a/dev-lang/rust/rust-1.74.1.ebuild
+++ b/dev-lang/rust/rust-1.74.1.ebuild
@@ -163,6 +163,7 @@ RESTRICT="test"
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
 PATCHES=(
+	"${FILESDIR}"/1.74.1-cross-compile-libz.patch
 	#"${FILESDIR}"/1.72.0-bump-libc-deps-to-0.2.146.patch  # pending refresh
 	"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
 	"${FILESDIR}"/1.62.1-musl-dynamic-linking.patch
@@ -192,7 +193,7 @@ bootstrap_rust_version_check() {
 	[[ ${MERGE_TYPE} == binary ]] && return
 	local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))"
 	local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))"
-	local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
+	local rustc_version=( $(eselect --brief --root="${BROOT}" rust show 2>/dev/null) )
 	rustc_version=${rustc_version[0]#rust-bin-}
 	rustc_version=${rustc_version#rust-}
 
@@ -264,6 +265,18 @@ pkg_setup() {
 	python-any-r1_pkg_setup
 
 	export LIBGIT2_NO_PKG_CONFIG=1 #749381
+	if tc-is-cross-compiler; then
+		export PKG_CONFIG_ALLOW_CROSS=1
+		export PKG_CONFIG_PATH="${ROOT}/usr/$(get_libdir)/pkgconfig"
+		export OPENSSL_INCLUDE_DIR="${ROOT}/usr/include"
+		export OPENSSL_LIB_DIR="${ROOT}/usr/$(get_libdir)"
+
+		use system-bootstrap || die "USE=system-bootstrap is required when cross-compiling"
+		use system-llvm && die "USE=system-llvm not allowed when cross-compiling"
+		local cross_llvm_target="$(llvm_tuple_to_target "${CBUILD}")"
+		use "llvm_targets_${cross_llvm_target}" || \
+			die "Must enable LLVM_TARGETS=${cross_llvm_target} matching CBUILD=${CBUILD} when cross-compiling"
+	fi
 
 	use system-bootstrap && bootstrap_rust_version_check
 
@@ -297,6 +310,7 @@ esetup_unwind_hack() {
 
 src_prepare() {
 	eapply_crate vendor/openssl-sys "${FILESDIR}"/1.72.0-libressl-openssl-sys.patch
+
 	# Clear vendor checksums for crates that we patched to bump libc.
 	# NOTE: refresh this on each bump.
 	#for i in addr2line-0.20.0 bstr cranelift-jit crossbeam-channel elasticlunr-rs handlebars icu_locid libffi \
@@ -307,7 +321,7 @@ src_prepare() {
 	if ! use system-bootstrap; then
 		has_version sys-devel/gcc || esetup_unwind_hack
 		local rust_stage0_root="${WORKDIR}"/rust-stage0
-		local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
+		local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi "${CBUILD}")"
 
 		"${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
 			--without=rust-docs-json-preview,rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die
@@ -356,6 +370,8 @@ src_configure() {
 	[[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory"
 
 	rust_target="$(rust_abi)"
+	rust_build="$(rust_abi "${CBUILD}")"
+	rust_host="$(rust_abi "${CHOST}")"
 
 	local cm_btype="$(usex debug DEBUG RELEASE)"
 	cat <<- _EOF_ > "${S}"/config.toml
@@ -387,17 +403,24 @@ src_configure() {
 		enable-warnings = false
 		[llvm.build-config]
 		CMAKE_VERBOSE_MAKEFILE = "ON"
-		CMAKE_C_FLAGS_${cm_btype} = "${CFLAGS}"
-		CMAKE_CXX_FLAGS_${cm_btype} = "${CXXFLAGS}"
-		CMAKE_EXE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
-		CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
-		CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
-		CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = "${ARFLAGS}"
+		$(if ! tc-is-cross-compiler; then
+			# When cross-compiling, LLVM is compiled twice, once for host and
+			# once for target.  Unfortunately, this build configuration applies
+			# to both, which means any flags applicable to one target but not
+			# the other will break.  Conditionally disable respecting user
+			# flags when cross-compiling.
+			echo "CMAKE_C_FLAGS_${cm_btype} = \"${CFLAGS}\""
+			echo "CMAKE_CXX_FLAGS_${cm_btype} = \"${CXXFLAGS}\""
+			echo "CMAKE_EXE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
+			echo "CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
+			echo "CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
+			echo "CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = \"${ARFLAGS}\""
+		fi)
 		[build]
 		build-stage = 2
 		test-stage = 2
-		build = "${rust_target}"
-		host = ["${rust_target}"]
+		build = "${rust_build}"
+		host = ["${rust_host}"]
 		target = [${rust_targets}]
 		cargo = "${rust_stage0_root}/bin/cargo"
 		rustc = "${rust_stage0_root}/bin/rustc"
@@ -435,7 +458,9 @@ src_configure() {
 		debuginfo-level-tests = 0
 		backtrace = true
 		incremental = false
-		default-linker = "$(tc-getCC)"
+		$(if ! tc-is-cross-compiler; then
+			echo "default-linker = \"$(tc-getCC)\""
+		fi)
 		parallel-compiler = $(toml_usex parallel-compiler)
 		channel = "$(usex nightly nightly stable)"
 		description = "gentoo"


             reply	other threads:[~2024-02-12 23:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 23:16 orbea [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-02 18:43 [gentoo-commits] repo/proj/libressl:master commit in: dev-lang/rust/files/, dev-lang/rust/ orbea
2025-05-15 13:35 orbea
2025-04-26 19:39 orbea
2025-02-26  0:42 orbea
2025-02-26  0:42 orbea
2025-02-21 17:54 orbea
2025-02-06 18:44 orbea
2024-11-09 17:02 orbea
2024-09-18 16:28 orbea
2024-07-05  2:04 orbea
2024-06-29  4:26 orbea
2024-06-02 21:17 orbea
2024-04-04 16:10 orbea
2024-02-12 23:16 orbea
2024-02-12 23:16 orbea
2023-10-09 14:00 orbea
2023-07-24 19:34 orbea
2023-06-05  0:15 orbea
2023-03-28 18:51 Quentin Retornaz
2023-02-12  2:59 Quentin Retornaz
2023-01-31 23:14 Quentin Retornaz
2022-11-15 21:18 Quentin Retornaz
2022-11-15 21:18 Quentin Retornaz
2022-10-07 21:11 Quentin Retornaz
2022-09-29 22:58 Quentin Retornaz
2022-09-24 20:10 Quentin Retornaz
2022-06-02  1:44 Quentin Retornaz
2022-06-02  1:44 Quentin Retornaz
2022-03-19 22:15 Quentin Retornaz
2022-01-15 19:13 Quentin Retornaz
2021-12-25 23:59 Quentin Retornaz
2021-08-20 23:56 Quentin Retornaz
2021-06-27  0:33 Quentin Retornaz
2019-02-20 19:12 Stefan Strogin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1707772383.7e57bc091cd779e3685effa0648edaf105c03a8c.orbea@gentoo \
    --to=orbea@riseup.net \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox