Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150417203
D32654.1792339639.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D32654.1792339639.diff
View Options
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -49,19 +49,23 @@
# ?= to allow users to still overwrite it in make.conf.
TMPDIR?= ${WRKDIR}
-OPTIONS_DEFINE= DOCS GDB SOURCES WASM
+OPTIONS_DEFINE= DOCS GDB LLVM_PORT SOURCES WASM
OPTIONS_DEFAULT= SOURCES WASM
.if !defined(NIGHTLY_DATE)
OPTIONS_EXCLUDE= DOCS # https://github.com/rust-lang/rust/issues/76526
.endif
GDB_DESC= Install ports gdb (necessary for debugging rust programs)
+LLVM_PORT_DESC= Build against devel/llvm${LLVM_DEFAULT} (experimental)
SOURCES_DESC= Install source files
WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown)
DOCS_VARS= _RUST_BUILD_DOCS=true
DOCS_VARS_OFF= _RUST_BUILD_DOCS=false
GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb
+LLVM_PORT_BUILD_DEPENDS=llvm-config${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT} \
+ ${LOCALBASE}/llvm${LLVM_DEFAULT}/lib/libLLVMCodeGen.a:devel/llvm${LLVM_DEFAULT}
+LLVM_PORT_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" \
@@ -159,6 +163,15 @@
STRIP_CMD= ${LOCALBASE}/bin/strip # unsupported e_type with base strip
.endif
+# Ignore Mk/bsd.default-versions.mk but respect make.conf(5)
+.if !defined(DEFAULT_VERSIONS) || ! ${DEFAULT_VERSIONS:Mllvm*}
+LLVM_DEFAULT= 14 # chase bundled LLVM
+.endif
+
+.if ${PORT_OPTIONS:MLLVM_PORT} && ${PORT_OPTIONS:MWASM}
+RUN_DEPENDS+= ${LOCALBASE}/bin/wasm-ld${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
+.endif
+
.ifdef QEMU_EMULATING
IGNORE= fails to build with qemu-user-static
.endif
@@ -188,6 +201,17 @@
.endif
.endif
+post-patch-LLVM_PORT-on:
+ # ld error: can't create dynamic relocation R_X86_64_32 against
+ # local symbol in readonly segment; recompile object files with
+ # -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+ # (-no-pie is not needed when both base and ports were built as PIE)
+ ${REINPLACE_CMD} 's|"-pie"|"-no-pie"|' \
+ ${WRKSRC}/compiler/rustc_codegen_ssa/src/back/linker.rs
+ # WASM target hardcodes bundled lld
+ ${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_DEFAULT}"|' \
+ ${WRKSRC}/compiler/rustc_target/src/spec/wasm_base.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}" \
@@ -222,7 +246,9 @@
@${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:MLLVM_PORT}
@${ECHO_CMD} 'lld=${_RUST_BUILD_WASM}' >> ${WRKSRC}/config.toml
+.endif
@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
@${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
@@ -256,6 +282,9 @@
.else
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
.endif
+.if ${PORT_OPTIONS:MLLVM_PORT}
+ @${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/llvm-config${LLVM_DEFAULT}"' >> ${WRKSRC}/config.toml
+.endif
.endfor
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 18, 4:07 PM (4 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30498531
Default Alt Text
D32654.1792339639.diff (3 KB)
Attached To
Mode
D32654: lang/rust: restore PORT_LLVM
Attached
Detach File
Event Timeline
Log In to Comment