Index: bsd.port.mk =================================================================== --- bsd.port.mk (revision 308420) +++ bsd.port.mk (working copy) @@ -3309,6 +3309,7 @@ # ################################################################ .if ((!defined(OPTIONS_DEFINE) && !defined(OPTIONS_SINGLE) && !defined(OPTIONS_MULTI)) \ + && !defined(OPTIONS_GROUP) && !defined(OPTIONS_RADIO) \ || defined(CONFIG_DONE_${UNIQUENAME:U}) || \ defined(PACKAGE_BUILDING) || defined(BATCH)) _OPTIONS_OK=yes @@ -6007,6 +6008,19 @@ .endfor .undef single +.for radio in ${OPTIONS_RADIO} +. for opt in ${OPTIONS_RADIO_${radio}} +. if !empty(PORT_OPTIONS:M${opt}) +. if defined(OPTFOUND) +OPTIONS_WRONG_RADIO+= ${radio} +. else +OPTFOUND= true +. endif +. endif +. endfor +. undef OPTFOUND +.endfor + .for multi in ${OPTIONS_MULTI} . for opt in ${OPTIONS_MULTI_${multi}} . if empty(ALL_OPTIONS:M${multi}) || !empty(PORT_OPTIONS:M${multi}) @@ -6038,7 +6052,10 @@ .for single in ${OPTIONS_WRONG_SINGLE} @${ECHO_MSG} "====> You must select one and only one option from the ${single} single" .endfor -.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) +.for radio in ${OPTIONS_WRONG_RADIO} + @${ECHO_MSG} "====> You cannot select multiple options from the ${radio} radio" +.endfor +.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) || !empty(OPTIONS_WRONG_RADIO) _CHECK_CONFIG_ERROR= true .endif .endif # _check-config @@ -6090,14 +6107,33 @@ . endif . endfor .endfor +.for radio in ${OPTIONS_RADIO} +. for opt in ${OPTIONS_RADIO_${radio}} +. if empty(PORT_OPTIONS:M${opt}) +DEFOPTIONS+= ${opt} "R(${radio}): "${${opt}_DESC:Q} off +. else +DEFOPTIONS+= ${opt} "R(${radio}): "${${opt}_DESC:Q} on +. endif +. endfor +.endfor +.for group in ${OPTIONS_GROUP} +. for opt in ${OPTIONS_GROUP_${group}} +. if empty(PORT_OPTIONS:M${opt}) +DEFOPTIONS+= ${opt} "G(${group}): "${${opt}_DESC:Q} off +. else +DEFOPTIONS+= ${opt} "G(${group}): "${${opt}_DESC:Q} on +. endif +. endfor +.endfor .undef multi .undef single +.undef group .undef opt .endif # pre-config .if !target(do-config) do-config: -.if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI) +.if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI) && empty(OPTIONS_RADIO) && empty(OPTIONS_GROUP) @${ECHO_MSG} "===> No options to configure" .else .if ${UID} != 0 && !defined(INSTALL_AS_USER) @@ -6173,7 +6209,7 @@ .if !target(showconfig) .include "${PORTSDIR}/Mk/bsd.options.desc.mk" showconfig: -.if !empty(ALL_OPTIONS) || !empty(OPTIONS_SINGLE) || !empty(OPTIONS_MULTI) +.if !empty(ALL_OPTIONS) || !empty(OPTIONS_SINGLE) || !empty(OPTIONS_MULTI) || !empty(OPTIONS_RADIO) || !empty(OPTIONS_GROUP) @${ECHO_MSG} "===> The following configuration options are available for ${PKGNAME}": .for opt in ${ALL_OPTIONS} . if empty(PORT_OPTIONS:M${opt}) @@ -6218,8 +6254,40 @@ . endfor .endfor +.for radio in ${OPTIONS_RADIO} + @${ECHO_MSG} "====> Options available for the radio ${radio}: you can only select none or one of them" +. for opt in ${OPTIONS_RADIO_${radio}} +. if empty(PORT_OPTIONS:M${opt}) + @${ECHO_MSG} -n " ${opt}=off" +. else + @${ECHO_MSG} -n " ${opt}=on" +. endif +. if !empty(${opt}_DESC) + @${ECHO_MSG} -n ": "${${opt}_DESC:Q} +. endif + @${ECHO_MSG} "" +. endfor +.endfor + +.for group in ${OPTIONS_GROUP} + @${ECHO_MSG} "====> Options available for the group ${group}" +. for opt in ${OPTIONS_GROUP_${group}} +. if empty(PORT_OPTIONS:M${opt}) + @${ECHO_MSG} -n " ${opt}=off" +. else + @${ECHO_MSG} -n " ${opt}=on" +. endif +. if !empty(${opt}_DESC) + @${ECHO_MSG} -n ": "${${opt}_DESC:Q} +. endif + @${ECHO_MSG} "" +. endfor +.endfor + .undef multi .undef single +.undef radio +.undef group .undef opt @${ECHO_MSG} "===> Use 'make config' to modify these settings" .endif @@ -6291,8 +6359,32 @@ . endfor @${ECHO_MSG} -n ") " .endfor +.for radio in ${OPTIONS_RADIO} + @${ECHO_MSG} -n "${radio}( " +. for opt in ${OPTIONS_RADIO_${radio}} +. if empty(PORT_OPTIONS:M${opt}) + @${ECHO_MSG} -n "-${opt} " +. else + @${ECHO_MSG} -n "+${opt} " +. endif +. endfor + @${ECHO_MSG} -n ") " +.endfor +.for group in ${OPTIONS_GROUP} + @${ECHO_MSG} -n "${group}[ " +. for opt in ${OPTIONS_GROUP_${group}} +. if empty(PORT_OPTIONS:M${opt}) + @${ECHO_MSG} -n "-${opt} " +. else + @${ECHO_MSG} -n "+${opt} " +. endif +. endfor + @${ECHO_MSG} -n "] " +.endfor .undef multi .undef single +.undef radio +.undef group .undef opt @${ECHO_MSG} "" .endif # pretty-print-config Index: bsd.options.mk =================================================================== --- bsd.options.mk (revision 308420) +++ bsd.options.mk (working copy) @@ -12,15 +12,28 @@ # OPTIONS_EXCLUDE_${ARCH} - List of options unsupported on a given ${ARCH} # ${OPTION}_DESC - Description the the ${OPTION} # -# OPTIONS_SINGLE - List of radio choice grouped options -# OPTIONS_MULTI - List of multiple-choice grouped options +# OPTIONS_SINGLE - List of single-choice grouped options: 1 and +# only 1 among N +# OPTIONS_RADIO - List of radio-choice grouped options: 0 or 1 +# among N +# OPTIONS_MULTI - List of multiple-choice grouped options: at +# least 1 among N +# OPTIONS_GROUP - List of group-choice grouped options: 0 or +# more among N # -# OPTIONS_SINGLE_${NAME} - List of OPTIONS grouped as radio choice (for +# OPTIONS_SINGLE_${NAME} - List of OPTIONS grouped as single choice (for # the single named as ${NAME} as defined in # OPTIONS_SINGLE) -# OTPIONS_MULTI_${NAME} - List of OPTIONS grouped as multiple-choice -# (for the multi named as ${NAME} as defined in +# OPTIONS_RADIO_${NAME} - List of OPTIONS grouped as radio choice (for +# the radio named as ${NAME} as defined in +# OPTIONS_RADIO) +# OPTIONS_MULTI_${NAME} - List of OPTIONS grouped as multiple-choice +# (for the multi named as ${NAME} as defined in # OPTIONS_MULTI) +# OPTIONS_GROUP_${NAME} - List of OPTIONS grouped as group-choice (for +# the group named as ${NAME} as defined in +# OPTIONS_GROUP) +# # WITH Set options from the command line # WITHOUT Unset options from the command line @@ -28,6 +41,8 @@ # Set all the options available for the ports, beginning with the # global ones and ending with the ones decided by the maintainer. # Options global to the entire ports tree +.if !defined(OPTIONSMKINCLUDED) +OPTIONSMKINCLUDED= bsd.options.mk OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options @@ -127,9 +142,15 @@ .for single in ${OPTIONS_SINGLE} COMPLETE_OPTIONS_LIST+= ${OPTIONS_SINGLE_${single}} .endfor +.for radio in ${OPTIONS_RADIO} +COMPLETE_OPTIONS_LIST+= ${OPTIONS_RADIO_${radio}} +.endfor .for multi in ${OPTIONS_MULTI} COMPLETE_OPTIONS_LIST+= ${OPTIONS_MULTI_${multi}} .endfor +.for group in ${OPTIONS_GROUP} +COMPLETE_OPTIONS_LIST+= ${OPTIONS_GROUP_${group}} +.endfor ## Now create the list of activated options .if defined(OPTIONS_OVERRIDE) @@ -255,4 +276,5 @@ .endif . undef opt .endfor +.endif ###