lang/rust: Let the framework extract the bootstraps

It is possible for lang/python37 to be built in such a way that it
installs an unloadable lzma module which then causes Rust to fallback
to trying to fetch/extract the tar.gz bootstraps instead.

As a workaround and since it also simplifies some things, let the
ports framework extract the bootstraps and "install" them under
WRKDIR.  We point the build to them in config.toml.  This is similar
to how things are hooked up in lang/rust-bootstrap and Rust will
then not try to fetch and extract the bootstraps on its own.

PR:		243766
Reviewed by:	mikael
Differential Revision:	https://reviews.freebsd.org/D24582
This commit is contained in:
Tobias Kortkamp 2020-04-28 04:33:35 +00:00
parent ff95133ab4
commit 5b8c9933be
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=533234

View File

@ -14,7 +14,6 @@ DISTFILES?= ${NIGHTLY_DATE:D${NIGHTLY_DATE}/}${DISTNAME}${EXTRACT_SUFX}:src \
${_RUST_STD_BOOTSTRAP}${BOOTSTRAPS_SUFFIX}${EXTRACT_SUFX}:bootstrap \
${_CARGO_BOOTSTRAP}${BOOTSTRAPS_SUFFIX}${EXTRACT_SUFX}:bootstrap
DIST_SUBDIR?= rust
EXTRACT_ONLY?= ${DISTFILES:N*\:bootstrap:C/:.*//}
MAINTAINER= rust@FreeBSD.org
COMMENT= Language with a focus on memory safety and concurrency
@ -100,29 +99,11 @@ IGNORE= fails to run due to a bug in rtld, update to 12-STABLE r342847 or 13-CUR
IGNORE= fails to build with qemu-user-static
.endif
post-extract:
@${MKDIR} ${WRKSRC}/build/cache/${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${_RUSTC_BOOTSTRAP}${BOOTSTRAPS_SUFFIX}${EXTRACT_SUFX} \
${WRKSRC}/build/cache/${_RUSTC_BOOTSTRAP}${EXTRACT_SUFX}
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${_RUST_STD_BOOTSTRAP}${BOOTSTRAPS_SUFFIX}${EXTRACT_SUFX} \
${WRKSRC}/build/cache/${_RUST_STD_BOOTSTRAP}${EXTRACT_SUFX}
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${_CARGO_BOOTSTRAP}${BOOTSTRAPS_SUFFIX}${EXTRACT_SUFX} \
${WRKSRC}/build/cache/${_CARGO_BOOTSTRAP}${EXTRACT_SUFX}
post-patch:
@${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb
@${ECHO_MSG} "Canonical bootstrap date and version before patching:"
@${GREP} -E '^(date|rustc|cargo)' ${WRKSRC}/src/stage0.txt
# If we override the versions and date of the bootstraps (for instance
# on aarch64 where we provide our own bootstraps), we need to update
# places where they are recorded.
@${REINPLACE_CMD} -e 's,^date:.*,date: ${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}},' \
-e 's,^rustc:.*,rustc: ${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}},' \
-e '/^rustfmt:/d' \
-e 's,^cargo:.*,cargo: ${CARGO_BOOTSTRAP_VERSION_${ARCH}:U${CARGO_BOOTSTRAP_VERSION}},' \
${WRKSRC}/src/stage0.txt
@${ECHO_MSG} "Bootstrap date and version after patching:"
@${GREP} -E '^(date|rustc|cargo)' ${WRKSRC}/src/stage0.txt
.if defined(NIGHTLY_DATE)
@${REINPLACE_CMD} '/^rustfmt:/d' ${WRKSRC}/src/stage0.txt
.endif
.if ${ARCH} == powerpc64
# Starting with 13.0 powerpc64 is ELFv2 while 12.0 is ELFv1. Pass the correct LLVM target triple.
@${REINPLACE_CMD} 's,powerpc64-unknown-freebsd,powerpc64-unknown-freebsd${OSREL},' \
@ -141,6 +122,11 @@ 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}" \
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
.for _component in cargo rust-std rustc
@cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \
${SH} install.sh --disable-ldconfig --prefix=${WRKDIR}/bootstrap \
--verbose
.endfor
@${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml
@ -148,6 +134,8 @@ do-configure:
@${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'target=[${_RUST_TARGETS:@.target.@"${.target.}"@:ts,}]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cargo="${WRKDIR}/bootstrap/bin/cargo"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'rustc="${WRKDIR}/bootstrap/bin/rustc"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml