pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc To ease cleanup of the options namespace, add code to ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/ef71b533815b
branches: trunk
changeset: 494815:ef71b533815b
user: dillo <dillo%pkgsrc.org@localhost>
date: Tue May 31 11:05:31 2005 +0000
description:
To ease cleanup of the options namespace, add code to support legacy
option names:
PKG_OPTIONS_LEGACY_OPTS+= old:new
If PKG_DEFAULT_OPTIONS or PKG_OPTIONS.foo contains option old (or
-old) it is rewritten to new (or -new) and a warning is issued by
the supported-options-message target.
diffstat:
mk/bsd.options.mk | 36 +++++++++++++++++++++++++++----
regress/pkg-options/Makefile | 4 +-
regress/pkg-options/files/legacy-opt.mk | 17 +++++++++++++++
regress/pkg-options/files/legacy-opt.out | 1 +
4 files changed, 51 insertions(+), 7 deletions(-)
diffs (131 lines):
diff -r 7ff0c4c029fa -r ef71b533815b mk/bsd.options.mk
--- a/mk/bsd.options.mk Tue May 31 10:51:36 2005 +0000
+++ b/mk/bsd.options.mk Tue May 31 11:05:31 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.options.mk,v 1.25 2005/05/28 12:14:34 dillo Exp $
+# $NetBSD: bsd.options.mk,v 1.26 2005/05/31 11:05:31 dillo Exp $
#
# This Makefile fragment provides boilerplate code for standard naming
# conventions for handling per-package build options.
@@ -22,6 +22,11 @@
# This is a list of USE_VARIABLE:option pairs that
# map legacy /etc/mk.conf variables to their option
# counterparts.
+#
+# PKG_OPTIONS_LEGACY_OPTS
+# This is a list of old-option:new-option pairs that
+# map options that have been renamed to their new
+# counterparts.
#
#
# Optionally, the user may define the following variables in /etc/mk.conf:
@@ -48,10 +53,11 @@
#
# -------------8<-------------8<-------------8<-------------8<-------------
# PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
-# PKG_SUPPORTED_OPTIONS= foo ldap sasl
-# PKG_SUGGESTED_OPTIONS= foo
+# PKG_SUPPORTED_OPTIONS= wibble-foo ldap sasl
+# PKG_SUGGESTED_OPTIONS= wibble-foo
# PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
# PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_SASL2:sasl
+# PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
#
# .include "../../mk/bsd.options.mk"
#
@@ -60,7 +66,7 @@
# ###
# ### FOO support
# ###
-# .if !empty(PKG_OPTIONS:Mfoo)
+# .if !empty(PKG_OPTIONS:Mwibble-foo)
# CONFIGURE_ARGS+= --enable-foo
# .endif
@@ -112,6 +118,17 @@
.undef _opt_
.undef _popt_
+.for _m_ in ${PKG_OPTIONS_LEGACY_OPTS}
+_old_:= ${_m_:C/:.*//}
+_new_:= ${_m_:C/.*://}
+. if !empty(PKG_SUPPORTED_OPTIONS:M${_new_})
+_PKG_LEGACY_OPTMAP.${_old_}:=${_new_}
+_DEPRECATED_WARNING:=${_DEPRECATED_WARNING} "Deprecated option "${_old_:Q}" used, use option "${_new_:Q}" instead."
+. endif
+.endfor
+.undef _old_
+.undef _new_
+
#
# filter unsupported options from PKG_DEFAULT_OPTIONS
#
@@ -119,7 +136,8 @@
.for _o_ in ${PKG_DEFAULT_OPTIONS}
_opt_:= ${_o_}
_popt_:= ${_opt_:C/^-//}
-.if !empty(PKG_SUPPORTED_OPTIONS:M${_popt_})
+.if !empty(PKG_SUPPORTED_OPTIONS:M${_popt_}) \
+ || defined(_PKG_LEGACY_OPTMAP.${_popt_})
_OPTIONS_DEFAULT_SUPPORTED:=${_OPTIONS_DEFAULT_SUPPORTED} ${_opt_}
.endif
.endfor
@@ -135,6 +153,14 @@
${_OPTIONS_DEFAULT_SUPPORTED} ${${PKG_OPTIONS_VAR}}
_opt_:= ${_o_}
_popt_:= ${_o_:C/^-//} # positive option
+. if defined(_PKG_LEGACY_OPTMAP.${_popt_})
+_popt_:= ${_PKG_LEGACY_OPTMAP.${_popt_}}
+. if empty(_opt_:M-*)
+_opt_:= ${_popt_}
+. else
+_opt_:= -${_popt_}
+. endif
+. endif
. if empty(PKG_SUPPORTED_OPTIONS:M${_popt_})
_OPTIONS_UNSUPPORTED:=${_OPTIONS_UNSUPPORTED} ${_opt_}
. else
diff -r 7ff0c4c029fa -r ef71b533815b regress/pkg-options/Makefile
--- a/regress/pkg-options/Makefile Tue May 31 10:51:36 2005 +0000
+++ b/regress/pkg-options/Makefile Tue May 31 11:05:31 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2005/05/28 12:16:43 dillo Exp $
+# $NetBSD: Makefile,v 1.4 2005/05/31 11:05:31 dillo Exp $
#
DISTNAME= regress-pkg-options-1.0
@@ -8,7 +8,7 @@
MAINTAINER= rillig%NetBSD.org@localhost
COMMENT= Test bsd.options.mk framework
-REGRESS_TESTS= all order simple unsupported
+REGRESS_TESTS= all legacy-opt order simple unsupported
do-test:
.for t in ${REGRESS_TESTS}
diff -r 7ff0c4c029fa -r ef71b533815b regress/pkg-options/files/legacy-opt.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/pkg-options/files/legacy-opt.mk Tue May 31 11:05:31 2005 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: legacy-opt.mk,v 1.1 2005/05/31 11:05:31 dillo Exp $
+#
+# This file test a very simple options configuration.
+#
+
+MAKECONF= /dev/null
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.foo
+PKG_SUPPORTED_OPTIONS= new
+PKG_OPTIONS_LEGACY_OPTS+= old:new
+PKG_OPTIONS.foo= old
+
+.include "../../mk/bsd.options.mk"
+
+.PHONY: test
+test:
+ echo ${PKG_OPTIONS:M*:Q}
diff -r 7ff0c4c029fa -r ef71b533815b regress/pkg-options/files/legacy-opt.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/pkg-options/files/legacy-opt.out Tue May 31 11:05:31 2005 +0000
@@ -0,0 +1,1 @@
+new
Home |
Main Index |
Thread Index |
Old Index