Index: Mk/Uses/cargo.mk =================================================================== --- Mk/Uses/cargo.mk +++ Mk/Uses/cargo.mk @@ -247,6 +247,16 @@ # configure hook. Place a config file for overriding crates-io index # by local source directory. cargo-configure: +. if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200000 +# Sanity check that the running kernel was built with the necessary +# syscall compat option. + @${PRINTF} '#include \n#include \n#include \n\ + int main(void) { return syscall(SYS_freebsd11_mknod, "", 0, 0) < 0 && errno == ENOSYS; }' | \ + ${CC} -o ${WRKDIR}/compat11_canary -xc - && ${WRKDIR}/compat11_canary || (\ + ${ECHO_MSG} "=> Sanity check failed: kernel is missing COMPAT_FREEBSD11"; \ + ${ECHO_MSG} "=> Aborting build"; \ + ${FALSE}) +. endif @${MKDIR} ${WRKDIR}/.cargo @${ECHO_CMD} "[source.cargo]" > ${WRKDIR}/.cargo/config @${ECHO_CMD} "directory = '${CARGO_VENDOR_DIR}'" >> ${WRKDIR}/.cargo/config Index: Mk/bsd.gecko.mk =================================================================== --- Mk/bsd.gecko.mk +++ Mk/bsd.gecko.mk @@ -376,6 +376,18 @@ @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ ${MOZSRC}/third_party/rust/*/.cargo-checksum.json +.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200000 +pre-configure-script: +# Sanity check that the running kernel was built with the necessary +# syscall compat option. + @${PRINTF} '#include \n#include \n#include \n\ + int main(void) { return syscall(SYS_freebsd11_mknod, "", 0, 0) < 0 && errno == ENOSYS; }' | \ + ${CC} -o ${WRKDIR}/compat11_canary -xc - && ${WRKDIR}/compat11_canary || (\ + ${ECHO_MSG} "=> Sanity check failed: kernel is missing COMPAT_FREEBSD11"; \ + ${ECHO_MSG} "=> Aborting build"; \ + ${FALSE}) +.endif + post-install-script: gecko-create-plist gecko-create-plist: Index: lang/rust/Makefile =================================================================== --- lang/rust/Makefile +++ lang/rust/Makefile @@ -142,6 +142,16 @@ ${WRKSRC}/src/bootstrap/install.rs do-configure: +# Sanity check that the running kernel was built with the necessary +# syscall compat option. +.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200000 + @${PRINTF} '#include \n#include \n#include \n\ + int main(void) { return syscall(SYS_freebsd11_mknod, "", 0, 0) < 0 && errno == ENOSYS; }' | \ + ${CC} -o ${WRKDIR}/compat11_canary -xc - && ${WRKDIR}/compat11_canary || (\ + ${ECHO_MSG} "=> Sanity check failed: kernel is missing COMPAT_FREEBSD11"; \ + ${ECHO_MSG} "=> Aborting build"; \ + ${FALSE}) +.endif @${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml @${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml