HEADS UP: New bsd.*.mk changes

Oliver Eikemeier eikemeier at fillmore-labs.com
Tue Jan 20 05:12:35 PST 2004


Joe Marcus Clarke wrote:

> Type: FEATURE
> 
> Title: Add per-port persistent build options with a menu-driven
> front-end
> 
> Affects: bsd.port.mk
> 
> Description: Probably one of the most anticipated new features for the
> ports system is the ability to have persistent per-port build options.
> This new feature adds that functionality as well as a new menu-driven
> interface for setting those per-port options.  Porters will need to set
> the OPTIONS macro in their port's Makefile to a list of WITH_ options
> supported by that port.  The format is <option> "<description>"
> [on|off].  For example: FLEXRESP "Flexible response to events" off.
> This says that this port supports a WITH_FLEXRESP option that is not
> defined by default.  This option's description is, "Flexible response
> to events."  Multiple options should be chained into the one OPTIONS
> macro.  NOTE: For OPTIONS to work, you must define OPTIONS before
> bsd.port.pre.mk.  In order to configure these options, use the
> ``config'' target.  Doing ``make config'' will pop up a curses-based
> dialog which lists all the available options for the given port.
> Changes are saved in a per-port directory under PORTS_DBDIR (default:
> /var/db/ports).  To view configurable options for a port, use the
> ``showconfig'' target.  To set all port options back to the defaults,
> use the ``rmconfig'' target.
> 
> PR:
> 
> Submitted by: eivind

Sorry for stepping up so late, but this saves options under
  ${PORT_DBDIR}/${PORTNAME}/options

Lots of ports have the same PORTNAME (ie 'openldap' for
net/openldap2[012]-(client|server), 'apache' for russian/apache13,
www/apache(13|13-fp|2|21)). Some conflict, but -client/-server don't.
Either each port has to set OPTIONSFILE to ${PORT_DBDIR}/${PORTNAME}/something,
or we may use LATEST_LINK instead of PORTNAME:

Index: /usr/ports/Mk/bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.475
diff -u -r1.475 bsd.port.mk
--- /usr/ports/Mk/bsd.port.mk	20 Jan 2004 09:14:09 -0000	1.475
+++ /usr/ports/Mk/bsd.port.mk	20 Jan 2004 12:59:22 -0000
@@ -1014,17 +1014,6 @@
 USE_SUBMAKE=	yes
 .endif
 
-# where 'make config' records user configuration options
-PORT_DBDIR?=	/var/db/ports
-
-OPTIONSFILE?=${PORT_DBDIR}/${PORTNAME}/options
-.if exists(${OPTIONSFILE})
-.include "${OPTIONSFILE}"
-.endif
-.if exists(${OPTIONSFILE}.local)
-.include "${OPTIONSFILE}.local"
-.endif
-
 # check for old, crufty, makefile types, part 1:
 .if !defined(PORTNAME) || !defined(PORTVERSION) || defined(PKGNAME)
 check-makefile::
@@ -1085,6 +1074,31 @@
 PACKAGES?=		${PORTSDIR}/packages
 TEMPLATES?=		${PORTSDIR}/Templates
 
