freebsd-ports/Mk/Scripts/rust-compat11-canary.sh
Mathieu Arnold f916081e1c Add set pipefail in most framework scripts.
set pipefail changes the pipeline return status from being the return
status of the last command to the last non 0 exit status of any command
in the pipeline.  This is needed to make sure all the commands in a
pipeline did actually return a non 0 status and not only the last one.

PR:		250723
Exp-run by:	antoine
Reviewed by:	bapt
Approved by:	bapt
Differential Revision:	https://reviews.freebsd.org/D27007
2020-11-11 13:29:52 +00:00

28 lines
566 B
Bash

#!/bin/sh
# MAINTAINER: rust@FreeBSD.org
# $FreeBSD$
set -eu
set -o pipefail
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