summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2010-12-06 09:14:52 +0000
committerespie <espie@openbsd.org>2010-12-06 09:14:52 +0000
commit84571611b392ab15aa7ca063267cb53894871999 (patch)
tree240cb7db020d6b9a8cb13b9f70d94a3c715b1cfe
parent* if we got an undercoverable error, set the dying flag (diff)
downloadwireguard-openbsd-84571611b392ab15aa7ca063267cb53894871999.tar.xz
wireguard-openbsd-84571611b392ab15aa7ca063267cb53894871999.zip
document the cookie pattern to use to override targets in a truely modular
way
-rw-r--r--share/man/man5/port-modules.524
1 files changed, 22 insertions, 2 deletions
diff --git a/share/man/man5/port-modules.5 b/share/man/man5/port-modules.5
index e83654a95cc..f934f0f63d0 100644
--- a/share/man/man5/port-modules.5
+++ b/share/man/man5/port-modules.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: port-modules.5,v 1.82 2010/12/03 11:53:24 ajacoutot Exp $
+.\" $OpenBSD: port-modules.5,v 1.83 2010/12/06 09:14:52 espie Exp $
.\"
.\" Copyright (c) 2008 Marc Espie
.\"
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: December 3 2010 $
+.Dd $Mdocdate: December 6 2010 $
.Dt PORT-MODULES 5
.Os
.Sh NAME
@@ -199,6 +199,26 @@ hook that can be activated by defining
It will be run right before installing the package with
.Xr pkg_add 1 .
.El
+.Pp
+Some modules take some steps entirely over, such as
+.Ar do-build .
+They should never do so directly.
+The proper way is to define a properly named cookie, and have the behavior
+attached to the cookie, then override the target only if it isn't already
+defined.
+.Bd -literal -offset indent
+MODFOO_BUILD_COOKIE = ${WRKBUILD}/.modfoo_build_done
+${MODFOO_BUILD_COOKIE}:
+ # whatever I want to do
+
+\&.if !defined(do-build)
+do-build: ${MODFOO_BUILD_COOKIE}
+\&.endif
+.Ed
+.Pp
+That way, the behavior can still be used from a port that requires other
+things to happen within the target, including ports that want to use several
+conflicting modules.
.Sh OVERRIDING VARIABLE BEHAVIOR
Some variables can be overridden by modules.
Be very cautious, as this can make the module difficult to use,