From owner-freebsd-ports@FreeBSD.ORG Wed Jun 26 18:32:08 2013 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E97868FC; Wed, 26 Jun 2013 18:32:08 +0000 (UTC) (envelope-from danfe@regency.nsu.ru) Received: from mx.nsu.ru (mx.nsu.ru [84.237.50.39]) by mx1.freebsd.org (Postfix) with ESMTP id 2B45915D0; Wed, 26 Jun 2013 18:32:08 +0000 (UTC) Received: from regency.nsu.ru ([193.124.210.26]) by mx.nsu.ru with esmtp (Exim 4.69) (envelope-from ) id 1UruVf-000634-75; Thu, 27 Jun 2013 01:32:03 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id r5QIXbDN084752; Thu, 27 Jun 2013 01:33:37 +0700 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id r5QIXVTY084731; Thu, 27 Jun 2013 01:33:31 +0700 (NOVT) (envelope-from danfe) Date: Thu, 27 Jun 2013 01:33:31 +0700 From: Alexey Dokuchaev To: Baptiste Daroussin Subject: Re: Proposal: further OptionsNG improvements Message-ID: <20130626183331.GA78963@regency.nsu.ru> References: <20130618160037.GA26677@regency.nsu.ru> <20130618162708.GA34175@regency.nsu.ru> <20130621080451.GL23721@ithaqua.etoilebsd.net> <20130626121241.GA23956@regency.nsu.ru> <20130626123055.GA30841@regency.nsu.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline In-Reply-To: <20130626123055.GA30841@regency.nsu.ru> User-Agent: Mutt/1.4.2.1i Cc: ports@FreeBSD.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 18:32:09 -0000 --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 26, 2013 at 07:30:55PM +0700, Alexey Dokuchaev wrote: > On Wed, Jun 26, 2013 at 07:12:41PM +0700, Alexey Dokuchaev wrote: > > I've cooked something up just now, take a look at the attached diff. I've > > only barely tested it, but it seems to work for a few of my hand-crafted > > configurations. It also handles known options groups (single/multi/etc.), > > tested on www/firefox. > > One known limitation of option groups right now is that you cannot have > per-arch or !arch stuff, only :on. It should not be hard to fix, but I > need to think how to avoid code duplication. I miss $(call ...) of GNU > make sometimes... It just occurred to me that it seems we actually do not support something like OPTIONS_SINGLE_AUDIO_${ARCH}, which simplifies my work (please tell me if I'm wrong). So all I need is to remember about OPTIONS_EXCLUDE's in this case. Now it's possible (example for www/firefox/Makefile.options): OPTIONS_SINGLE_AUDIO= ALSA:on OSS!sparc64 PULSEAUDIO!powerpc,mips,i386 New diff attached (also comes with some comments tweaks, and I've switched from ^ to ~ as regex delimiter: it looks nicer and there is no confusion with start-of-line marker). I hope now it can cover anything possible to achieve with current OptionsNG. But we need reviewers and testers! ./danfe P.S. This was all developed on 8.3-STABLE, that is, with our traditional make(1). I will test new make(1) on 10-CURRENT tomorrow. --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="newsyntax2.diff" Index: bsd.options.mk =================================================================== --- bsd.options.mk (revision 321792) +++ bsd.options.mk (working copy) @@ -10,7 +10,7 @@ # specific to ${ARCH} # OPTIONS_DEFAULT - List of options activated by default # OPTIONS_DEFAULT_${ARCH} - List of options activated by default for a -# given arch +# given ${ARCH} # # ${OPTION}_DESC - Description of the ${OPTION} # @@ -94,14 +94,59 @@ PORT_OPTIONS+= IPV6 -# Add per arch options +### Parse new extended syntax OPTIONS knob (architecture-independent) +.for opt in ${OPTIONS:N*/*:N*!*} +OPTIONS_DEFINE+= ${opt:C~:.*~~} +OPTIONS_DEFAULT+= ${opt:M*\:on:S~:on~~} +.endfor + +# Process known option groups (only architecture exclusion supported) +.for otype in SINGLE RADIO MULTI GROUP +. for group in ${OPTIONS_${otype}} +# Here we need the temporary variables because of the := operator used few +# lines below +_exclude:= ${OPTIONS_${otype}_${group}:M*!*} +_default:= ${OPTIONS_${otype}_${group}:M*\:on*:C~:.*~~} +OPTIONS_DEFAULT+= ${_default} +OPTIONS_${otype}_${group}:= ${OPTIONS_${otype}_${group}:C~[:!].*~~} +. for opt in ${_exclude} +. for arch in ${opt:C~.*!~~:S~,~ ~g} +OPTIONS_EXCLUDE_${arch}+= ${opt:C~[:!].*~~} +. endfor +. endfor +. endfor +.endfor + +# Process architecture-specific options +.for opt in ${OPTIONS:M*/*} +. for arch in ${opt:C~.*/~~:S~,~ ~g} +. for defarch in OPTIONS_DEFINE_${arch:C~:.*~~} +${defarch}+= ${opt:C~/.*~~} +. endfor +. for defarch in OPTIONS_DEFAULT_${arch:M*\:on:S~:on~~} +${defarch}+= ${opt:C~/.*~~} +. endfor +. endfor +.endfor + +# Process options unsupported on some architectures +.for opt in ${OPTIONS:M*!*} +OPTIONS_DEFINE+= ${opt:C~[:!].*~~} +OPTIONS_DEFAULT+= ${opt:M*\:on!*:C~:.*~~} +. for arch in ${opt:C~.*!~~:S~,~ ~g} +OPTIONS_EXCLUDE_${arch}+= ${opt:C~[:!].*~~} +. endfor +.endfor +### + +# Add per-architecture options .for opt in ${OPTIONS_DEFINE_${ARCH}} .if empty(OPTIONS_DEFINE:M${opt}) OPTIONS_DEFINE+= ${opt} .endif .endfor -# Add per arch defaults +# Add per-architecture defaults OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${ARCH}} # Remove options the port maintainer doesn't want @@ -130,7 +175,7 @@ ALL_OPTIONS:= ${OPTIONS_DEFINE:O:u} OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:O:u} -# complete list +# Complete list COMPLETE_OPTIONS_LIST= ${ALL_OPTIONS} .for otype in SINGLE RADIO MULTI GROUP . for m in ${OPTIONS_${otype}} --Nq2Wo0NMKNjxTN9z--