Changeset View
Changeset View
Standalone View
Standalone View
lang/rust/Makefile
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
CONFLICTS_INSTALL?= rust-nightly | CONFLICTS_INSTALL?= rust-nightly | ||||
# rustc stashes intermediary files in TMPDIR (default /tmp) which | # rustc stashes intermediary files in TMPDIR (default /tmp) which | ||||
# might cause issues for users that for some reason space limit | # might cause issues for users that for some reason space limit | ||||
# their /tmp. WRKDIR should have plenty of space. | # their /tmp. WRKDIR should have plenty of space. | ||||
# ?= to allow users to still overwrite it in make.conf. | # ?= to allow users to still overwrite it in make.conf. | ||||
TMPDIR?= ${WRKDIR} | TMPDIR?= ${WRKDIR} | ||||
OPTIONS_DEFINE= DOCS GDB LTO SOURCES WASM | OPTIONS_DEFINE= DOCS GDB LTO PORT_LLVM SOURCES WASM | ||||
OPTIONS_DEFAULT= SOURCES WASM | OPTIONS_DEFAULT= SOURCES WASM | ||||
GDB_DESC= Install ports gdb (necessary for debugging rust programs) | 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 | SOURCES_DESC= Install source files | ||||
WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown) | WASM_DESC= Build the WebAssembly target (wasm32-unknown-unknown) | ||||
DOCS_VARS= _RUST_BUILD_DOCS=true \ | DOCS_VARS= _RUST_BUILD_DOCS=true \ | ||||
_COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" \ | _COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" \ | ||||
_RUST_TOOLS+=rustdoc | _RUST_TOOLS+=rustdoc | ||||
DOCS_VARS_OFF= _RUST_BUILD_DOCS=false | DOCS_VARS_OFF= _RUST_BUILD_DOCS=false | ||||
GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb | GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb | ||||
PORT_LLVM_USES= llvm:min=14,lib,noexport | |||||
PORT_LLVM_MAKE_ENV= RUSTFLAGS="-Lnative=${LOCALBASE}/lib" | |||||
SOURCES_VARS= _COMPONENTS+=rust-src-${_PACKAGE_VERS} \ | SOURCES_VARS= _COMPONENTS+=rust-src-${_PACKAGE_VERS} \ | ||||
_RUST_TOOLS+=src | _RUST_TOOLS+=src | ||||
WASM_VARS= _COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown" \ | WASM_VARS= _COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown" \ | ||||
tobik: PORT_LLVM_MAKE_ENV | |||||
_RUST_BUILD_WASM=true \ | |||||
_RUST_TARGETS+=wasm32-unknown-unknown | _RUST_TARGETS+=wasm32-unknown-unknown | ||||
WASM_VARS_OFF= _RUST_BUILD_WASM=false | |||||
# See WRKSRC/src/stage0.json for the date and version values | # See WRKSRC/src/stage0.json for the date and version values | ||||
BOOTSTRAPS_DATE?= 2023-07-13 | BOOTSTRAPS_DATE?= 2023-07-13 | ||||
RUST_BOOTSTRAP_VERSION?= 1.71.0 | RUST_BOOTSTRAP_VERSION?= 1.71.0 | ||||
CARGO_VENDOR_DIR?= ${WRKSRC}/vendor | CARGO_VENDOR_DIR?= ${WRKSRC}/vendor | ||||
# Rust's target arch string might be different from *BSD arch strings | # Rust's target arch string might be different from *BSD arch strings | ||||
Show All 13 Lines | _COMPONENTS+= cargo-${_PACKAGE_VERS}-${_RUST_TARGET} \ | ||||
clippy-${_PACKAGE_VERS}-${_RUST_TARGET} \ | clippy-${_PACKAGE_VERS}-${_RUST_TARGET} \ | ||||
rustc-${_PACKAGE_VERS}-${_RUST_TARGET} \ | rustc-${_PACKAGE_VERS}-${_RUST_TARGET} \ | ||||
rustfmt-${_PACKAGE_VERS}-${_RUST_TARGET} \ | rustfmt-${_PACKAGE_VERS}-${_RUST_TARGET} \ | ||||
rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \ | rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \ | ||||
rust-std-${_PACKAGE_VERS}-${_RUST_TARGET} | rust-std-${_PACKAGE_VERS}-${_RUST_TARGET} | ||||
.include <bsd.port.pre.mk> | .include <bsd.port.pre.mk> | ||||
.ifndef NIGHTLY_DATE | |||||
PATCH_SITES= https://github.com/rust-lang/rust/commit/ | |||||
# LLVM 17 API compatibility fixes | |||||
PATCHFILES= 71958da4854176c50a8b12470b956d5c7ed11817.patch:-p1 \ | |||||
6ddf9128b2b55f9def80af57f7353d2521527c6a.patch:-p1 | |||||
Not Done Inline ActionsThese are small patches. IMHO it's clearer if you just copy them to files/ tobik: These are small patches. IMHO it's clearer if you just copy them to `files/` | |||||
Done Inline ActionsNot only do these need to be applied before anything in ${PATCHDIR}, but these are incorporated in more recent nightlies and the just-released 1.73.0. vishwin: Not only do these need to be applied before anything in `${PATCHDIR}`, but these are… | |||||
.endif | |||||
.if ${OPSYS} != FreeBSD | .if ${OPSYS} != FreeBSD | ||||
IGNORE= is only for FreeBSD | IGNORE= is only for FreeBSD | ||||
.endif | .endif | ||||
.if ${ARCH} == powerpc | .if ${ARCH} == powerpc | ||||
LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT} | LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT} | ||||
MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}" | MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}" | ||||
.else | .else | ||||
Show All 33 Lines | |||||
.endif | .endif | ||||
.ifdef QEMU_EMULATING | .ifdef QEMU_EMULATING | ||||
IGNORE= fails to build with qemu-user-static | IGNORE= fails to build with qemu-user-static | ||||
.endif | .endif | ||||
.if make(makesum) | .if make(makesum) | ||||
DISTFILES:= ${DISTFILES:M*\:src} \ | DISTFILES:= ${DISTFILES:M*\:src} \ | ||||
${ONLY_FOR_ARCHS:O:@_arch@${:!${MAKE} ARCH=${_arch} -V'DISTFILES:N*\:src'!}@} | ${ONLY_FOR_ARCHS:O:@_arch@${:!${MAKE} ARCH=${_arch} -V'DISTFILES:N*\:src'!}@} | ||||
Done Inline Actionsmissing blank line tobik: missing blank line | |||||
.endif | .endif | ||||
post-patch: | post-patch: | ||||
@${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb | @${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb | ||||
.if defined(NIGHTLY_DATE) | .if defined(NIGHTLY_DATE) | ||||
@${REINPLACE_CMD} 's/"rustfmt"/"nothx"/' ${WRKSRC}/src/stage0.json | @${REINPLACE_CMD} 's/"rustfmt"/"nothx"/' ${WRKSRC}/src/stage0.json | ||||
.endif | .endif | ||||
# Disable vendor checksums | # Disable vendor checksums | ||||
@${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ | @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ | ||||
${CARGO_VENDOR_DIR}/*/.cargo-checksum.json | ${CARGO_VENDOR_DIR}/*/.cargo-checksum.json | ||||
post-patch-PORT_LLVM-on: | |||||
# WASM target hardcodes bundled lld | |||||
Done Inline ActionsCan you match the existing style (dedent comment and silence ${REINPLACE_CMD})? tobik: Can you match the existing style (dedent comment and silence ${REINPLACE_CMD})? | |||||
@${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_DEFAULT}"|' \ | |||||
${WRKSRC}/compiler/rustc_target/src/spec/wasm_base.rs | |||||
do-configure: | do-configure: | ||||
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 | # Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 | ||||
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ | @${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ | ||||
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh | ${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh | ||||
.for _component in cargo rust-std rustc | .for _component in cargo rust-std rustc | ||||
@cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \ | @cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \ | ||||
${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose | ${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose | ||||
.endfor | .endfor | ||||
Show All 18 Lines | .endif | ||||
@${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml | @${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml | @${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'channel="${PKGNAMESUFFIX:Ustable:S/^-//}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'channel="${PKGNAMESUFFIX:Ustable:S/^-//}"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'lld=${_RUST_BUILD_WASM}' >> ${WRKSRC}/config.toml | .if ${PORT_OPTIONS:MWASM} && !${PORT_OPTIONS:MPORT_LLVM} | ||||
@${ECHO_CMD} 'lld=true' >> ${WRKSRC}/config.toml | |||||
.else | |||||
Done Inline ActionsI don't think _RUST_BUILD_WASM is needed anymore. Why not make the conditional clearer with something like this .if ${PORT_OPTIONS:MWASM} && !${PORT_OPTIONS:MPORT_LLVM} @${ECHO_CMD} 'lld=true' >> ${WRKSRC}/config.toml .else @${ECHO_CMD} 'lld=false' >> ${WRKSRC}/config.toml .endif tobik: I don't think _RUST_BUILD_WASM is needed anymore. Why not make the conditional clearer with… | |||||
@${ECHO_CMD} 'lld=false' >> ${WRKSRC}/config.toml | |||||
.endif | |||||
.if ${PORT_OPTIONS:MLTO} | .if ${PORT_OPTIONS:MLTO} | ||||
@${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml | ||||
.endif | .endif | ||||
@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml | @${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml | ||||
.if ${PORT_OPTIONS:MLTO} | .if ${PORT_OPTIONS:MLTO} | ||||
@${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml | ||||
.endif | .endif | ||||
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE) | .if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE) | ||||
Show All 22 Lines | |||||
.else | .else | ||||
@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml | ||||
.endif | .endif | ||||
.if ${ARCH} == powerpc | .if ${ARCH} == powerpc | ||||
@${ECHO_CMD} 'linker="${WRKDIR}/ld-wrapper"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'linker="${WRKDIR}/ld-wrapper"' >> ${WRKSRC}/config.toml | ||||
.else | .else | ||||
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml | ||||
.endif | |||||
.if ${PORT_OPTIONS:MPORT_LLVM} | |||||
@${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/${LLVM_CONFIG}"' >> ${WRKSRC}/config.toml | |||||
.endif | .endif | ||||
.endfor | .endfor | ||||
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml | @${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml | ||||
.if defined(NIGHTLY_DATE) | .if defined(NIGHTLY_DATE) | ||||
# Don't abort if optional tools fail to build | # Don't abort if optional tools fail to build | ||||
@${ECHO_CMD} 'missing-tools=true' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'missing-tools=true' >> ${WRKSRC}/config.toml | ||||
.endif | .endif | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
PORT_LLVM_MAKE_ENV