15.10. Options and Helpers

If the port uses the options framework, define OPTIONS_DEFINE and OPTIONS_DEFAULT first, then the other OPTIONS_* variables first, then the *_DESC descriptions, then the options helpers. Try and sort all of those alphabetically.

Example 15.1. Options Variables Order Example

The FOO and BAR options do not have a standard description, so one need to be written. The other options already have one in Mk/bsd.options.desc.mk so writing one is not needed. The DOCS and EXAMPLES use target helpers to install their files, they are shown here for completeness, though they belong in Section 15.12, “The Targets”, so other variables and targets could be inserted before them.

OPTIONS_DEFINE=	DOCS EXAMPLES FOO BAR
OPTIONS_DEFAULT=	FOO
OPTIONS_RADIO=	SSL
OPTIONS_RADIO_SSL=    OPENSSL GNUTLS
OPTIONS_SUB=	yes

BAR_DESC=		Enable bar support
FOO_DESC=		Enable foo support

BAR_CONFIGURE_WITH=	bar=${LOCALBASE}
FOO_CONFIGURE_ENABLE=	foo
GNUTLS_CONFIGURE_ON=	--with-ssl=gnutls
OPENSSL_CONFIGURE_ON=	--with-ssl=openssl

post-install-DOCS-on:
      ${MKDIR} ${STAGEDIR}${DOCSDIR}
      cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
      ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
      cd ${WRKSRC}/ex && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.