diff --git a/lang/rust-nightly/Makefile b/lang/rust-nightly/Makefile index 3d0c2fa874f6..c00f57552769 100644 --- a/lang/rust-nightly/Makefile +++ b/lang/rust-nightly/Makefile @@ -1,25 +1,21 @@ # Run update.sh to update to the latest nightly PORTVERSION= 1.91.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 rust188 MASTERDIR= ${.CURDIR}/../rust PATCHDIR= ${.CURDIR}/files DISTINFO_FILE= ${.CURDIR}/distinfo -NIGHTLY_DATE= 2025-08-05 -BOOTSTRAPS_DATE= 2025-06-24 +NIGHTLY_DATE= 2025-09-07 +BOOTSTRAPS_DATE= 2025-08-05 RUST_BOOTSTRAP_VERSION= beta -post-configure: - # remove after bootstraps are updated to version higher than 2025-07-27 - @${REINPLACE_CMD} -e '/ccache=/d' ${WRKSRC}/config.toml - .include "${MASTERDIR}/Makefile" diff --git a/lang/rust-nightly/distinfo b/lang/rust-nightly/distinfo index 8dbff4c87479..e764885b3c55 100644 --- a/lang/rust-nightly/distinfo +++ b/lang/rust-nightly/distinfo @@ -1,9 +1,9 @@ -TIMESTAMP = 1754482083 -SHA256 (rust/2025-08-05/rustc-nightly-src.tar.xz) = 428963a5586248c0f088dff1dda048060b447c2bf187ca2326b62af47c80f9fc -SIZE (rust/2025-08-05/rustc-nightly-src.tar.xz) = 272353928 -SHA256 (rust/2025-06-24/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 71e9e3a1d1f5e8dc98403c2a6695c969908ba0cde594c4e20249fe81b67d62d1 -SIZE (rust/2025-06-24/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 88377504 -SHA256 (rust/2025-06-24/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 7cc4adb3c102eac53916b28c0dad40bd095e19ea3fd0430e84a2e0b094445809 -SIZE (rust/2025-06-24/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 28253396 -SHA256 (rust/2025-06-24/cargo-beta-x86_64-unknown-freebsd.tar.xz) = be762a368c6dfbe47a0f8c4b09cea1755a6d311f713b57b57a87276c88e5c34d -SIZE (rust/2025-06-24/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 10790116 +TIMESTAMP = 1757341820 +SHA256 (rust/2025-09-07/rustc-nightly-src.tar.xz) = b2e82674b09400cce62f8b8b6c16c09dc0cd035f1577dc270bcc713872763943 +SIZE (rust/2025-09-07/rustc-nightly-src.tar.xz) = 284060052 +SHA256 (rust/2025-08-05/rustc-beta-x86_64-unknown-freebsd.tar.xz) = cdfe207645068b4659b0f979cae177723c5f211084f45ae9180b2d93ee83fce6 +SIZE (rust/2025-08-05/rustc-beta-x86_64-unknown-freebsd.tar.xz) = 87833828 +SHA256 (rust/2025-08-05/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = bd48292b8582167a5e89ebe521c9754495403968c184b925df8b2ec1da344fc3 +SIZE (rust/2025-08-05/rust-std-beta-x86_64-unknown-freebsd.tar.xz) = 30795804 +SHA256 (rust/2025-08-05/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 11e1a51740a728f5825364a8679b28454a68e7efc96320730f9b58a8fc2e6fae +SIZE (rust/2025-08-05/cargo-beta-x86_64-unknown-freebsd.tar.xz) = 11419484 diff --git a/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs b/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs index 6d7f6d612496..8953ab44bbf2 100644 --- a/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs +++ b/lang/rust-nightly/files/patch-src_bootstrap_src_core_build__steps_install.rs @@ -1,17 +1,19 @@ Only install docs for the host target It otherwise wastes significant time (there are a lot of individual files) and stages host docs, wasm docs, which unstages the host docs first. ---- src/bootstrap/src/core/build_steps/install.rs.orig 2022-05-01 20:28:31 UTC +XXX: Shouldn't we instead just avoid adding docs-*-wasm* to _COMPONENTS in lang/rust/Makefile? + +--- src/bootstrap/src/core/build_steps/install.rs.orig 2025-08-24 19:46:17 UTC +++ src/bootstrap/src/core/build_steps/install.rs -@@ -138,7 +138,7 @@ macro_rules! install { +@@ -206,7 +206,7 @@ install!((self, builder, _config), } install!((self, builder, _config), -- Docs, path = "src/doc", _config.docs, only_hosts: false, { -+ Docs, path = "src/doc", _config.docs, only_hosts: true, { +- Docs, path = "src/doc", _config.docs, IS_HOST: false, { ++ Docs, path = "src/doc", _config.docs, IS_HOST: true, { let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs"); install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball); }; diff --git a/lang/rust-nightly/files/patch-src_bootstrap_src_core_config_config.rs b/lang/rust-nightly/files/patch-src_bootstrap_src_core_config_config.rs index a556833eed1e..4b024680070c 100644 --- a/lang/rust-nightly/files/patch-src_bootstrap_src_core_config_config.rs +++ b/lang/rust-nightly/files/patch-src_bootstrap_src_core_config_config.rs @@ -1,14 +1,14 @@ ---- src/bootstrap/src/core/config/config.rs.orig 2025-06-08 20:17:28 UTC +--- src/bootstrap/src/core/config/config.rs.orig 2025-08-24 19:46:17 UTC +++ src/bootstrap/src/core/config/config.rs -@@ -1459,9 +1459,9 @@ impl Config { - || source_version.minor == stage0_version.minor + 1))) - { - let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); -- fail(&format!( -+ eprintln!( - "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}" -- )); -+ ); - } +@@ -1991,9 +1991,9 @@ pub fn check_stage0_version( + || source_version.minor == stage0_version.minor + 1))) + { + let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); +- fail(&format!( ++ eprintln!( + "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}" +- )); ++ ); } + } diff --git a/lang/rust-nightly/files/patch-src_bootstrap_src_core_sanity.rs b/lang/rust-nightly/files/patch-src_bootstrap_src_core_sanity.rs new file mode 100644 index 000000000000..9504f4a16f94 --- /dev/null +++ b/lang/rust-nightly/files/patch-src_bootstrap_src_core_sanity.rs @@ -0,0 +1,23 @@ +XXX: cc_tool is Gnu here because of patch-vendor_cc.rs. We need to seek need better solution. + +--- src/bootstrap/src/core/sanity.rs.orig 2025-09-06 18:37:35 UTC ++++ src/bootstrap/src/core/sanity.rs +@@ -338,12 +338,12 @@ than building it. + let cc_tool = build.cc_tool(*target); + if !cc_tool.is_like_clang() && !cc_tool.path().ends_with("emcc") { + // emcc works as well +- panic!( +- "Clang is required to build C code for Wasm targets, got `{}` instead\n\ +- this is because compiler-builtins is configured to build C source. Either \ +- ensure Clang is used, or adjust this configuration.", +- cc_tool.path().display() +- ); ++ //panic!( ++ // "Clang is required to build C code for Wasm targets, got `{}` instead\n\ ++ // this is because compiler-builtins is configured to build C source. Either \ ++ // ensure Clang is used, or adjust this configuration.", ++ // cc_tool.path().display() ++ //); + } + } + diff --git a/lang/rust-nightly/files/patch-vendor_cc.rs b/lang/rust-nightly/files/patch-vendor_cc.rs index 11682cd5f1f6..377f1a9346db 100644 --- a/lang/rust-nightly/files/patch-vendor_cc.rs +++ b/lang/rust-nightly/files/patch-vendor_cc.rs @@ -1,140 +1,140 @@ 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.1.18/src/tool.rs.orig 2025-06-08 20:17:28 UTC +++ vendor/cc-1.1.18/src/tool.rs @@ -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"); --- vendor/cc-1.2.0/src/tool.rs.orig 2024-12-10 13:16:09 UTC +++ vendor/cc-1.2.0/src/tool.rs @@ -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"); --- vendor/cc-1.2.13/src/tool.rs.orig 2025-04-01 18:22:03 UTC +++ vendor/cc-1.2.13/src/tool.rs @@ -141,9 +141,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"); --- vendor/cc-1.2.16/src/tool.rs.orig 2025-04-01 18:22:03 UTC +++ vendor/cc-1.2.16/src/tool.rs @@ -141,9 +141,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"); --- vendor/cc-1.2.19/src/tool.rs.orig 2025-04-01 18:22:03 UTC +++ vendor/cc-1.2.19/src/tool.rs @@ -141,9 +141,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"); --- vendor/cc-1.2.20/src/tool.rs.orig 2025-04-01 18:22:03 UTC +++ vendor/cc-1.2.20/src/tool.rs @@ -141,9 +141,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"); ---- vendor/cc-1.2.23/src/tool.rs.orig 2025-04-01 18:22:03 UTC -+++ vendor/cc-1.2.23/src/tool.rs +--- vendor/cc-1.2.26/src/tool.rs.orig 2025-04-01 18:22:03 UTC ++++ vendor/cc-1.2.26/src/tool.rs @@ -141,9 +141,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"); ---- vendor/cc-1.2.26/src/tool.rs.orig 2025-04-01 18:22:03 UTC -+++ vendor/cc-1.2.26/src/tool.rs +--- vendor/cc-1.2.28/src/tool.rs.orig 2025-04-01 18:22:03 UTC ++++ vendor/cc-1.2.28/src/tool.rs @@ -141,9 +141,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"); ---- vendor/cc-1.2.27/src/tool.rs.orig 2025-04-01 18:22:03 UTC -+++ vendor/cc-1.2.27/src/tool.rs +--- vendor/cc-1.2.33/src/tool.rs.orig 2025-04-01 18:22:03 UTC ++++ vendor/cc-1.2.33/src/tool.rs @@ -141,9 +141,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"); ---- vendor/cc-1.2.31/src/tool.rs.orig 2025-04-01 18:22:03 UTC -+++ vendor/cc-1.2.31/src/tool.rs +--- vendor/cc-1.2.35/src/tool.rs.orig 2025-04-01 18:22:03 UTC ++++ vendor/cc-1.2.35/src/tool.rs @@ -141,9 +141,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/Makefile b/lang/rust/Makefile index f4f9f1222023..fc9fbf3582f5 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -1,282 +1,284 @@ PORTNAME= rust PORTVERSION?= 1.89.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 rust188 # 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= DOCS SOURCES WASM OPTIONS_DEFINE_i386= SSE2 OPTIONS_DEFAULT_i386= SSE2 GDB_DESC= Install ports gdb (necessary for debugging rust programs) PORT_LLVM_DESC= Build against devel/llvm instead of bundled copy (experimental) SSE2_DESC= Enable SSE2 instructions SOURCES_DESC= Install source files WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown) SSE2_EXTRA_PATCHES_OFF+= ${FILESDIR}/extra-patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs DOCS_VARS= _RUST_BUILD_DOCS=true \ _COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" DOCS_VARS_OFF= _RUST_BUILD_DOCS=false GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb PORT_LLVM_USES= llvm:min=19,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 for the date and version values BOOTSTRAPS_DATE?= 2025-06-26 RUST_BOOTSTRAP_VERSION?= 1.88.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 .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} '/rustfmt/d' ${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 @${ECHO_CMD} 'download-rustc=false' >> ${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 @${ECHO_CMD} 'download-ci-llvm=false' >> ${WRKSRC}/config.toml .if ${PORT_OPTIONS:MLTO} @${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml .endif +.if !defined(PKGNAMESUFFIX) .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 .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 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