pkgsrc/mk/misc/can-be-built-here.mk
rillig 363de64c50 mk/misc/can-be-built-here.mk: remove NOT_FOT_UNPRIVILEGED
It is unused, and its error message wrongly said "only for unprivileged",
which nobody complained about for 13 years.
2020-04-26 06:56:29 +00:00

174 lines
4.6 KiB
Makefile

# $NetBSD: can-be-built-here.mk,v 1.10 2020/04/26 06:56:29 rillig Exp $
#
# This file checks whether a package can be built in the current pkgsrc
# environment. It checks the following variables:
#
# * NOT_FOR_COMPILER, ONLY_FOR_COMPILER
# * NOT_FOR_PLATFORM, ONLY_FOR_PLATFORM
# * BROKEN_ON_PLATFORM, BROKEN_EXCEPT_ON_PLATFORM
# * NOT_FOR_BULK_PLATFORM
# * NOT_FOR_UNPRIVILEGED
# * PKG_FAIL_REASON, PKG_SKIP_REASON
#
# It also depends on the following internal variables:
#
# NO_SKIP
# When defined, the checks in this file are skipped. It is called
# NO_SKIP because the code that skips building the package should
# _not_ be run.
#
# XXX: It's weird to have three negations in such a short variable
# name.
#
# Keywords: compiler broken only platform
_CBBH_CHECKS= # none, but see below.
# Check NOT_FOR_COMPILER
_CBBH_CHECKS+= ncomp
_CBBH_MSGS.ncomp= "This package is not available for these compilers: "${NOT_FOR_COMPILER:Q}"."
_CBBH.ncomp= yes
.for c in ${NOT_FOR_COMPILER}
. for pc in ${PKGSRC_COMPILER}
# The left-hand side of the == operator must be a "real" variable.
_c:= ${c}
. if ${_c} == ${pc}
_CBBH.ncomp= no
. endif
. endfor
.endfor
# Check ONLY_FOR_COMPILER
_CBBH_CHECKS+= ocomp
_CBBH_MSGS.ocomp= "This package is only available for these compilers: "${ONLY_FOR_COMPILER:Q}"."
_CBBH.ocomp= yes
.if defined(ONLY_FOR_COMPILER) && !empty(ONLY_FOR_COMPILER)
_CBBH.ocomp= yes
# Ignore compilers that only cache or distribute the real work that has
# to be done (see PR 35173).
. for pc in ${PKGSRC_COMPILER:Nccache:Ndistcc}
. if empty(ONLY_FOR_COMPILER:M${pc})
_CBBH.ocomp= no
. endif
. endfor
.endif
# Check NOT_FOR_PLATFORM
_CBBH_CHECKS+= nplat
_CBBH_MSGS.nplat= "This package is not available for these platforms: "${NOT_FOR_PLATFORM:Q}"."
_CBBH.nplat= yes
.for p in ${NOT_FOR_PLATFORM}
. if !empty(MACHINE_PLATFORM:M${p})
_CBBH.nplat= no
. endif
.endfor
# Check NOT_FOR_BULK_PLATFORM
_CBBH_CHECKS+= nbplat
_CBBH_MSGS.nbplat= "This package is known to stall the bulk build on these platforms: "${NOT_FOR_BULK_PLATFORM:Q}"."
_CBBH.nbplat= yes
.for p in ${NOT_FOR_BULK_PLATFORM}
. if defined(BATCH) && !empty(MACHINE_PLATFORM:M${p})
_CBBH.nbplat= no
. endif
.endfor
# Check ONLY_FOR_PLATFORM
_CBBH_CHECKS+= oplat
_CBBH_MSGS.oplat= "This package is only available for these platforms: "${ONLY_FOR_PLATFORM:Q}"."
_CBBH.oplat= yes
.if defined(ONLY_FOR_PLATFORM) && !empty(ONLY_FOR_PLATFORM)
_CBBH.oplat= no
. for p in ${ONLY_FOR_PLATFORM}
. if !empty(MACHINE_PLATFORM:M${p})
_CBBH.oplat= yes
. endif
. endfor
.endif
# Check BROKEN_ON_PLATFORM
_CBBH_CHECKS+= bplat
_CBBH_MSGS.bplat= "This package is broken on these platforms: "${BROKEN_ON_PLATFORM:Q}"."
_CBBH.bplat= yes
.for p in ${BROKEN_ON_PLATFORM}
. if !empty(MACHINE_PLATFORM:M${p})
_CBBH.bplat= no
. endif
.endfor
# Check BROKEN_EXCEPT_ON_PLATFORM
_CBBH_CHECKS+= beplat
_CBBH_MSGS.beplat= "This package is broken except on these platforms: "${BROKEN_EXCEPT_ON_PLATFORM:Q}"."
_CBBH.beplat= yes
.if defined(BROKEN_EXCEPT_ON_PLATFORM) && !empty(BROKEN_EXCEPT_ON_PLATFORM)
_CBBH.beplat= no
. for p in ${BROKEN_EXCEPT_ON_PLATFORM}
. if !empty(MACHINE_PLATFORM:M${p})
_CBBH.beplat= yes
. endif
. endfor
.endif
# Check NOT_FOR_UNPRIVILEGED
_CBBH_CHECKS+= nunpriv
_CBBH_MSGS.nunpriv= "This package is not available in unprivileged mode."
_CBBH.nunpriv= yes
.if defined(NOT_FOR_UNPRIVILEGED) && !empty(NOT_FOR_UNPRIVILEGED:M[Yy][Ee][Ss])
. if !empty(UNPRIVILEGED:M[Yy][Ee][Ss])
_CBBH.nunpriv= no
. endif
.endif
# Check PKG_FAIL_REASON
_CBBH_CHECKS+= fail
_CBBH_MSGS.fail= "This package has set PKG_FAIL_REASON:" ${PKG_FAIL_REASON}
_CBBH.fail= yes
.if defined(PKG_FAIL_REASON) && !empty(PKG_FAIL_REASON)
_CBBH.fail= no
.endif
# Check PKG_SKIP_REASON
_CBBH_CHECKS+= skip
_CBBH_MSGS.skip= "This package has set PKG_SKIP_REASON:" ${PKG_SKIP_REASON}
_CBBH.skip= yes
.if defined(PKG_SKIP_REASON) && !empty(PKG_SKIP_REASON)
_CBBH.skip= no
.endif
# Collect and combine the results
_CBBH= yes
_CBBH_MSGS= # none
.for c in ${_CBBH_CHECKS}
. if ${_CBBH.${c}} != "yes"
_CBBH= no
_CBBH_MSGS+= ${_CBBH_MSGS.${c}}
. endif
.endfor
# In the first line, this target prints either "yes" or "no", saying
# whether this package can be built. If the package can not be built,
# the reasons are given in the following lines.
#
can-be-built-here: .PHONY
@${ECHO} ${_CBBH}
@:; ${_CBBH_MSGS:@m@${ECHO} ${m} ; @}
_cbbh:
@:; ${_CBBH_MSGS:@m@${ERROR_MSG} ${m} ; @}
@${FALSE}
.if !defined(NO_SKIP) && ${_CBBH} == "no"
# XXX: bootstrap-depends is only used here because it is depended
# upon by each of the "main" pkgsrc targets.
bootstrap-depends: _cbbh
.endif