Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 11133 - functions to handle enable/disable and with/without configure options
Summary: functions to handle enable/disable and with/without configure options
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Nicholas Jones (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-23 14:58 UTC by SpanKY
Modified: 2011-10-30 22:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2002-11-23 14:58:34 UTC
there are a ton of ebuilds where you can find syntax such as this: 
 
use pic \ 
	&& myconf="${myconf} --with-pic" \ 
	|| myconf="${myconf} --without-pic" 
 
use gd \ 
	&& myconf="${myconf} --enable-libgd" \ 
	|| myconf="${myconf} --disable-libgd" 
 
some ebuilds even have multiple structures like this ... basically it comes down to the 
fact that we have this very common structure just to pass more things to the configure 
script 
 
my suggestion is to create 2 small functions so that we could shrink these common 
options down ... 
(if you have better names, please suggest them) 
 
use_with() { 
	[ -z "$1" ] && return 
	[ -n "`use $1`" ] \ 
		&& echo with \ 
		|| echo without 
} 
use_enable() { 
	[ -z "$1" ] && return 
	[ -n "`use $1`" ] \ 
		&& echo enable \ 
		|| echo disable 
} 
 
thus we can shrink the above examples down to: 
myconf="${myconf} --`use_with pic`-pic" 
myconf="${myconf} --`use_enable gd`-libgd"
Comment 1 SpanKY gentoo-dev 2002-11-23 15:10:59 UTC
also, this would take care of having to figure out which option the configure script 
chooses as default ... a lot of people are lazy with confirming whether something is 
enabled/disabled by default 
Comment 2 Nicholas Jones (RETIRED) gentoo-dev 2002-11-30 23:20:21 UTC
in cvs