From owner-freebsd-ports Wed Jun 19 12:56:48 2002 Delivered-To: freebsd-ports@freebsd.org Received: from phoenix.dmnstech.net (phoenix.dmnstech.net [194.19.34.94]) by hub.freebsd.org (Postfix) with SMTP id 19E8B37B400 for ; Wed, 19 Jun 2002 12:56:41 -0700 (PDT) Received: (from eivind@localhost) by phoenix.dmnstech.net (8.12.2/8.11.6) id g5JJucuw025006 for ports@FreeBSD.org; Wed, 19 Jun 2002 21:56:38 +0200 (CEST) (envelope-from eivind) Date: Wed, 19 Jun 2002 21:56:38 +0200 From: Eivind Eklund To: ports@FreeBSD.org Subject: 'make menuconfig' or how WITH_* can be good for you [patch] Message-ID: <20020619215638.A23046@phoenix.dmnstech.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline (Note that I am not on the ports@ list, so Cc:'s are appreciated.) I got tired of having to wade through a bunch of Makefiles and writing a bunch of WITH_XXX=YES switches on the command line. Enclosed is a small patch that allow us to add a simple 'options' file to a port to add a target "make menuconfig" to the port. This will bring up a dialog(1) dialog where the the user can turn the options on and off, and write out a file 'Makefile.options' that set the options the user selected. The patch also makes bsd.port.mk read in Makefile.options. The system isn't really complete (e.g, the dialog does not start up with the options the user selected last), but it should be better than what we have today. The patch could have used Makefile.inc instead, I guess, but I felt it might be a good idea to not overwrite what users might have painstakingly constructed, as this will overwrite with the defaults quite easily. Oh, and this will only work on ports that are split to use bsd.port.pre.mk and bsd.port.post.mk. Eivind. --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bsd.port.mk-make-menuconfig.patch" Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.414 diff -u -r1.414 bsd.port.mk --- bsd.port.mk 13 Jun 2002 18:20:40 -0000 1.414 +++ bsd.port.mk 19 Jun 2002 19:24:14 -0000 @@ -553,8 +570,9 @@ CHMOD?= /bin/chmod CHOWN?= /usr/sbin/chown CP?= /bin/cp CUT?= /usr/bin/cut DC?= /usr/bin/dc +DIALOG?= /usr/bin/dialog EGREP?= /usr/bin/egrep EXPR?= /bin/expr FALSE?= false # Shell builtin @@ -810,6 +834,10 @@ XFREE86_VERSION?= 3 .endif +.if exists(${MASTERDIR}/Makefile.options) +.include "Makefile.options" +.endif + .endif # End of pre-makefile section. @@ -3462,6 +3551,15 @@ OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \ PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \ SYSTEMVERSION="${SYSTEMVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" +.endif + +.if exists(options) && !target(menuconfig) && make(menuconfig) +USERCONFIG?=${WRKDIR}/ports-userconfig +PORTOPTIONS?=${MASTERDIR}/options +MENUOPTIONS!=${SED} 's|^\([^ ]*\)[ ]*NO|\1 OFF|;s|^\([^ ]*\)[ ]*YES|\1 ON|;s|^\([^ ]*\)[ ]*\([^ ]*\)[ ]*\(.*\)|\1 "\3" \2|' < ${PORTOPTIONS} +menuconfig: + @${DIALOG} --checklist "Options for ${PORTNAME} ${PORTVERSION}" 21 70 15 ${MENUOPTIONS} 2> ${USERCONFIG} && (${XARGS} ${SH} -c 'while [ "$$1" != "" ]; do echo WITH_$$1=\"YES\"; shift; done' '' < ${USERCONFIG} > ${MASTERDIR}/Makefile.options) + @${RM} -f ${USERCONFIG} .endif .endif --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=options AIBREED NO Allow AI breeding (not recommended) ROTATE_FIXED NO Fix position of one blob during rotation --0OAP2g/MAC+5xKAE-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message