From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R3c66-0005Mn-ED for garchives@archives.gentoo.org; Tue, 13 Sep 2011 23:08:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4455221C2D2; Tue, 13 Sep 2011 23:08:49 +0000 (UTC) Received: from mail-yi0-f53.google.com (mail-yi0-f53.google.com [209.85.218.53]) by pigeon.gentoo.org (Postfix) with ESMTP id 1B1A021C103 for ; Tue, 13 Sep 2011 23:08:16 +0000 (UTC) Received: by yie21 with SMTP id 21so1183044yie.40 for ; Tue, 13 Sep 2011 16:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=x+NRrLOJurPgNjTTFC/vAUnzlgJ4kA/8P5M/KXYUmnM=; b=V0Qu1XbWOPOTpaD5IhSTBb3iBJn6Fjc+XscWz1UqTmObIHe5/HRt7XZz47QF3/8ck6 xF1xcJyOd+jnE+POk8fSfYNaWdRNCKm9mVITft3+zBhjhcxSZwB3JNh8ZRvQcH/ku05d dUfyy8eUrikHqo5kTZ6bNa9aQtxosn6iQ2++4= Received: by 10.42.73.2 with SMTP id q2mr875711icj.127.1315955296431; Tue, 13 Sep 2011 16:08:16 -0700 (PDT) Received: from smtp.gmail.com:587 ([2620:0:1000:fd10:224:d7ff:feae:c014]) by mx.google.com with ESMTPS id 37sm4136961iba.5.2011.09.13.16.08.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Sep 2011 16:08:15 -0700 (PDT) Received: by smtp.gmail.com:587 (sSMTP sendmail emulation); Tue, 13 Sep 2011 16:08:09 -0700 Date: Tue, 13 Sep 2011 16:08:09 -0700 From: Brian Harring To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] new `usex` helper Message-ID: <20110913230809.GA4867@localhost.google.com> References: <201109131756.19714.vapier@gentoo.org> <201109131813.10435.vapier@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201109131813.10435.vapier@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: X-Archives-Hash: 024835af0a34a1db45f758c18744df5f On Tue, Sep 13, 2011 at 06:13:10PM -0400, Mike Frysinger wrote: > On Tuesday, September 13, 2011 18:01:25 Alec Warner wrote: > > On Tue, Sep 13, 2011 at 2:56 PM, Mike Frysinger wrote: > > > this is so i can do: > > > export some_var=$(usex some_flag) > > > and get it set to "yes" or "no" > > > > If the intent is to use it for logic: > > > > export some_var=$(usex some_flag) > > > > if [[ $some_var == yes ]]; then > > # buttsex > > fi > > that is not the intent > > > Then I recommend making true / false the default and then doing > > > > if $some_var; then > > # buttsex > > fi > > the point is to use it to construct vars that get passed to scripts like econf > or programs like emake > > ac_cv_some_header=$(usex foo) \ > econf ... > > emake USE_POOP=$(usex poo) Making it overridable seems wiser- usex() { local flag="$1" local tval=${2-yes} local fval=${3-no} if use $flag; then echo "${tval}" else echo "${fval}" fi } While a bit longer, we likely can gut most of the use_* logic to use that, and it makes it easier to deal w/ the situations where a configure's options always assume --enable-blah thus don't export the option, but *do* export a --disable-blah. That way we can shift away from $(use blah && use_with blah) to $(usex blah --with-blah '') Or that's the intent at least. ~brian