Changeset View
Changeset View
Standalone View
Standalone View
lang/rust/Makefile
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
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 | ||||
_RUST_ARCH_amd64= x86_64 | _RUST_ARCH_amd64= x86_64 | ||||
_RUST_ARCH_i386= i686 | _RUST_ARCH_i386= i686 | ||||
_RUST_TARGET= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} | _RUST_TARGET= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} | ||||
_RUST_TARGETS= ${_RUST_TARGET} | _RUST_TARGETS= ${_RUST_TARGET} | ||||
_RUST_TOOLS= analysis cargo clippy rls rustfmt | _RUST_TOOLS= analysis cargo clippy | ||||
_RUSTC_BOOTSTRAP= ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rustc-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET} | _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} | _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} | _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} \ | |||||
rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \ | |||||
rust-std-${_PACKAGE_VERS}-${_RUST_TARGET} | |||||
.include <bsd.port.pre.mk> | .include <bsd.port.pre.mk> | ||||
# rls and rustfmt don't build on nightly | |||||
.if !defined(NIGHTLY_DATE) | |||||
_RUST_TOOLS+= rls rustfmt | |||||
_COMPONENTS+= rls-${PORTVERSION}-${_RUST_TARGET} \ | |||||
rustfmt-${PORTVERSION}-${_RUST_TARGET} | |||||
.endif | |||||
.if ${PORT_OPTIONS:MSOURCES} | |||||
_COMPONENTS+= rust-src-${_PACKAGE_VERS} | |||||
.endif | |||||
.if ${PORT_OPTIONS:MWASM} | |||||
_COMPONENTS+= rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown \ | |||||
rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown | |||||
.endif | |||||
.if exists(${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}) | .if exists(${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}) | ||||
EXTRA_PATCHES+= ${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX} | EXTRA_PATCHES+= ${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX} | ||||
.endif | .endif | ||||
.if defined(PPC_ABI) && ${PPC_ABI} == ELFv1 | .if defined(PPC_ABI) && ${PPC_ABI} == ELFv1 | ||||
# The bootstrap is hardcoded to use gcc9 | # The bootstrap is hardcoded to use gcc9 | ||||
# but we can build with a newer or older compiler as provided by USE_GCC=yes | # but we can build with a newer or older compiler as provided by USE_GCC=yes | ||||
BUILD_DEPENDS+= gcc9:lang/gcc9 | BUILD_DEPENDS+= gcc9:lang/gcc9 | ||||
USE_GCC= yes | USE_GCC= yes | ||||
.endif | .endif | ||||
.if ${ARCH} == aarch64 && ${OSVERSION} < 1200502 | # remove when 11.4 is EOL | ||||
IGNORE= fails to run due to a bug in rtld, update to 12-STABLE r342847 or 13-CURRENT r342113 | .if ${ARCH} == aarch64 && ${OSVERSION} < 1202000 | ||||
IGNORE= fails to run due to a bug in rtld, update to 12.2-RELEASE or newer | |||||
.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 | ||||
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} '/^rustfmt:/d' ${WRKSRC}/src/stage0.txt | @${REINPLACE_CMD} '/^rustfmt:/d' ${WRKSRC}/src/stage0.txt | ||||
.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 | ||||
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 \ | ${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose | ||||
--verbose | |||||
.endfor | .endfor | ||||
@${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml | @${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml | ||||
@${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml | @${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml | ||||
.if defined(NIGHTLY_DATE) | .if defined(NIGHTLY_DATE) | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | @${REINPLACE_CMD} 's,%CC%,${CC},g' \ | ||||
${WRKSRC}/src/bootstrap/native.rs | ${WRKSRC}/src/bootstrap/native.rs | ||||
# this reinplace_cmd is used for ppc64-elfv1, don't remove it | # this reinplace_cmd is used for ppc64-elfv1, don't remove it | ||||
# even if sed_checked.sh says it's unused | # even if sed_checked.sh says it's unused | ||||
@${REINPLACE_CMD} 's,%CC%,${CC},g' \ | @${REINPLACE_CMD} 's,%CC%,${CC},g' \ | ||||
${WRKSRC}/compiler/rustc_llvm/build.rs | ${WRKSRC}/compiler/rustc_llvm/build.rs | ||||
do-build: | do-build: | ||||
@cd ${WRKSRC} && \ | @cd ${WRKSRC} && \ | ||||
${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py build --jobs=${MAKE_JOBS_NUMBER} | ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER} \ | ||||
library/std src/librustc ${_RUST_TOOLS} | |||||
do-install: | do-install: | ||||
@cd ${WRKSRC} && \ | ${MKDIR} ${WRKSRC}/_extractdist | ||||
${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py install --jobs=${MAKE_JOBS_NUMBER} | .for _c in ${_COMPONENTS} | ||||
${RM} -r ${WRKSRC}/_extractdist/* | |||||
${TAR} xf ${WRKSRC}/build/dist/${_c}.tar.xz -C ${WRKSRC}/_extractdist | |||||
cd ${WRKSRC}/_extractdist/${_c} && \ | |||||
${SH} install.sh \ | |||||
--docdir="${STAGEDIR}${DOCSDIR}" \ | |||||
--mandir="${STAGEDIR}${PREFIX}/share/man" \ | |||||
--prefix="${STAGEDIR}${PREFIX}" | |||||
.endfor | |||||
# We autogenerate the plist file. We do that, instead of the | # We autogenerate the plist file. We do that, instead of the | ||||
# regular pkg-plist, because several libraries have a computed | # regular pkg-plist, because several libraries have a computed | ||||
# filename based on the absolute path of the source files. As it | # filename based on the absolute path of the source files. As it | ||||
# is user-specific, we cannot know their filename in advance. | # is user-specific, we cannot know their filename in advance. | ||||
@${RM} -r ${STAGEDIR}${DOCSDIR}/*.old \ | @${RM} ${STAGEDIR}${DOCSDIR}/*.old \ | ||||
${STAGEDIR}${DOCSDIR}/html/.lock \ | |||||
${STAGEDIR}${DOCSDIR}/html/.stamp \ | |||||
${STAGEDIR}${PREFIX}/lib/rustlib/install.log \ | ${STAGEDIR}${PREFIX}/lib/rustlib/install.log \ | ||||
${STAGEDIR}${PREFIX}/lib/rustlib/manifest-* \ | ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-* \ | ||||
${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh | ${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh | ||||
@${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/lib -exec ${FILE} -i {} + | \ | @${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/lib -exec ${FILE} -i {} + | \ | ||||
${AWK} -F: '/executable|sharedlib/ { print $$1 }' | ${XARGS} ${STRIP_CMD} | ${AWK} -F: '/executable|sharedlib/ { print $$1 }' | ${XARGS} ${STRIP_CMD} | ||||
@${FIND} ${STAGEDIR}${PREFIX} -not -type d | \ | @${FIND} ${STAGEDIR}${PREFIX} -not -type d | \ | ||||
${SED} -E -e 's,^${STAGEDIR}${PREFIX}/,,' \ | ${SED} -E -e 's,^${STAGEDIR}${PREFIX}/,,' \ | ||||
-e 's,(share/man/man[1-9]/.*\.[0-9]),\1.gz,' >> ${TMPPLIST} | -e 's,(share/man/man[1-9]/.*\.[0-9]),\1.gz,' >> ${TMPPLIST} | ||||
Show All 29 Lines |