Documenting 'make config' options

Warren Block wblock at wonkity.com
Mon Jun 11 19:03:49 UTC 2012


On Sat, 9 Jun 2012, Warren Block wrote:

>>> That's a nice idea, how do you make it work with dialog?
>> 
>> No idea, this is still the design phase. :)  Actually, a message I now 
>> can't find suggested that dialog may be able to do it unchanged.
>
> Followup:
>
> dialog --item-help \
>  --checklist "Contrived options description example" 21 70 15 \
>  "ABC" "Enable ABC encapsulation of convoluted insoluble    ..." "on" \
>  "variations when the complementary quantum reversal feature is undesirable" \
>  "DOCS" "Build and install documentation" "on" "" \
>  "XYZ" "Enabling XYZ sets compiler go-fast stripes, defeats ...," "off" \
>  "all safeguards, and begins a wholesale, awesome, breathtaking data mangling" \
>  "NLS" "Native Language Support via gettext utilities" "on" ""

Here is a patch to do it.

To use, apply patch.  Pick a port and edit the option descriptions to be 
longer than 49 characters.  Then run 'make config'.

Notes:

This patch only does descriptions for the plain options right now. 
Changes to the multi and single options would be the same thing.  (Not 
done because I'm hoping someone better at make(1) will have cleaner
methods.)

There's a cosmetic problem.  The last description line at the bottom of 
the screen remains after dialog exits.  I have not found a way to clear 
it in dialog.
-------------- next part --------------
--- bsd.port.mk.orig	2012-06-11 08:53:43.000000000 -0600
+++ bsd.port.mk	2012-06-11 12:50:08.000000000 -0600
@@ -6017,11 +6017,14 @@
 .if !target(pre-config)
 pre-config:
 _COMPLETE_OPTIONS_LIST:=	${ALL_OPTIONS}
+VIS_WIDTH=	49
 .for opt in ${ALL_OPTIONS}
+${opt}_FIRST!=	${ECHO} ${${opt}_DESC:Q} | ${AWK} -F="\004" '{ ORS=""; print substr($$0,1,${VIS_WIDTH}); if (length($1)>${VIS_WIDTH}){print "+"} }'
+${opt}_REST!=	${ECHO} ${${opt}_DESC:Q} | ${AWK} -F="\004" '{ print substr($$0,${VIS_WIDTH}+1) }'
 .  if empty(PORT_OPTIONS:M${opt})
-DEFOPTIONS+=	${opt} ""${${opt}_DESC:Q} off
+DEFOPTIONS+=	${opt} ""${${opt}_FIRST:Q} off ""${${opt}_REST:Q}
 .  else
-DEFOPTIONS+=	${opt} ""${${opt}_DESC:Q} on
+DEFOPTIONS+=	${opt} ""${${opt}_FIRST:Q} on ""${${opt}_REST:Q}
 .  endif
 .endfor
 .for multi in ${OPTIONS_MULTI}
@@ -6069,7 +6072,7 @@
 .endif
 	@TMPOPTIONSFILE=$$(mktemp -t portoptions); \
 	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
-	${DIALOG} --checklist "Options for ${PKGNAME:C/-([^-]+)$/ \1/}" 21 70 15 ${DEFOPTIONS} 2> $${TMPOPTIONSFILE} || { \
+	${DIALOG} --item-help --checklist "Options for ${PKGNAME:C/-([^-]+)$/ \1/}" 21 70 15 ${DEFOPTIONS} 2> $${TMPOPTIONSFILE} || { \
 		${RM} -f $${TMPOPTIONSFILE}; \
 		${ECHO_MSG} "===> Options unchanged"; \
 		exit 0; \


More information about the freebsd-ports mailing list