From owner-freebsd-ports@FreeBSD.ORG Wed Jun 26 12:11:25 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 496F371C; Wed, 26 Jun 2013 12:11:25 +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 A7EAF11F5; Wed, 26 Jun 2013 12:11:24 +0000 (UTC) Received: from regency.nsu.ru ([193.124.210.26]) by mx.nsu.ru with esmtp (Exim 4.69) (envelope-from ) id 1UroZ8-0002h4-Qh; Wed, 26 Jun 2013 19:11:14 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id r5QCCkX9028206; Wed, 26 Jun 2013 19:12:46 +0700 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id r5QCCfmv028170; Wed, 26 Jun 2013 19:12:41 +0700 (NOVT) (envelope-from danfe) Date: Wed, 26 Jun 2013 19:12:41 +0700 From: Alexey Dokuchaev To: Baptiste Daroussin Subject: Re: Proposal: further OptionsNG improvements Message-ID: <20130626121241.GA23956@regency.nsu.ru> References: <20130618160037.GA26677@regency.nsu.ru> <20130618162708.GA34175@regency.nsu.ru> <20130621080451.GL23721@ithaqua.etoilebsd.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline In-Reply-To: <20130621080451.GL23721@ithaqua.etoilebsd.net> 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 12:11:25 -0000 --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 21, 2013 at 10:04:51AM +0200, Baptiste Daroussin wrote: > Sorry it took time for me to reply, after we last talk about this, I > thought a lot about this, and while in principe I do like the idea, I have > a couple of concerns: > > 1: this reduces lots of flexibility we now have with the new options > framework, well at the least the patch should make sure it doesn't reduce it > for instance, it should work properly with: > OPTIONS_EXCLUDE and OPTIONS_SLAVE. My current approach is to handle new "extended" syntax without interfering with OptionsNG, and since OPTIONS_EXCLUDE or OPTIONS_SLAVE would not contain any of that new :on or /${arch} stuff, I hope they would just work as before. ;-) > if should be able to handle properly the following situation: > OPTIONS_DEFINE= DOCS X11 > OPTIONS_DEFINE_i386= MYSQL PGSQL > OPTIONS_DEFINE_amd64= MYSQL PGSQL > OPTIONS_DEFAULT_i386= MYSQL > OPTIONS_DEFAULT_amd64= PGSQL > OPTIONS_EXCLUDE_powerpc= X11 Yes, it does handle it; in fact, hanlding this sort of several-lines ugly constructs is one the pripary reasons why I want something more elegant. 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. With the new syntax, the example above would simply become: OPTIONS= DOCS MYSQL/i386:on,amd64 PGSQL/i386,amd64:on X11!powerpc Verified (old vs. new) by "make showconfig ARCH=... | md5". Feedback welcome, as I might have missed some edge cases or a bug or two. > This is things I haven't been able to imagine in a concise/understandable > syntax like the one you are proposing, if we are able to do it then fine > for me :) > > 2: I'm concern about the parsing performance, not that I have tested > anything, but it just looks like it would be less performant for make(1) > to parse properly all this, this should be measured to at least know the > impact in the package building clusters and index building boxes once > everything will be converted. True, although I don't have idea how to measure it without converting quite a number of ports first. Perhaps an automated tool would help. ./danfe --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="newsyntax.diff" Index: bsd.options.mk =================================================================== --- bsd.options.mk (revision 321792) +++ bsd.options.mk (working copy) @@ -94,6 +94,43 @@ PORT_OPTIONS+= IPV6 +### Parse new OPTIONS knob (extended syntax) +.for opt in ${OPTIONS:N*/*:N*!*} +OPTIONS_DEFINE+= ${opt:C^:.*^^} +OPTIONS_DEFAULT+= ${opt:M*\:on:S^:on^^} +.endfor + +# Process known option groups +.for otype in SINGLE RADIO MULTI GROUP +. for m in ${OPTIONS_${otype}} +_${otype}_default:= ${OPTIONS_${otype}_${m}:M*\:on:S^:on^^} +OPTIONS_DEFAULT+= ${_${otype}_default} +OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:C^:.*^^} +. 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 arch options .for opt in ${OPTIONS_DEFINE_${ARCH}} .if empty(OPTIONS_DEFINE:M${opt}) @@ -130,7 +167,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}} --IS0zKkzwUGydFO0o--