+PKGREPOSITORYSUBDIR?=	All
+PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
+.if exists(${PACKAGES})
+PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
+.else
+PKGFILE?=		${.CURDIR}/${PKGNAME}${PKG_SUFX}
+.endif
+
+# The "latest version" link -- ${PKGNAME} minus everthing after the last '-'
+PKGLATESTREPOSITORY?=	${PACKAGES}/Latest
+PKGBASE?=			${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
+LATEST_LINK?=		${PKGBASE}
+PKGLATESTFILE=		${PKGLATESTREPOSITORY}/${LATEST_LINK}${PKG_SUFX}
+
+# where 'make config' records user configuration options
+PORT_DBDIR?=	/var/db/ports
+
+OPTIONSFILE?=${PORT_DBDIR}/${LATEST_LINK}/options
+.if exists(${OPTIONSFILE})
+.include "${OPTIONSFILE}"
+.endif
+.if exists(${OPTIONSFILE}.local)
+.include "${OPTIONSFILE}.local"
+.endif
+
 .if (!defined(PKGDIR) && exists(${MASTERDIR}/pkg/DESCR)) || \
 	(!defined(MD5_FILE) && exists(${MASTERDIR}/files/md5))
 check-makefile::
@@ -2522,20 +2537,6 @@
 	@${DO_NADA}
 .endif
 
-PKGREPOSITORYSUBDIR?=	All
-PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
-.if exists(${PACKAGES})
-PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
-.else
-PKGFILE?=		${.CURDIR}/${PKGNAME}${PKG_SUFX}
-.endif
-
-# The "latest version" link -- ${PKGNAME} minus everthing after the last '-'
-PKGLATESTREPOSITORY?=	${PACKAGES}/Latest
-PKGBASE?=			${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
-LATEST_LINK?=		${PKGBASE}
-PKGLATESTFILE=		${PKGLATESTREPOSITORY}/${LATEST_LINK}${PKG_SUFX}
-
 .if defined(PERL_CONFIGURE)
 CONFIGURE_ARGS+=	CC="${CC}" CCFLAGS="${CFLAGS}" PREFIX="${PREFIX}" \
 			INSTALLPRIVLIB="${PREFIX}/lib" INSTALLARCHLIB="${PREFIX}/lib"
@@ -4894,8 +4895,8 @@
 .if !defined(OPTIONS)
 	@${ECHO_MSG} "===> No options to configure"
 .else
-	@(${MKDIR} ${PORT_DBDIR}/${PORTNAME} 2> /dev/null) || \
-		(${ECHO_MSG} "===> Cannot create ${PORT_DBDIR}/${PORTNAME}, check permissions"; exit 1)
+	@(${MKDIR} ${PORT_DBDIR}/${LATEST_LINK} 2> /dev/null) || \
+		(${ECHO_MSG} "===> Cannot create ${PORT_DBDIR}/${LATEST_LINK}, check permissions"; exit 1)
 	- at if [ -e ${OPTIONSFILE} ]; then \
 		. ${OPTIONSFILE}; \
 	fi; \
@@ -4907,7 +4908,6 @@
 		withoutvar=WITHOUT_$$1; \
 		withval=$$(eval ${ECHO_CMD} $$\{$${withvar}\}); \
 		withoutval=$$(eval ${ECHO_CMD} $$\{$${withoutvar}\}); \
-		${ECHO_CMD} $${withval}; \
 		if [ ! -z "$${withval}" ]; then \
 			val=on; \
 		elif [ ! -z "$${withoutval}" ]; then \
@@ -4917,7 +4917,7 @@
 		fi; \
 		DEFOPTIONS="$${DEFOPTIONS} $$1 \"$$2\" $${val}"; \
 		shift 3; \
-	done > /dev/null; \
+	done; \
 	TMPOPTIONSFILE=$$(mktemp -t portoptions); \
 	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
 	${SH} -c "${DIALOG} --checklist \"Options for ${PORTNAME} ${PORTVERSION}\" 21 70 15 $${DEFOPTIONS} 2> $${TMPOPTIONSFILE}"; \
@@ -4964,7 +4964,7 @@
 .if exists(${OPTIONSFILE})
 	-@${ECHO_MSG} "===> Removing user-configured options for ${PORTNAME}"; \
 	${RM} -f ${OPTIONSFILE}; \
-	${RMDIR} ${PORT_DBDIR}/${PORTNAME}
+	${RMDIR} ${PORT_DBDIR}/${LATEST_LINK}
 .else
 	@${ECHO_MSG} "===> No user-specified options configured for ${PORTNAME}"
 .endif


More information about the freebsd-ports mailing list