Page MenuHomeFreeBSD

D32654.id97774.diff
No OneTemporary

D32654.id97774.diff

diff --git a/lang/rust/Makefile b/lang/rust/Makefile
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -50,17 +50,22 @@
# ?= to allow users to still overwrite it in make.conf.
TMPDIR?= ${WRKDIR}
-OPTIONS_DEFINE= DOCS GDB SOURCES WASM
+OPTIONS_DEFINE= DOCS GDB PORT_LLVM SOURCES WASM
OPTIONS_DEFAULT= SOURCES WASM
OPTIONS_EXCLUDE_armv6= DOCS
GDB_DESC= Install ports gdb (necessary for debugging rust programs)
+PORT_LLVM_DESC= Build against devel/llvm${LLVM_VER} (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_VER= 13 # chase bundled LLVM
+PORT_LLVM_BUILD_DEPENDS=llvm-config${LLVM_VER}:devel/llvm${LLVM_VER}
+PORT_LLVM_LIB_DEPENDS= libLLVM-${LLVM_VER}.so:devel/llvm${LLVM_VER}
+PORT_LLVM_MAKE_ENV= RUSTFLAGS="-Lnative=${LOCALBASE}/lib"
SOURCES_VARS= _RUST_TOOLS+=src
WASM_VARS= _RUST_BUILD_WASM=true \
_RUST_TARGETS+=wasm32-unknown-unknown
@@ -156,6 +161,17 @@
.endif
.endif
+post-patch-PORT_LLVM-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_VER}"|' \
+ ${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}" \
@@ -189,7 +205,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:MPORT_LLVM}
@${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
@@ -223,6 +241,9 @@
.else
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
.endif
+.if ${PORT_OPTIONS:MPORT_LLVM}
+ @${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/llvm-config${LLVM_VER}"' >> ${WRKSRC}/config.toml
+.endif
.endfor
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 8, 1:54 AM (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31065383
Default Alt Text
D32654.id97774.diff (2 KB)

Event Timeline