From owner-svn-ports-head@freebsd.org Tue Aug 18 11:00:59 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1540A9BCAF5; Tue, 18 Aug 2015 11:00:59 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0622A18DA; Tue, 18 Aug 2015 11:00:59 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7IB0wHa074962; Tue, 18 Aug 2015 11:00:58 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7IB0wQa074958; Tue, 18 Aug 2015 11:00:58 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201508181100.t7IB0wQa074958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Tue, 18 Aug 2015 11:00:58 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r394573 - in head: . Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2015 11:00:59 -0000 Author: mat Date: Tue Aug 18 11:00:57 2015 New Revision: 394573 URL: https://svnweb.freebsd.org/changeset/ports/394573 Log: Introduce _IMPLIES and _PREVENTS to register dependencies, or conflicts, between options. PR: 191144 Submitted by: adamw Sponsored by: Absolight Modified: head/CHANGES head/Mk/bsd.options.mk head/Mk/bsd.port.mk Modified: head/CHANGES ============================================================================== --- head/CHANGES Tue Aug 18 10:51:01 2015 (r394572) +++ head/CHANGES Tue Aug 18 11:00:57 2015 (r394573) @@ -10,6 +10,20 @@ in the release notes and/or placed into All ports committers are allowed to commit to this file. +20150818: +AUTHOR: mat@FreeBSD.org + + _IMPLIES and _PREVENTS have been introduced to register dependency, + or conflicts between options. + + OPTIONS_DEFINE= FOO BAR BAZ + + FOO_IMPLIES= BAR + BAZ_PREVENTS= BAR + + If the FOO option is selected, the BAR option will be enabled as well. If + the BAZ and BAR options are both enabled, an error will be given. + 20150817: AUTHOR: mat@FreeBSD.org Modified: head/Mk/bsd.options.mk ============================================================================== --- head/Mk/bsd.options.mk Tue Aug 18 10:51:01 2015 (r394572) +++ head/Mk/bsd.options.mk Tue Aug 18 11:00:57 2015 (r394573) @@ -96,6 +96,11 @@ # ${opt}_QMAKE_OFF When option is disabled, it will add its content to # the QMAKE_ARGS. # +# ${opt}_IMPLIES When opt is enabled, options named in IMPLIES will +# get enabled too. +# ${opt}_PREVENTS When opt is enabled, if any options in PREVENTS are +# also enabled, it will produce an error. +# # ${opt}_USE= FOO=bar When option is enabled, it will enable # USE_FOO+= bar # If you need more than one option, you can do @@ -366,6 +371,14 @@ PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}} NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}} .endfor +## Enable options implied by other options +# _PREVENTS is handled in bsd.port.mk:pre-check-config +.for count in ${PORT_OPTIONS} +. for opt in ${PORT_OPTIONS} +PORT_OPTIONS+= ${${opt}_IMPLIES} +. endfor +.endfor + # Finally, add options required by slave ports PORT_OPTIONS+= ${OPTIONS_SLAVE} Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Tue Aug 18 10:51:01 2015 (r394572) +++ head/Mk/bsd.port.mk Tue Aug 18 11:00:57 2015 (r394573) @@ -5019,6 +5019,18 @@ OPTIONS_WRONG_MULTI+= ${multi} . undef OPTNOCHECK .endfor .undef multi + +.for opt in ${PORT_OPTIONS} +. for conflict in ${${opt}_PREVENTS} +. if ${PORT_OPTIONS:M${conflict}} +. if empty(OPTIONS_WRONG_PREVENTS:M${opt}) +OPTIONS_WRONG_PREVENTS+= ${opt} +. endif +OPTIONS_WRONG_PREVENTS_${opt}+= ${conflict} +. endif +. endfor +.endfor +.undef conflict .undef opt .endif #pre-check-config @@ -5033,7 +5045,13 @@ _check-config: pre-check-config .for radio in ${OPTIONS_WRONG_RADIO} @${ECHO_MSG} "====> You cannot select multiple options from the ${radio} radio" .endfor -.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) || !empty(OPTIONS_WRONG_RADIO) +.if defined(OPTIONS_WRONG_PREVENTS) + @${ECHO_MSG} "====> Two or more enabled options conflict with each other" +. for prevents in ${OPTIONS_WRONG_PREVENTS} + @${ECHO_MSG} "=====> Option ${prevents} conflicts with ${OPTIONS_WRONG_PREVENTS_${prevents}} (select only one)" +. endfor +.endif +.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) || !empty(OPTIONS_WRONG_RADIO) || !empty(OPTIONS_WRONG_PREVENTS) _CHECK_CONFIG_ERROR= true .endif .endif # _check-config