lang/rust: Add COMPAT_FREEBSD11 canary
This attempts to provide a nicer error message for the subset of users who build their own kernels without COMPAT_FREEBSD11 and then attempt to build lang/rust. The Rust ecosystem currently uses pre-ino64 syscalls, so building lang/rust without COMPAT_FREEBSD11 is not going to work. The error message for this is non-obvious and there is a new bug for this at least every 1-2 months. Hopefully this will improve the situation a little. Cargo and Gecko ports are similarly affected, so add the pre-build check to them too. Reviewed by: jbeich, mikael.urankar@gmail.com Tested by: madpilot (negative case) Approved by: gecko (jbeich) Differential Revision: https://reviews.freebsd.org/D23100
This commit is contained in:
parent
dd02c37293
commit
83096313be
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=522968
27
Mk/Scripts/rust-compat11-canary.sh
Normal file
27
Mk/Scripts/rust-compat11-canary.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# MAINTAINER: rust@FreeBSD.org
|
||||
# $FreeBSD$
|
||||
set -eu
|
||||
|
||||
if [ "${OPSYS}" != FreeBSD ] || [ "${OSVERSION}" -lt 1200000 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat <<EOF | ${CC} -o "${WRKDIR}/compat11_canary" -xc -
|
||||
#include <sys/syscall.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return syscall(SYS_freebsd11_mknod, "", 0, 0) < 0 && errno == ENOSYS;
|
||||
}
|
||||
EOF
|
||||
# Canary might be aborted with SIGSYS
|
||||
ulimit -c 0
|
||||
if ! "${WRKDIR}/compat11_canary"; then
|
||||
echo "=> Sanity check failed: kernel is missing COMPAT_FREEBSD11"
|
||||
echo "=> Aborting build"
|
||||
exit 1
|
||||
fi
|
@ -247,6 +247,9 @@ _USES_configure+= 250:cargo-configure
|
||||
# configure hook. Place a config file for overriding crates-io index
|
||||
# by local source directory.
|
||||
cargo-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
|
||||
@${MKDIR} ${WRKDIR}/.cargo
|
||||
@${ECHO_CMD} "[source.cargo]" > ${WRKDIR}/.cargo/config
|
||||
@${ECHO_CMD} "directory = '${CARGO_VENDOR_DIR}'" >> ${WRKDIR}/.cargo/config
|
||||
|
@ -376,6 +376,11 @@ gecko-post-patch:
|
||||
@${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \
|
||||
${MOZSRC}/third_party/rust/*/.cargo-checksum.json
|
||||
|
||||
pre-configure-script:
|
||||
# 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
|
||||
|
||||
post-install-script: gecko-create-plist
|
||||
|
||||
gecko-create-plist:
|
||||
|
@ -142,6 +142,9 @@ post-patch-SOURCES-off:
|
||||
${WRKSRC}/src/bootstrap/install.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}" \
|
||||
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
|
||||
@${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml
|
||||
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
|
||||
@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml
|
||||
|
Loading…
Reference in New Issue
Block a user