--- bsd.port.mk.orig 2010-12-02 17:55:40.325016866 +0000 +++ bsd.port.mk 2010-12-03 07:24:21.494950196 +0000 @@ -222,6 +222,17 @@ # - Set this instead of ONLY_FOR_ARCHS if the given port # fetches and installs compiled i386 binaries. # +# ONLY_FOR_MINVER +# - Only build port if ${OSVERSION} is superior or equal +# to this value. +# ONLY_FOR_MINVER_REASON +# - Reason why it's only for ${ONLY_FOR_MINVER} +# ONLY_FOR_MAXVER +# - Only build port if ${OSVERSION} is inferior or equal +# to this value. +# ONLY_FOR_MAXVER_REASON +# - Reason why it's only for ${ONLY_FOR_MAXVER} +# # Dependency checking. Use these if your port requires another port # not in the list below. (Default: empty.) # @@ -295,6 +306,14 @@ # passed to the compiler by setting DEBUG_FLAGS. It is # set to "-g" at default. # +## +# USE_SRC - If set, this port needs kernel sources to build. +# If set to "yes", presence of ${SRC_BASE}/sys/Makefile +# is checked. If set to a space-separated list of files, +# presence of those files under ${SRC_BASE}/ is checked. +# SRC_BASE - Set to the base directory of your kernel sources +# Default: /usr/src +## # USE_BZIP2 - If set, this port tarballs use bzip2, not gzip, for # compression. # USE_XZ - If set, this port tarballs use xz (or lzma) @@ -1388,6 +1407,21 @@ WWWDIR?= ${PREFIX}/www/${PORTNAME} ETCDIR?= ${PREFIX}/etc/${PORTNAME} +.if defined(USE_SRC) +SRC_BASE?= /usr/src +. if ${USE_SRC:L} == "yes" +_SRC_CHECK_FILES= sys/Makefile +. else +_SRC_CHECK_FILES= ${USE_SRC} +.endif + +.for file in ${_SRC_CHECK_FILES} +. if !defined(${IGNORE}) && !exists(${SRC_BASE}/${file}) +IGNORE= requires kernel source files +. endif +.endfor +.endif # defined(USE_SRC) + .if defined(USE_LINUX_RPM) .include "${PORTSDIR}/Mk/bsd.linux-rpm.mk" .endif @@ -3252,6 +3286,25 @@ .endif +# Check for minimum and maximum version compatibility +.if defined(ONLY_FOR_MINVER) +. if ${OSVERSION} < ${ONLY_FOR_MINVER} +IGNORE= requires FreeBSD ${ONLY_FOR_MINVER:C/([0-9]+)([0-9])[0-9]{4}/\1.\2/} or later +. if defined(ONLY_FOR_MINVER_REASON) +IGNORE+= (${ONLY_FOR_MINVER_REASON}) +. endif +. endif +.endif + +.if defined(ONLY_FOR_MAXVER) +. if ${OSVERSION} > ${ONLY_FOR_MAXVER} +IGNORE= requires FreeBSD ${ONLY_FOR_MAXVER:C/([0-9]+)([0-9])[0-9]{4}/\1.\2/} or earlier +. if defined(ONLY_FOR_MAXVER_REASON) +IGNORE+= (${ONLY_FOR_MAXVER_REASON}) +. endif +. endif +.endif + # Check the user interaction and legal issues .if !defined(NO_IGNORE) .if (defined(IS_INTERACTIVE) && defined(BATCH))