diff --git a/lang/rust-nightly/Makefile b/lang/rust-nightly/Makefile index b3b8ab296639..145d7130fb04 100644 --- a/lang/rust-nightly/Makefile +++ b/lang/rust-nightly/Makefile @@ -1,21 +1,21 @@ # Run update.sh to update to the latest nightly -PORTVERSION= 1.80.0.${NIGHTLY_DATE:C,-,,g} +PORTVERSION= 1.83.0.${NIGHTLY_DATE:C,-,,g} # Always set PORTREVISION explicitly as otherwise it is inherited from lang/rust PORTREVISION= 0 PKGNAMESUFFIX= -nightly DISTNAME= rustc-nightly-src ONLY_FOR_ARCHS= amd64 ONLY_FOR_ARCHS_REASON= upstream does not provide bootstraps for other architectures CONFLICTS_INSTALL= rust MASTERDIR= ${.CURDIR}/../rust PATCHDIR= ${.CURDIR}/files DISTINFO_FILE= ${.CURDIR}/distinfo -NIGHTLY_DATE= 2024-05-07 -BOOTSTRAPS_DATE= 2024-04-29 +NIGHTLY_DATE= 2024-10-01 +BOOTSTRAPS_DATE= 2024-09-22 RUST_BOOTSTRAP_VERSION= beta .include "${MASTERDIR}/Makefile" diff --git a/lang/rust-nightly/distinfo b/lang/rust-nightly/distinfo index b5947b78c52b..3008e4b71ccc 100644 --- a/lang/rust-nightly/distinfo +++ b/lang/rust-nightly/distinfo @@ -1,9 +1,9 @@ -TIMESTAMP = 1715170997 -SHA256 (rust/2024-05-07/rustc-nightly-src.tar.xz) = 980396ea6f15b926155ffaab4d56f70a0729a18a98ed99fe11004b5709855458 -SIZE (rust/2024-05-07/rustc-nightly-src.tar.xz) = 162781340 -SHA256 (rust/2024-04-29/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 786f40030dbe5e6897aafe4bda44770920b2010b93fc5ce86574774e531e2eff -SIZE (rust/2024-04-29/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 75473648 -SHA256 (rust/2024-04-29/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 69626178bc5309afc8a02c941bd77e70e1aa6917ffb6bf0d67a57d921b5c664a -SIZE (rust/2024-04-29/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 27096208 -SHA256 (rust/2024-04-29/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 7fab806227d1a3be817602abb121ac7e039ba0bbf81e0a1d47bdcccca74203c6 -SIZE (rust/2024-04-29/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 9257888 +TIMESTAMP = 1727858204 +SHA256 (rust/2024-10-01/rustc-nightly-src.tar.xz) = 46c2d963da26229b8cdeed978b5c9affa091486015d474c1f8a754282a332d1a +SIZE (rust/2024-10-01/rustc-nightly-src.tar.xz) = 353516056 +SHA256 (rust/2024-09-22/rustc-beta-x86_64-unknown-freebsd.tar.xz) = aeabedce922b315fb872127a6102a76e9fe5e1932b14a7210f31191f9a85488b +SIZE (rust/2024-09-22/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 81004732 +SHA256 (rust/2024-09-22/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 8749c2ae47644c16f62a310500ab91e5403a25c3e023a2c6e25cfa16217c98e9 +SIZE (rust/2024-09-22/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 28846744 +SHA256 (rust/2024-09-22/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 7912a49f7a181145b71a197014e3de6594b216959cd7c95a003fcd13854cb056 +SIZE (rust/2024-09-22/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 9536628 diff --git a/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_lib.rs b/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_lib.rs deleted file mode 100644 index 081c2056ad2c..000000000000 --- a/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_lib.rs +++ /dev/null @@ -1,28 +0,0 @@ -Attempt to fix intermittent "can't find crate for `std`" build failures - -The location of rustc (found via env::current_exe()) is used to -find the right libstd. However it might have been "copied" by -creating a hard link to the new location instead. Like /proc/curproc/file, -KERN_PROC_PATHNAME (used internally by current_exe()) can return -any of the file's multiple paths. Most of the time it returns the -right rustc path and the build will succeed but occasionally it -will return the "wrong" path and the build fails with: - - error[E0463]: can't find crate for `std` - -If this is right a viable workaround should be to never create hard -links during the build, so let's try that. - ---- src/bootstrap/lib.rs.orig 2020-07-23 20:16:43 UTC -+++ src/bootstrap/lib.rs -@@ -1173,10 +1173,6 @@ impl Build { - if metadata.file_type().is_symlink() { - let link = t!(fs::read_link(src)); - t!(symlink_file(link, dst)); -- } else if let Ok(()) = fs::hard_link(src, dst) { -- // Attempt to "easy copy" by creating a hard link -- // (symlinks don't work on windows), but if that fails -- // just fall back to a slow `copy` operation. - } else { - if let Err(e) = fs::copy(src, dst) { - panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e) diff --git a/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_native.rs b/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_native.rs deleted file mode 100644 index 1484fdeee67e..000000000000 --- a/lang/rust-nightly/files/no-hardlinks/patch-src_bootstrap_native.rs +++ /dev/null @@ -1,39 +0,0 @@ -There seems to be some kind of race when using llvm-config-wrapper -for building rust-lld. Attempt to improve reliability of the build -by not using it. llvm-config-wrapper is a hack in the first place -that is only really needed on Windows. - ---- src/bootstrap/native.rs.orig 2022-05-01 20:28:31 UTC -+++ src/bootstrap/native.rs -@@ -918,22 +918,6 @@ impl Step for Lld { - let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld")); - configure_cmake(builder, target, &mut cfg, true, LdFlags::default()); - -- // This is an awful, awful hack. Discovered when we migrated to using -- // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of -- // tree, will execute `llvm-config --cmakedir` and then tell CMake about -- // that directory for later processing. Unfortunately if this path has -- // forward slashes in it (which it basically always does on Windows) -- // then CMake will hit a syntax error later on as... something isn't -- // escaped it seems? -- // -- // Instead of attempting to fix this problem in upstream CMake and/or -- // LLVM/LLD we just hack around it here. This thin wrapper will take the -- // output from llvm-config and replace all instances of `\` with `/` to -- // ensure we don't hit the same bugs with escaping. It means that you -- // can't build on a system where your paths require `\` on Windows, but -- // there's probably a lot of reasons you can't do that other than this. -- let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper"); -- - // Re-use the same flags as llvm to control the level of debug information - // generated for lld. - let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) { -@@ -945,7 +929,7 @@ impl Step for Lld { - cfg.out_dir(&out_dir) - .profile(profile) - .env("LLVM_CONFIG_REAL", &llvm_config) -- .define("LLVM_CONFIG_PATH", llvm_config_shim) -+ .define("LLVM_CONFIG_PATH", &llvm_config) - .define("LLVM_INCLUDE_TESTS", "OFF"); - - // While we're using this horrible workaround to shim the execution of diff --git a/lang/rust-nightly/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs b/lang/rust-nightly/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs new file mode 100644 index 000000000000..2524e1872984 --- /dev/null +++ b/lang/rust-nightly/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs @@ -0,0 +1,11 @@ +--- compiler/rustc_target/src/abi/call/powerpc64.rs.orig 2020-03-09 22:11:17 UTC ++++ compiler/rustc_target/src/abi/call/powerpc64.rs +@@ -123,7 +123,7 @@ where + ELFv2 + } else { + match cx.data_layout().endian { +- Endian::Big => ELFv1, ++ Endian::Big => ELFv2, + Endian::Little => ELFv2, + } + }; diff --git a/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs b/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs similarity index 86% rename from lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs rename to lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs index c1f57467f264..45d479133343 100644 --- a/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_i686__unknown__freebsd.rs +++ b/lang/rust-nightly/files/patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs @@ -1,11 +1,13 @@ ---- compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs.orig 2023-11-27 08:52:00 UTC +i386 should be pentiumpro (no SSE2, no ...) + +--- compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs.orig 2023-12-22 11:18:00 UTC +++ compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs @@ -2,7 +2,7 @@ pub fn target() -> Target { pub fn target() -> Target { let mut base = base::freebsd::opts(); - base.cpu = "pentium4".into(); + base.cpu = "pentiumpro".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-znotext"]); base.stack_probes = StackProbeType::X86; diff --git a/lang/rust-nightly/files/patch-library_backtrace_src_backtrace_mod.rs b/lang/rust-nightly/files/patch-library_backtrace_src_backtrace_mod.rs new file mode 100644 index 000000000000..9731c97fc809 --- /dev/null +++ b/lang/rust-nightly/files/patch-library_backtrace_src_backtrace_mod.rs @@ -0,0 +1,10 @@ +--- library/backtrace/src/backtrace/mod.rs.orig 2024-10-02 09:23:54.876659000 +0200 ++++ library/backtrace/src/backtrace/mod.rs 2024-10-02 09:23:44.139133000 +0200 +@@ -176,6 +176,7 @@ cfg_if::cfg_if! { + unix, + not(target_os = "emscripten"), + not(all(target_os = "ios", target_arch = "arm")), ++ not(all(target_os = "freebsd", target_arch = "riscv64")), + ), + all( + target_env = "sgx", diff --git a/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs b/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs index fc3b22aebde1..3add18d71b22 100644 --- a/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs +++ b/lang/rust-nightly/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs @@ -1,36 +1,36 @@ We run cargo update during USES=cargo ports builds to update specific crates and patch Cargo.lock for us. For normal crates this is based on what's available in the vendor dir. For Git sources this pulls new changes from the net instead even if we replace the source with a static path in a patch section in the config file. Add a hack to skip this. This is for experimentation to solve [1]. For this to maybe be useful for USES=cargo, the patch-in-config feature also needs to be stabilized first. It will be available in Rust 1.56. [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256581 --- src/tools/cargo/src/cargo/sources/git/source.rs.orig 2021-10-04 20:59:57 UTC +++ src/tools/cargo/src/cargo/sources/git/source.rs -@@ -195,6 +195,9 @@ impl<'cfg> Source for GitSource<'cfg> { +@@ -205,6 +205,9 @@ impl<'cfg> Source for GitSource<'cfg> { kind: QueryKind, f: &mut dyn FnMut(IndexSummary), ) -> Poll> { + if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() { + return Poll::Ready(Ok(())); + } if let Some(src) = self.path_source.as_mut() { src.query(dep, kind, f) } else { -@@ -217,6 +220,10 @@ impl<'cfg> Source for GitSource<'cfg> { - fn block_until_ready(&mut self) -> CargoResult<()> { +@@ -228,6 +231,10 @@ impl<'cfg> Source for GitSource<'cfg> { if self.path_source.is_some() { self.mark_used(None)?; -+ return Ok(()); + return Ok(()); + } + + if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() { - return Ok(()); ++ return Ok(()); } + let git_fs = self.config.git_path(); diff --git a/lang/rust-nightly/files/patch-vendor_cc.rs b/lang/rust-nightly/files/patch-vendor_cc.rs index 5b6888c4c087..efecd8bd3a76 100644 --- a/lang/rust-nightly/files/patch-vendor_cc.rs +++ b/lang/rust-nightly/files/patch-vendor_cc.rs @@ -1,107 +1,53 @@ When the compiler has "clang" in its name the cc crate will pass an LLVM target triple to it. Rust uses a triple that lacks the OS version and LLVM will default to FreeBSD 9 behavior, i.e., it will default to libstdc++ which is no longer available in newer releases. To avoid this issue assume we have a GNU compatible toolchain instead until LLVM can be updated to use libc++ by default. https://reviews.llvm.org/D77776 ---- vendor/cc-1.0.73/src/lib.rs.orig 2021-03-04 20:58:54 UTC -+++ vendor/cc-1.0.73/src/lib.rs -@@ -2659,24 +2659,7 @@ impl Tool { - } - - fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self { -- // Try to detect family of the tool from its name, falling back to Gnu. -- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) { -- if fname.contains("clang-cl") { -- ToolFamily::Msvc { clang_cl: true } -- } else if fname.ends_with("cl") || fname == "cl.exe" { -- ToolFamily::Msvc { clang_cl: false } -- } else if fname.contains("clang") { -- match clang_driver { -- Some("cl") => ToolFamily::Msvc { clang_cl: true }, -- _ => ToolFamily::Clang, -- } -- } else { -- ToolFamily::Gnu -- } -- } else { -- ToolFamily::Gnu -- }; -- -+ let family = ToolFamily::Gnu; - Tool { - path: path, - cc_wrapper_path: None, +cc-1.1.10/ cc-1.1.22/ ---- vendor/cc-1.0.79/src/lib.rs.orig 2021-03-04 20:58:54 UTC -+++ vendor/cc-1.0.79/src/lib.rs -@@ -2659,24 +2659,7 @@ impl Tool { - } +--- vendor/cc-1.0.105/src/tool.rs.orig 2024-05-09 18:20:47 UTC ++++ vendor/cc-1.0.105/src/tool.rs +@@ -151,9 +151,7 @@ impl Tool { - fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self { -- // Try to detect family of the tool from its name, falling back to Gnu. -- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) { -- if fname.contains("clang-cl") { -- ToolFamily::Msvc { clang_cl: true } -- } else if fname.ends_with("cl") || fname == "cl.exe" { -- ToolFamily::Msvc { clang_cl: false } -- } else if fname.contains("clang") { -- match clang_driver { -- Some("cl") => ToolFamily::Msvc { clang_cl: true }, -- _ => ToolFamily::Clang, -- } -- } else { -- ToolFamily::Gnu -- } -- } else { -- ToolFamily::Gnu -- }; -- -+ let family = ToolFamily::Gnu; - Tool { - path: path, - cc_wrapper_path: None, + match (clang, accepts_cl_style_flags, gcc) { + (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }), +- (true, false, _) => Ok(ToolFamily::Clang { +- zig_cc: is_zig_cc(path, cargo_output), +- }), ++ (true, false, _) => Ok(ToolFamily::Gnu), + (false, false, true) => Ok(ToolFamily::Gnu), + (false, false, false) => { + cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU"); ---- vendor/cc-1.0.90/src/tool.rs.orig 2024-03-18 11:23:17 UTC -+++ vendor/cc-1.0.90/src/tool.rs -@@ -122,22 +122,7 @@ impl Tool { - }; - - // Try to detect family of the tool from its name, falling back to Gnu. -- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) { -- if fname.contains("clang-cl") { -- ToolFamily::Msvc { clang_cl: true } -- } else if fname.ends_with("cl") || fname == "cl.exe" { -- ToolFamily::Msvc { clang_cl: false } -- } else if fname.contains("clang") { -- match clang_driver { -- Some("cl") => ToolFamily::Msvc { clang_cl: true }, -- _ => ToolFamily::Clang, -- } -- } else { -- detect_family(&path) -- } -- } else { -- detect_family(&path) -- }; -+ let family = ToolFamily::Gnu; - - Tool { - path, ---- vendor/cc-1.0.92/src/tool.rs.orig 2024-05-09 18:20:47 UTC -+++ vendor/cc-1.0.92/src/tool.rs +--- vendor/cc-1.1.10/src/tool.rs.orig 2024-05-09 18:20:47 UTC ++++ vendor/cc-1.1.10/src/tool.rs @@ -151,9 +151,7 @@ impl Tool { match (clang, accepts_cl_style_flags, gcc) { (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }), - (true, false, _) => Ok(ToolFamily::Clang { - zig_cc: is_zig_cc(path, cargo_output), - }), + (true, false, _) => Ok(ToolFamily::Gnu), (false, false, true) => Ok(ToolFamily::Gnu), (false, false, false) => { cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU"); + +--- vendor/cc-1.1.22/src/tool.rs.orig 2024-10-02 09:43:22.970422000 +0200 ++++ vendor/cc-1.1.22/src/tool.rs 2024-10-02 09:50:42.836352000 +0200 +@@ -174,9 +174,7 @@ impl Tool { + + match (clang, accepts_cl_style_flags, gcc, emscripten, vxworks) { + (clang_cl, true, _, false, false) => Ok(ToolFamily::Msvc { clang_cl }), +- (true, _, _, _, false) | (_, _, _, true, false) => Ok(ToolFamily::Clang { +- zig_cc: is_zig_cc(path, cargo_output), +- }), ++ (true, _, _, _, false) | (_, _, _, true, false) => Ok(ToolFamily::Gnu), + (false, false, true, _, false) | (_, _, _, _, true) => Ok(ToolFamily::Gnu), + (false, false, false, false, false) => { + cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__`, `__EMSCRIPTEN__` or `__VXWORKS__`, also does not accept cl style flag `-?`, fallback to treating it as GNU"); diff --git a/lang/rust-nightly/files/patch-vendor_nix-0.28.0_src_sys_signal.rs b/lang/rust-nightly/files/patch-vendor_nix-0.28.0_src_sys_signal.rs new file mode 100644 index 000000000000..fbe6d4e5a216 --- /dev/null +++ b/lang/rust-nightly/files/patch-vendor_nix-0.28.0_src_sys_signal.rs @@ -0,0 +1,20 @@ +--- vendor/nix-0.28.0/src/sys/signal.rs.orig 2024-06-14 14:06:00 UTC ++++ vendor/nix-0.28.0/src/sys/signal.rs +@@ -1099,7 +1099,7 @@ pub type type_of_thread_id = libc::lwpid_t; + #[cfg(target_os = "freebsd")] + pub type type_of_thread_id = libc::lwpid_t; + /// Identifies a thread for [`SigevNotify::SigevThreadId`] +-#[cfg(all(not(target_os = "hurd"), any(target_env = "gnu", target_env = "uclibc")))] ++#[cfg(all(not(any(target_os = "freebsd", target_os = "hurd")), any(target_env = "gnu", target_env = "uclibc")))] + pub type type_of_thread_id = libc::pid_t; + + /// Specifies the notification method used by a [`SigEvent`] +@@ -1349,7 +1349,7 @@ mod sigevent { + sev.sigev_value.sival_ptr = si_value as *mut libc::c_void; + sev._sigev_un._threadid = thread_id; + } +- #[cfg(any(target_env = "gnu", target_env = "uclibc"))] ++ #[cfg(all(not(target_os = "freebsd"), any(target_env = "gnu", target_env = "uclibc")))] + SigevNotify::SigevThreadId{signal, thread_id, si_value} => { + sev.sigev_notify = libc::SIGEV_THREAD_ID; + sev.sigev_signo = signal as libc::c_int; diff --git a/lang/rust-nightly/update.sh b/lang/rust-nightly/update.sh index 2a8f325ad255..6c8452b92343 100644 --- a/lang/rust-nightly/update.sh +++ b/lang/rust-nightly/update.sh @@ -1,25 +1,26 @@ #!/bin/sh # Requires: pkg install portfmt yq # Run in lang/rust-nightly set -eu prev_date=$(portedit get '^NIGHTLY_DATE$' .) prev_commit=$(fetch -qo - https://static.rust-lang.org/dist/${prev_date}/channel-rust-nightly.toml | tomlq -r '.pkg.rustc.git_commit_hash') fetch -qo /tmp/channel-rust-nightly.toml https://static.rust-lang.org/dist/channel-rust-nightly.toml rust-nightly.msg diff --git a/lang/rust/Makefile b/lang/rust/Makefile index 5f3a427ae029..295e4b1941c0 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -1,286 +1,285 @@ PORTNAME= rust PORTVERSION?= 1.81.0 PORTREVISION?= 0 CATEGORIES= lang MASTER_SITES= https://static.rust-lang.org/dist/:src \ https://dev-static.rust-lang.org/dist/:src \ LOCAL/rust:bootstrap \ https://static.rust-lang.org/dist/:bootstrap DISTNAME?= ${PORTNAME}c-${PORTVERSION}-src DISTFILES?= ${NIGHTLY_DATE:D${NIGHTLY_DATE}/}${DISTNAME}${EXTRACT_SUFX}:src \ ${_RUSTC_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \ ${_RUST_STD_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \ ${_CARGO_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap DIST_SUBDIR?= rust MAINTAINER= rust@FreeBSD.org COMMENT= Language with a focus on memory safety and concurrency WWW= https://www.rust-lang.org/ LICENSE= APACHE20 MIT LICENSE_COMB= dual LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT ONLY_FOR_ARCHS?= aarch64 amd64 armv7 i386 powerpc64 powerpc64le powerpc \ riscv64 ONLY_FOR_ARCHS_REASON?= requires prebuilt bootstrap compiler LIB_DEPENDS= libcurl.so:ftp/curl USES= cmake:indirect cpe ninja:build pkgconfig python:build ssl tar:xz CPE_VENDOR= rust-lang MAKE_ENV= DESTDIR=${STAGEDIR} \ LIBGIT2_NO_PKG_CONFIG=1 \ OPENSSL_DIR="${OPENSSLBASE}" TEST_ENV= ${MAKE_ENV} \ ALLOW_NONZERO_RLIMIT_CORE=1 CONFLICTS_INSTALL?= rust-nightly # rustc stashes intermediary files in TMPDIR (default /tmp) which # might cause issues for users that for some reason space limit # their /tmp. WRKDIR should have plenty of space. # ?= to allow users to still overwrite it in make.conf. TMPDIR?= ${WRKDIR} OPTIONS_DEFINE= DOCS GDB LTO PORT_LLVM SOURCES WASM OPTIONS_DEFAULT= SOURCES WASM GDB_DESC= Install ports gdb (necessary for debugging rust programs) PORT_LLVM_DESC= Build against devel/llvm instead of bundled copy (experimental) SOURCES_DESC= Install source files WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown) DOCS_VARS= _RUST_BUILD_DOCS=true \ _COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" \ _RUST_TOOLS+=rustdoc DOCS_VARS_OFF= _RUST_BUILD_DOCS=false GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb PORT_LLVM_USES= llvm:min=17,lib,noexport PORT_LLVM_MAKE_ENV= RUSTFLAGS="-Lnative=${LOCALBASE}/lib" SOURCES_VARS= _COMPONENTS+=rust-src-${_PACKAGE_VERS} \ _RUST_TOOLS+=src WASM_VARS= _COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown" \ _RUST_TARGETS+=wasm32-unknown-unknown -# See WRKSRC/src/stage0.json for the date and version values +# See WRKSRC/src/stage0 for the date and version values BOOTSTRAPS_DATE?= 2024-08-08 RUST_BOOTSTRAP_VERSION?= 1.80.0 CARGO_VENDOR_DIR?= ${WRKSRC}/vendor # Rust's target arch string might be different from *BSD arch strings _RUST_ARCH_amd64= x86_64 _RUST_ARCH_i386= i686 _RUST_ARCH_riscv64= riscv64gc _RUST_TARGET= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} _RUST_TARGETS= ${_RUST_TARGET} _RUST_TOOLS= analysis cargo clippy rust-analyzer rustdoc rustfmt _RUSTC_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rustc-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET} _RUST_STD_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rust-std-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET} _CARGO_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/cargo-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET} _PACKAGE_VERS= ${NIGHTLY_DATE:?nightly:${PORTVERSION}} _COMPONENTS+= cargo-${_PACKAGE_VERS}-${_RUST_TARGET} \ clippy-${_PACKAGE_VERS}-${_RUST_TARGET} \ rustc-${_PACKAGE_VERS}-${_RUST_TARGET} \ rustfmt-${_PACKAGE_VERS}-${_RUST_TARGET} \ rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \ rust-std-${_PACKAGE_VERS}-${_RUST_TARGET} .include .if ${OPSYS} != FreeBSD IGNORE= is only for FreeBSD .endif .if ${ARCH} == powerpc LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT} MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}" .endif # rls doesn't build on rust nightly .if !defined(NIGHTLY_DATE) _RUST_TOOLS+= rls _COMPONENTS+= rls-${_PACKAGE_VERS}-${_RUST_TARGET} .endif .if ${ARCH} != powerpc64le MAKE_ENV+= RUST_BACKTRACE=1 .endif # per https://rust-lang.github.io/rustup/concepts/components.html # rustc-dev is only usefull on nightly .if defined(NIGHTLY_DATE) _COMPONENTS+= rustc-dev-${_PACKAGE_VERS}-${_RUST_TARGET} .endif .if ${PORT_OPTIONS:MWASM} && ${PORT_OPTIONS:MDOCS} _COMPONENTS+= rust-docs-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-docs-json-${_PACKAGE_VERS}-wasm32-unknown-unknown .endif .if exists(${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}) EXTRA_PATCHES+= ${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX} .endif .ifdef QEMU_EMULATING IGNORE= fails to build with qemu-user-static .endif .if make(makesum) DISTFILES:= ${DISTFILES:M*\:src} \ ${ONLY_FOR_ARCHS:O:@_arch@${:!${MAKE} ARCH=${_arch} -V'DISTFILES:N*\:src'!}@} .endif post-patch: @${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb .if defined(NIGHTLY_DATE) - @${REINPLACE_CMD} 's/"rustfmt"/"nothx"/' ${WRKSRC}/src/stage0.json + @${REINPLACE_CMD} 's/rustfmt/nothx/' ${WRKSRC}/src/stage0 .endif # Disable vendor checksums @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ ${CARGO_VENDOR_DIR}/*/.cargo-checksum.json post-patch-PORT_LLVM-on: # WASM target hardcodes bundled lld @${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_VERSION}"|' \ ${WRKSRC}/compiler/rustc_target/src/spec/base/wasm.rs do-configure: # Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 @${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ ${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh .for _component in cargo rust-std rustc @cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \ ${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose .endfor @${ECHO_CMD} '[build]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'build-dir="${WRKDIR}/_build"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'build-stage=2' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'doc-stage=2' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'test-stage=2' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml .if defined(NIGHTLY_DATE) @${ECHO_CMD} 'profiler=true' >> ${WRKSRC}/config.toml .endif @${ECHO_CMD} 'target=[${_RUST_TARGETS:@.target.@"${.target.}"@:ts,}]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'cargo="${WRKDIR}/bootstrap/bin/cargo"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'rustc="${WRKDIR}/bootstrap/bin/rustc"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'tools=[${_RUST_TOOLS:@.tool.@"${.tool.}"@:ts,}]' >> ${WRKSRC}/config.toml @${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml @${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'channel="${PKGNAMESUFFIX:Ustable:S/^-//}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml .if ${PORT_OPTIONS:MWASM} && !${PORT_OPTIONS:MPORT_LLVM} @${ECHO_CMD} 'lld=true' >> ${WRKSRC}/config.toml .else @${ECHO_CMD} 'lld=false' >> ${WRKSRC}/config.toml .endif .if ${PORT_OPTIONS:MLTO} @${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml .endif @${ECHO_CMD} 'remap-debuginfo=true' >> ${WRKSRC}/config.toml @${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml +.if defined(NIGHTLY_DATE) + @${ECHO_CMD} 'download-ci-llvm = false' >> ${WRKSRC}/config.toml +.endif .if ${PORT_OPTIONS:MLTO} @${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml .endif .if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE) @${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml .else @${ECHO_CMD} 'ccache=false' >> ${WRKSRC}/config.toml .endif @${ECHO_CMD} 'ninja=true' >> ${WRKSRC}/config.toml .if ${ARCH} == powerpc # Rust doesn't call the system compiler with the full version of the target. # This makes powerpc miscompile due to the secure-plt ABI change. # Additionally, force using ld.bfd to work around a linking problem in rustc_mir @${PRINTF} '#!/bin/sh\nexec ${CC} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cc-wrapper @${CHMOD} +x ${WRKDIR}/cc-wrapper @${PRINTF} '#!/bin/sh\nexec ${CXX} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cxx-wrapper @${CHMOD} +x ${WRKDIR}/cxx-wrapper .endif .for _target in ${_RUST_TARGETS} @${ECHO_CMD} '[target.${_target}]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'ar="${AR}"' >> ${WRKSRC}/config.toml .if ${ARCH} == powerpc @${ECHO_CMD} 'cc="${WRKDIR}/cc-wrapper"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'cxx="${WRKDIR}/cxx-wrapper"' >> ${WRKSRC}/config.toml .else @${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml .endif @${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml .if ${PORT_OPTIONS:MPORT_LLVM} @${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/${LLVM_CONFIG}"' >> ${WRKSRC}/config.toml .endif .endfor @${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml -.if defined(NIGHTLY_DATE) -# Don't abort if optional tools fail to build - @${ECHO_CMD} 'missing-tools=true' >> ${WRKSRC}/config.toml -.endif do-build: @cd ${WRKSRC} && \ ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER} do-install: ${RM} -r ${WRKDIR}/_extractdist .for _c in ${_COMPONENTS} ${MKDIR} ${WRKDIR}/_extractdist ${TAR} xf ${WRKDIR}/_build/dist/${_c}.tar.xz -C ${WRKDIR}/_extractdist cd ${WRKDIR}/_extractdist/${_c} && \ ${SH} install.sh \ --docdir="${STAGEDIR}${DOCSDIR}" \ --mandir="${STAGEDIR}${PREFIX}/share/man" \ --prefix="${STAGEDIR}${PREFIX}" ${RM} -r ${WRKDIR}/_extractdist .endfor # We autogenerate the plist file. We do that, instead of the # regular pkg-plist, because several libraries have a computed # filename based on the absolute path of the source files. As it # is user-specific, we cannot know their filename in advance. @${RM} ${STAGEDIR}${DOCSDIR}/*.old \ ${STAGEDIR}${PREFIX}/lib/rustlib/components \ ${STAGEDIR}${PREFIX}/lib/rustlib/install.log \ ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-* \ ${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \ ${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh @${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/lib \ ${STAGEDIR}${PREFIX}/libexec -exec ${FILE} -i {} + | \ ${AWK} -F: '/executable|sharedlib/ { print $$1 }' | ${XARGS} ${STRIP_CMD} @${FIND} ${STAGEDIR}${PREFIX} -not -type d | \ ${SED} -E -e 's,^${STAGEDIR}${PREFIX}/,,' \ -e 's,(share/man/man[1-9]/.*\.[0-9]),\1.gz,' >> ${TMPPLIST} post-install-DOCS-on: # Ignore any left behind empty directories in case some docs fail # to build (failures are ignored due to deny-warnings=false). @${FIND} ${STAGEDIR}${DOCSDIR}/html -empty -type d | \ ${SED} 's,^${STAGEDIR},@comment @dir ,' >> ${TMPPLIST} post-install-SOURCES-on: # Silence stage-qa warnings by sanitizing permissions on sources @${FIND} ${STAGEDIR}${PREFIX}/lib/rustlib/src -type f -exec ${CHMOD} \ ${SHAREMODE} {} + # Note that make test does not work when rust is already installed. do-test: @cd ${WRKSRC} && \ ${SETENV} ${TEST_ENV} ${PYTHON_CMD} x.py test --jobs=${MAKE_JOBS_NUMBER} .include