aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.options.mk
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2012-05-29 17:54:27 +0800
committerbapt <bapt@FreeBSD.org>2012-05-29 17:54:27 +0800
commitcede561db6029df02083f9b9285ca9d679817c01 (patch)
treefa59356ad6b6fc043747a61e3508607bbc34db99 /Mk/bsd.options.mk
parente39731110185374437274504ee0c41670756703f (diff)
downloadfreebsd-ports-gnome-cede561db6029df02083f9b9285ca9d679817c01.tar.gz
freebsd-ports-gnome-cede561db6029df02083f9b9285ca9d679817c01.tar.zst
freebsd-ports-gnome-cede561db6029df02083f9b9285ca9d679817c01.zip
New options framework for the ports
for maintainers: it introduces 3 different types of options: simple, multi and single: - simple options are the same as the current options (i.e. on or off.) - multi options are options where at least one must be set (1-N). - single options are options where one and only one must be set (exclusive options). for users: - OPTIONS_SET: globally enable some options - OPTIONS_UNSET: globally disable some options - ${UNIQUENAME}_SET: enable per-port choice of options - ${UNIQUENAME}_UNSET: disable per-port choice of options For compatibility the old OPTIONS framework is now working on top of the new one The options previously set with old OPTIONS are imported and converted transparently. A new knob NO_DIALOG if defined in the the config-conditional target is ignored (prevent the dialog(1) ui to show up. Thanks to all people involved: beat@, crees@, Bryan Drewery, linimon@, novel@ and others, for testing, comments, patches
Diffstat (limited to 'Mk/bsd.options.mk')
-rw-r--r--Mk/bsd.options.mk148
1 files changed, 148 insertions, 0 deletions
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk
new file mode 100644
index 000000000000..4a06a5c46a3d
--- /dev/null
+++ b/Mk/bsd.options.mk
@@ -0,0 +1,148 @@
+#-*- tab-width: 4; -*-
+# $FreeBSD$
+# Global options
+#
+
+##
+# 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
+
+OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
+
+#ALL_OPTIONS= DOCS \
+# NLS
+
+# Set the default values for the global options, as defined by portmgr
+PORT_OPTIONS+= NLS \
+ DOCS
+
+# Append options set by the port Makefile
+.for opt in ${OPTIONS_DEFINE}
+ALL_OPTIONS+= ${opt}
+.endfor
+
+ALL_OPTIONS:= ${ALL_OPTIONS:O:u}
+
+# Remove global options the port maintainer doesn't want
+.for opt in ${OPTIONS_EXCLUDE}
+ALL_OPTIONS:= ${ALL_OPTIONS:N${opt}}
+.endfor
+
+#XXX to kill when old option framework won't be used anymore
+.if defined(OPTIONS)
+. undef optname
+. for O in ${OPTIONS:S|\#|\\\#|g}
+opt:= ${O}
+. if !defined(optname)
+optname:= ${O}
+ALL_OPTIONS+= ${O}
+PORT_OPTIONS+= ${O}
+. elif !defined(optdesc)
+optdesc:= ${opt}
+${optname}_DESC:= ${opt}
+. else
+. if ${opt:L} == off
+. if defined(PORT_OPTIONS) && defined(optname)
+NO_OPTIONS+= ${optname}
+NO_OPTIONS:= ${NO_OPTIONS:O:u}
+. else
+. endif
+. endif
+. undef optname
+. undef optdesc
+. endif
+. endfor
+. if defined(NO_OPTIONS)
+. for O in ${NO_OPTIONS}
+PORT_OPTIONS:= ${PORT_OPTIONS:N${O}}
+. endfor
+. endif
+#. undef NO_OPTIONS
+.endif
+#XXX end of compatibility
+
+ALL_OPTIONS:= ${ALL_OPTIONS:O:u}
+
+## Now create the list of activated options
+.if defined(OPTIONS_OVERRIDE)
+# Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
+# before
+PORT_OPTIONS:= ${OPTIONS_OVERRIDE}
+.else
+
+## Set default options defined by the port maintainer
+. for opt in ${OPTIONS_DEFAULT}
+PORT_OPTIONS+= ${opt}
+. endfor
+PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
+
+## Set system-wide defined options (set by user in make.conf)
+. for opt in ${OPTIONS_SET}
+PORT_OPTIONS+= ${opt}
+. endfor
+PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
+
+## Remove the options excluded system-wide (set by user in make.conf)
+. for opt in ${OPTIONS_UNSET}
+PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
+. endfor
+
+## Set the options specified per-port (set by user in make.conf)
+. for opt in ${${UNIQUENAME:U}_SET}
+PORT_OPTIONS+= ${opt}
+. endfor
+PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
+
+## Unset the options excluded per-port (set by user in make.conf)
+. for opt in ${${UNIQUENAME:U}_UNSET}
+PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
+. endfor
+
+## options files (from dialog)
+. if exists(${OPTIONSFILE}) && !make(rmconfig)
+. include "${OPTIONSFILE}"
+. endif
+. if exists(${OPTIONSFILE}.local)
+. include "${OPTIONSFILE}.local"
+. endif
+
+# XXX(to be removed)
+. if defined(OPTIONS)
+. undef optname
+. for O in ${OPTIONS:C/".*"//g}
+. if defined(WITH_${O})
+PORT_OPTIONS+= ${O}
+PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
+. endif
+. if defined(WITHOUT_${O})
+PORT_OPTIONS:= ${PORT_OPTIONS:N${O}}
+. endif
+. endfor
+. endif
+# XXX(end to be removed)
+
+## Finish by using the options set by the port config dialog, if any
+. for opt in ${OPTIONS_FILE_SET}
+PORT_OPTIONS+= ${opt}
+. endfor
+PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
+
+.for opt in ${OPTIONS_FILE_UNSET}
+PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
+.endfor
+.undef opt
+
+.endif
+
+## Now some compatibility
+.if empty(PORT_OPTIONS:MDOCS)
+NOPORTDOCS= yes
+.endif
+
+.if empty(PORT_OPTIONS:MNLS)
+WITHOUT_NLS= yes
+.endif
+
+
+