ports/94680: [patch] bsd.port.mk - introduce ONLY_FOR_OSVERSION as _REASON
Edwin Groothuis
edwin at mavetju.org
Sun Mar 19 09:00:31 UTC 2006
>Number: 94680
>Category: ports
>Synopsis: [patch] bsd.port.mk - introduce ONLY_FOR_OSVERSION as _REASON
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Mar 19 09:00:29 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Edwin Groothuis
>Release: FreeBSD 6.0-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov 3 09:36:13 UTC 2005 root at x64.samsco.home:/usr/obj/usr/src/sys/GENERIC i386
>Description:
A lot of ports have this in them:
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 400000
BROKEN= Not supported for pre-4.0 FreeBSD
.endif
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 502126
BROKEN= Does not compile on FreeBSD >= 5.x
.endif
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 500000
BROKEN= Does not compile on 4.x (port and dependencies need recent C++ compiler)
.endif
It would be much more in the trend of ONLY_FOR_ARCHS and NOT_FOR_ARCHS
to use normal messages for this:
ONLY_FOR_OSVERSION= 400000+
ONLY_FOR_OSVERSION_REASON= Not supported for pre-4.0 FreeBSD
ONLY_FOR_OSVERSION= -502126
ONLY_FOR_OSVERSION_REASON= Does not compile on FreeBSD >= 5.x
ONLY_FOR_OSVERSION= 500000+
ONLY_FOR_OSVERSION_REASON= Does not compile on 4.x (port and dependencies need recent C++ compiler)
Which would give as output:
===> rdist-6.1.5_2 is marked as broken: Not supported for pre-4.0 FreeBSD.
===> rdist-6.1.5_2 is marked as broken: Requires OSVERSION 400000 or later: Not supported for pre-4.0 FreeBSD.
===> nil-000928_2 is marked as broken: Does not compile on FreeBSD >= 5.x
===> nil-000928_2 is marked as broken: Requires OSVERSION 502126 or earlier: Does not compile on FreeBSD >= 5.x.
===> vamos-0.5.5_2 is marked as broken: "Does not compile on 4.x (port and dependencies need recent C++ compiler)".
===> vamos-0.5.5_2 is marked as broken: Requires OSVERSION 500000 or later: Does not compile on 4.x (port and dependencies need recent C++ compiler).
It will also give other scripts (freshports, linimons portlist) the
possibilities to give better data back to the users, and people who
want to do sweeps of the port collection a chance to find ports
which can be cleaned up ("port requires FreeBSD < 4") or checks
which can be removed ("Port requires FreeBSD > 4")
>How-To-Repeat:
>Fix:
--- bsd.port.mk.orig Sun Mar 19 17:18:28 2006
+++ bsd.port.mk Sun Mar 19 19:40:06 2006
@@ -208,6 +208,17 @@
# - Only build ports if ${ARCH} matches one of these.
# NOT_FOR_ARCHS - Only build ports if ${ARCH} doesn't match one of these.
#
+# Set these if your port only builds on certain OS versions.
+#
+# ONLY_FOR_OSVERSION
+# - An OS version, optionally prefixed or suffixed a "+" to
+# indicate "up to" or "from". OS Versions are the six digits
+# versions like ${OSVERSION}). For example: 500000+ requires
+# OSVERSION 500000 or higher, +499999 requires OSVERSION to
+# be lower than 500000.
+# ONLY_FOR_OSVERSION_REASON
+# - An optional reason why it doesn't work on this OSVERSION.
+#
# Dependency checking. Use these if your port requires another port
# not in the list below. (Default: empty.)
#
@@ -2824,6 +2835,37 @@
IGNORE= does not run on ${NOT_FOR_ARCHS},
.endif
IGNORE+= and you are running ${ARCH}
+.endif
+
+#
+# Compare OSVERSION with the values in ${ONLY_FOR_OSVERSION}
+#
+.if defined(ONLY_FOR_OSVERSION)
+
+# Strip any leading or following characters
+_ONLY_FOR_OSVERSION:=${ONLY_FOR_OSVERSION}
+_ONLY_FOR_OSVERSION:=${_ONLY_FOR_OSVERSION:S/+//}
+_ONLY_FOR_OSVERSION:=${_ONLY_FOR_OSVERSION:S/-//}
+.if ${ONLY_FOR_OSVERSION} == "-${_ONLY_FOR_OSVERSION}"
+_OKAYEARLIER= true
+.endif
+.if ${ONLY_FOR_OSVERSION} == "${_ONLY_FOR_OSVERSION}+"
+_OKAYLATER= true
+.endif
+
+# Check versions
+.if !defined(_OKAYEARLIER) && !defined(_OKAYLATER) && ( ${OSVERSION} != ${_ONLY_FOR_OSVERSION} )
+BROKEN= Requires OSVERSION ${_ONLY_FOR_OSVERSION}: ${ONLY_FOR_OSVERSION_REASON}
+.endif
+.if defined(_OKAYEARLIER) && ${OSVERSION} > ${_ONLY_FOR_OSVERSION}
+BROKEN= Requires OSVERSION ${_ONLY_FOR_OSVERSION} or earlier: ${ONLY_FOR_OSVERSION_REASON}
+.endif
+.if defined(_OKAYLATER) && ${OSVERSION} < ${_ONLY_FOR_OSVERSION}
+BROKEN= Requires OSVERSION ${_ONLY_FOR_OSVERSION} or later: ${ONLY_FOR_OSVERSION_REASON}
+.endif
+
+.undef _OKAYEARLIER
+.undef _OKAYLATER
.endif
.if !defined(NO_IGNORE)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list