From 5f78ff8efe0f4b27a2d13f3cb9eba9ea465c02ab Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 2 Aug 2013 16:08:38 +0000 Subject: [PATCH] - Add a new section for Options Helpers from bapt@ Submitted by: bapt@ Reviewed by: Ken Reed --- .../books/porters-handbook/book.xml | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) diff --git a/en_US.ISO8859-1/books/porters-handbook/book.xml b/en_US.ISO8859-1/books/porters-handbook/book.xml index 62fd9049f7..417a8ef9ad 100644 --- a/en_US.ISO8859-1/books/porters-handbook/book.xml +++ b/en_US.ISO8859-1/books/porters-handbook/book.xml @@ -4629,6 +4629,247 @@ CONFIGURE_ARGS+= --disable-foo .if ${VARIABLE:MVALUE} + + Options Helpers + + There are some macros to help simplify conditional + values which differ based on the options set. + + If OPTIONS_SUB is set to + yes then each of the options added + to OPTIONS_DEFINE will be added to + PLIST_SUB, for example: + + OPTIONS_DEFINE= OPT1 +OPTIONS_SUB= yes + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +PLIST_SUB+= OPT1="" +.else +PLIST_SUB+= OPT1="@comment " +.endif + + If X_CONFIGURE_ENABLE is set then + --enable-${X_CONFIGURE_ENABLE} + or --disable-${X_CONFIGURE_ENABLE} will + be added to CONFIGURE_ARGS depending on + the value of the optionX, for example: + + OPTIONS_DEFINE= OPT1 +OPT1_CONFIGURE_ENABLE= test + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +CONFIGURE_ARGS+= --enable-test +.else +CONFIGURE_ARGS+= --disable-test +.endif + + If X_CONFIGURE_WITH is set then + --with-${X_CONFIGURE_WITH} + or --without-${X_CONFIGURE_WITH} will + be added to CONFIGURE_ARGS depending + on the status of the option X, + for example: + + OPTIONS_DEFINE= OPT1 +OPT1_CONFIGURE_WITH= test + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +CONFIGURE_ARGS+= --with-test +.else +CONFIGURE_ARGS+= --without-test +.endif + + If X_CONFIGURE_ON is set then its value + will be appended to CONFIGURE_ARGS depending + on the status of the option X, for example: + + + OPTIONS_DEFINE= OPT1 +OPT1_CONFIGURE_ON= --add-test + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +CONFIGURE_ARGS+= --add-test +.endif + + If X_CONFIGURE_OFF is set then its value + will be appended to CONFIGURE_ARGS depending + on the status of the option X, for example: + + + OPTIONS_DEFINE= OPT1 +OPT1_CONFIGURE_OFF= --no-test + + is equivalent to: + + OPTIONS_DEFINE= OPT1 +.include <bsd.port.options.mk> +.if ! ${PORT_OPTIONS:MOPT1} +CONFIGURE_ARGS+= --no-test +.endif + + If X_CMAKE_ON is set then its value + will be appended to CMAKE_ARGS depending + on the status of the option X, for example: + + + OPTIONS_DEFINE= OPT1 +OPT1_CMAKE_ON= -DTEST:BOOL=true + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +CMAKE_ARGS+= -DTEST:BOOL=true +.endif + + If X_CMAKE_OFF is set then its value + will be appended to CMAKE_ARGS depending + on the status of the option X, for example: + + + OPTIONS_DEFINE= OPT1 +OPT1_CMAKE_OFF= -DTEST:BOOL=false + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ! ${PORT_OPTIONS:MOPT1} +CMAKE_ARGS+= -DTEST:BOOL=false +.endif + + For any of the following variables: + + + + CFLAGS + + + + CXXFLAGS + + + + LDLAGS + + + + CONFIGURE_ENV + + + + MAKE_ENV + + + + USES + + + + DISTFILES + + + + If X_ABOVEVARIABLE is defined then + its value will be appended to + ABOVEVARIABLE depending on the status of + the option X, for example: + + OPTIONS_DEFINE= OPT1 +OPT1_USES= gmake +OPT1_CFLAGS= -DTEST + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +USES+= gmake +CFLAGS+= -DTEST +.endif + + For any of the following dependency type: + + + + PKG_DEPENDS + + + + EXTRACT_DEPENDS + + + + PATCH_DEPENDS + + + + FETCH_DEPENDS + + + + BUILD_DEPENDS + + + + LIB_DEPENDS + + + + RUN_DEPENDS + + + + If X_ABOVEVARIABLE is defined then + its value will be appended to + ABOVEVARIABLE depending on the status + of the option X, for example: + + OPTIONS_DEFINE= OPT1 +OPT1_LIB_DEPENDS= liba.so:${PORTSDIR}/devel/a + + is equivalent to: + + OPTIONS_DEFINE= OPT1 + +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +LIB_DEPENDS+= liba.so:${PORTSDIR}/devel/a +.endif +