New macros to help dealing with ports that have options:

OPTIONS_SUB=yes when set in a port, all the option names are automatically
added to the PLIST_SUB with "@comment " value in case the option is off and
empty value in case the options is on.

${OPT}_CONFIGURE_ENABLE=<aname> will automatically add:
CONFIGURE_ARGS+=--enable-<aname> in case OPT is activated
CONFIGURE_ARGS+=--disable-<aname> in case OPT is deactivated

${OPT}_CONFIGURE_ON=<something> will automatically add:
CONFIGURE_ARGS+=<something> in case OPT is activated

${OPT_CONFIGURE_OFF=<something> will automatically add:
CONFIGURE_ARGS+=<something> in case OPT is deactivated

${OPT}_CFLAGS will append the specified new flags to CFLAGS if OPT is 'on'
${OPT}_CXXFLAGS will append the specified new flags to CXXFLAGS if OPT is 'on'
${OPT}_LDFLAGS will append the specified new flags to LDFLAGS if OPT is 'on'

${OPT}_CONFIGURE_ENV will append the specified variables to CONFIGURE_ENV if
OPT is 'on'
${OPT}_MAKE_ENV will append the specified variables to MAKE_ENV if OPT is 'on'

${OPT}_USES will append the speficied uses to USES if OPT is 'on'

${OPT}_DISTFILES will append the specified distiles to DISTFILES if OPT in 'on'

Reviewed and tested by:	bdrewery
This commit is contained in:
Baptiste Daroussin 2013-06-14 13:41:37 +00:00
parent 2123bfe614
commit 67cfdf9034
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=320916
2 changed files with 74 additions and 1 deletions

31
CHANGES
View File

@ -10,6 +10,37 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
20130614:
AUTHOR: bapt@FreeBSD.org
* New macros to help dealing with ports that have options:
OPTIONS_SUB=yes when set in a port, all the option names are automatically
added to the PLIST_SUB with "@comment " value in case the option is off and
empty value in case the options is on.
${OPT}_CONFIGURE_ENABLE=<aname> will automatically add:
CONFIGURE_ARGS+=--enable-<aname> in case OPT is activated
CONFIGURE_ARGS+=--disable-<aname> in case OPT is deactivated
${OPT}_CONFIGURE_ON=<something> will automatically add:
CONFIGURE_ARGS+=<something> in case OPT is activated
${OPT_CONFIGURE_OFF=<something> will automatically add:
CONFIGURE_ARGS+=<something> in case OPT is deactivated
${OPT}_CFLAGS will append the specified new flags to CFLAGS if OPT is 'on'
${OPT}_CXXFLAGS will append the specified new flags to CXXFLAGS if OPT is 'on'
${OPT}_LDFLAGS will append the specified new flags to LDFLAGS if OPT is 'on'
${OPT}_CONFIGURE_ENV will append the specified variables to CONFIGURE_ENV if
OPT is 'on'
${OPT}_MAKE_ENV will append the specified variables to MAKE_ENV if OPT is 'on'
${OPT}_USES will append the speficied uses to USES if OPT is 'on'
${OPT}_DISTFILES will append the specified distiles to DISTFILES if OPT in 'on'
20130614:
AUTHOR: bapt@FreeBSD.org

View File

@ -287,5 +287,47 @@ WITH_${opt}:= true
. endif
.endif
.endfor
.endif
###
.for opt in ${COMPLETE_OPTIONS_LIST}
# PLIST_SUB
PLIST_SUB?=
. if defined(OPTIONS_SUB)
. if ! ${PLIST_SUB:M${opt}=*}
. if ${PORT_OPTIONS:M${opt}}
PLIST_SUB:= ${PLIST_SUB} ${opt}=""
. else
PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment "
. endif
. endif
. endif
. if ${PORT_OPTIONS:M${opt}}
. if defined(${opt}_CONFIGURE_ENABLE)
CONFIGURE_ARGS+= --enable-${${opt}_CONFIGURE_ENABLE}
. endif
. if defined(${opt}_CONFIGURE_ON)
CONFIGURE_ARGS+= ${${opt}_CONFIGURE_ON}
. endif
. for flags in CFLAGS CXXFLAGS LDFLAGS CONFIGURE_ENV MAKE_ENV USES DISTFILES
. if defined(${opt}_${flags})
${flags}+= ${${opt}_${flags}}
. endif
. endfor
. for deptype in PKG EXTRACT PATCH FETCH BUILD LIB RUN
. if defined(${opt}_${deptype}_DEPENDS)
${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS}
. endif
. endfor
. else
. if defined(${opt}_CONFIGURE_ENABLE)
CONFIGURE_ARGS+= --disable-${${opt}_CONFIGURE_ENABLE}
. endif
. if defined(${opt}_CONFIGURE_OFF)
CONFIGURE_ARGS+= ${${opt}_CONFIGURE_OFF}
. endif
. endif
.endfor
.endif