Subject: Re: Consistent "Optional Dependecy" handling
To: Jeremy C. Reed <reed@reedmedia.net>
From: Nate Hill <vugdeox@freeshell.org>
List: tech-pkg
Date: 07/31/2003 17:30:43
Sorry, I sent this only to Jeremy not list. Lets isolate it on 
tech-pkg also.

On Thu July 31 2003 17:12, Jeremy C. Reed wrote:
> On Thu, 31 Jul 2003, Nate Hill wrote:
> > I find it humorous that kdegraphics is the only package depending
> > on GTK+ on my entire system. Is there a consistent way to disable
> > use of GTK+ in packages which do not _require_ it? For instance
> > can I set something like USE_GTK=YES|NO or PREFER_GTK2=YES|NO in
> > mk.conf?
>
> This depends if the pkgsrc maintainer has provided an option
> variable do do this.
>
> The options should be all listed in pkgsrc/mk/bsd.pkg.defaults.mk.
>
> There is not a USE_GTK defined there. There are a few package
> specific variables though: BITCHX_WITH_GTK, LAME_USE_GTK, and
> PILRC_USE_GTK.
>
> Another way it is done is by having separate packages, for example,
> see: chat/gaim-gtk1
> comms/efax-gtk
> editors/vim-gtk
> editors/vim-gtk2
> games/freeciv-client-gtk
> graphics/libexif-gtk
> net/firewalk-gtk
> net/mtr-gtk
> time/asclock-gtk
> wip/nvtv-gtk2
> x11/asclock-gtk
>
> I agree it would be good to have a "USE_GTK" variable.

Yes, this would eliminate alot of redundancy by centralizing the very 
few difference present in say, vim-gtk1 and vim-gtk2

> There is similiar ideas already used by various packages, like:
> USE_CUPS, USE_IDEA, USE_INET6, USE_INN, USE_LIBCRACK, USE_MMX,
> USE_OPENLDAP, USE_OSS, USE_PAM, and more.
>
> (I do see some naming problems; variables that start with "USE_"
> should apply to a variety of packages, but I see that
> bsd.pkg.defaults.mk has notes for USE_CRYPTO, USE_DB2, USE_GIF,
> USE_I586, and a few others that appear to be that they are specific
> for one single package each. If that is true, they should be
> renamed, like XEMACS_USE_XFACE or GNUPG_USE_I586.)

Excellent point, there needs to be a consistent and logical namespace.

> > Another example is kdepim which currently requires
> > pilot-link-libs, I know that it can be built without this library
> > and without the KPilot tool.
> >
> > Anyways, I'm looking for something similar to Gentoo's "USE
> > Flags" system...
>
> Can you describe that Gentoo feature?

Hopefully, my previous mail was informative. I just sucked down an 
ebuild, not sure if this is standard but here's an example:

-----------------------------------------
2003/07/29 12:44:28 pauldv Exp $
inherit kde-dist

IUSE="gphoto2 tetex scanner"
DESCRIPTION="KDE graphics-related apps"

KEYWORDS="~x86"

newdepend "gphoto2? ( >=media-gfx/gphoto2-2.0_beta1 )
	dev-lang/perl
	scanner? ( media-gfx/sane-backends )
	tetex? ( >=app-text/tetex-1.0.7 )
	media-libs/imlib
	app-text/ghostscript
	virtual/glut virtual/opengl
	media-libs/tiff
	!media-gfx/kpovmodeler
	x86? ( scanner? sys-libs/libieee1284 )
	>=sys-apps/portage-2.0.47" # needed for the above dep ANDing to work

RDEPEND="$RDEPEND app-text/xpdf"

use gphoto2	&& myconf="$myconf --with-kamera 
--with-gphoto2-includes=/usr/include/gphoto2 \
				   --with-gphoto2-libraries=/usr/lib/gphoto2 \
				   --with-gpio --with-gpio-includes=/usr/include \
				   --with-gpio-libraries=/usr/lib" || myconf="$myconf 
--without-kamera"

use tetex 	&& myconf="$myconf --with-system-kpathsea 
--with-tex-datadir=/usr/share"

use scanner	|| KDE_REMOVE_DIR="kooka libkscan"

myconf="$myconf --with-imlib --with-imlib-config=/usr/bin"
-----------------------------------------

> Maybe someone will soon work on the OpenBSD-like "flavours"
> feature. Where one pkgsrc can be used to multiple binary packages.

No idea what that is.

-- 
Nate Hill <vugdeox@freeshell.org>