summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Li <vishwin@FreeBSD.org>2025-12-19 21:57:14 -0500
committerCharlie Li <vishwin@FreeBSD.org>2025-12-19 21:57:14 -0500
commit009e302df60f057f12c4c243da653d256fb3e3de (patch)
tree9f41039d3148ac40eb7b68a3d69080b411b62241
parentnet-mgmt/netdata: Update 2.8.1 => 2.8.4 (diff)
lang/rust: really fix WASM with PORT_LLVM
Bundled LLVM is never built when llvm-config is specified in config.toml, ie PORT_LLVM, and base system LLVM doesn't support wasm32-unknown-unknown triple. Restore the previous behaviour of using clang from the LLVM port when PORT_LLVM is enabled. Also really fix the ${LLVM_VERSION} logic, as the variable is from USES=llvm.
-rw-r--r--lang/rust/Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 2843e9e1bc0c..d77d89e0d15a 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -147,7 +147,7 @@ post-patch:
post-patch-PORT_LLVM-on:
# WASM target hardcodes bundled lld
- @${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${_LLVM_VERSION}"|' \
+ @${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_VERSION}"|' \
${WRKSRC}/compiler/rustc_target/src/spec/base/wasm.rs
do-configure:
@@ -224,11 +224,17 @@ do-configure:
@${ECHO_CMD} 'cxx="${WRKDIR}/cxx-wrapper"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
.else
-# use the builtin clang
+# use the builtin clang when not using PORT_LLVM
.if ${_target} == "wasm32-unknown-unknown"
+.if ${PORT_OPTIONS:MPORT_LLVM}
+ @${ECHO_CMD} 'cc="${LOCALBASE}/bin/clang${LLVM_VERSION}"' >> ${WRKSRC}/config.toml
+ @${ECHO_CMD} 'cxx="${LOCALBASE}/bin/clang++${LLVM_VERSION}"' >> ${WRKSRC}/config.toml
+ @${ECHO_CMD} 'linker="${LOCALBASE}/bin/clang${LLVM_VERSION}"' >> ${WRKSRC}/config.toml
+.else
@${ECHO_CMD} 'cc="${WRKDIR}/_build/${_RUST_TARGET}/llvm/bin/clang"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cxx="${WRKDIR}/_build/${_RUST_TARGET}/llvm/bin/clang++"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'linker="${WRKDIR}/_build/${_RUST_TARGET}/llvm/bin/clang"' >> ${WRKSRC}/config.toml
+.endif
.else
@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml