public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Ebuild programming question
@ 2002-11-20  0:32 Johannes Ballé
  2002-11-20  1:15 ` Michael Cummings
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Ballé @ 2002-11-20  0:32 UTC (permalink / raw
  To: gentoo-dev

Hello developers,

I am new to ebuild programming, please excuse me asking (maybe trivial) 
questions here I couldn't find answers for elsewhere.

The basic problem of ebuild programming seems to be that you need to map "USE" 
options from the portage system to the "configure" options of the package 
source.

Many packages come with the ability to auto-detect certain features, though.

One example: the em8300-libraries package provides a library and several tools 
to run an MPEG-decoder PCI card. Some of these tools need gtk, others only 
need a text console. A user may wish to omit installation of the gtk tools 
(on X-less boxes, for example).

Would it be considered bad practice to put a dependency like "gtk? ( gtk... )" 
into the ebuild, but leave it to the configure script to sort out whether gtk 
is installed or not (hence, whether to compile the gtk tools or not)?

-- 
Johannes Ballé <joba123@arcor.de>


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] Ebuild programming question
  2002-11-20  0:32 [gentoo-dev] Ebuild programming question Johannes Ballé
@ 2002-11-20  1:15 ` Michael Cummings
  2002-11-20  7:52   ` Johannes Ballé
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Cummings @ 2002-11-20  1:15 UTC (permalink / raw
  To: Johannes Ball?; +Cc: gentoo-dev

Check the configure script that comes with the program (assuming there
is one :) ). Usually, you can do something like (not perfect syntax,
but you get the idea):
-------------------

use gtk || ${myconf} = "${myconf} --disable-gtk"

...


./configure ${myconf}


--------------------
or something to that affect (and assuming that the configure option is
disable-gtk)

On Wed, Nov 20, 2002 at 01:32:40AM +0100, Johannes Ball? wrote:
> Would it be considered bad practice to put a dependency like "gtk? ( gtk... )" 
> into the ebuild, but leave it to the configure script to sort out whether gtk 
> is installed or not (hence, whether to compile the gtk tools or not)?
> 

--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] Ebuild programming question
  2002-11-20  1:15 ` Michael Cummings
@ 2002-11-20  7:52   ` Johannes Ballé
  2002-11-20 14:05     ` Karl Trygve Kalleberg
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Ballé @ 2002-11-20  7:52 UTC (permalink / raw
  To: gentoo-dev

Am Wednesday 20 November 2002 02:15 schrieb Michael Cummings:
> Check the configure script that comes with the program (assuming there
> is one :) ). Usually, you can do something like (not perfect syntax,

This particular package seems to have almost no configure options (I already 
checked that). I was asking merely because I wanted to know whether the user 
should get the chance to say "yes, I have gtk installed but I don't want 
those tools anyway" ...

Using auto-configuration, the USE option would have no influence on building 
the tools or not, but only on pulling in gtk as a dependency (as far as I 
understand).

This is probably more a question of policy. (Although I'm not sure if the 
method I mentioned might have the potential to even break things ... ?)

-- 
Johannes Ballé <joba123@arcor.de>


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] Ebuild programming question
  2002-11-20  7:52   ` Johannes Ballé
@ 2002-11-20 14:05     ` Karl Trygve Kalleberg
  2002-11-21 15:42       ` Johannes Ballé
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Trygve Kalleberg @ 2002-11-20 14:05 UTC (permalink / raw
  To: gentoo-dev

On Wed, 20 Nov 2002 08:52:07 +0100
Johannes Ballé <joba123@arcor.de> wrote:

> Am Wednesday 20 November 2002 02:15 schrieb Michael Cummings:
> > Check the configure script that comes with the program (assuming there
> > is one :) ). Usually, you can do something like (not perfect syntax,
> 
> This particular package seems to have almost no configure options (I
> already checked that). I was asking merely because I wanted to know
> whether the user should get the chance to say "yes, I have gtk installed
> but I don't want those tools anyway" ...

If gtk is not among the useflags, you should _NOT_ build the gtk support. 

> Using auto-configuration, the USE option would have no influence on
> building the tools or not, but only on pulling in gtk as a dependency
> (as far as I understand).

It is _not_ okay for a package's build script to automatically detect and
depend on gtk only if it is installed. 

If your package depends on gtk, it must be in the DEPEND (and possibly
also RDEPEND, unless DEPEND == RDEPEND) env var.

If your package can build without gtk, you must heed the gtk useflag; ie,
turn off gtk support altogether if gtk is not among the current useflags.


The big problem with hidden deps that are pulled automatically, and that
Portage doesn't know about, is that it that users may do "emerge -eop
world | grep gtk", and see that no packages seem to depend of gtk. Then
they happily remove gtk+ from their system and things start breaking...

A real life story: I have USE="-opengl" in my /etc/make.conf, but I have
OpenGL headers and libraries installed. I installed qt-3.1.0, which
decided that I had OpenGL, so it compiled in support for it. I removed the
OpenGL libraries for a while (driver transition), and qt apps started
breaking mysteriously. Now qt-3.1.0 has an opengl useflag which it adheres
to, and things have stopped breaking mysteriously.


In general, the idiom wrt any given useflag is:

use foo && myconf="${myconf} --with-foo" || myconf="${myconf}
--without-foo"

Ie, you should _ALWAYS_ turn on or off foo-support explicitly in your
ebuild. Don't rely on the configure script's defaults, because:

1) Usually if you don't specify --with-foo or --without-foo, it is
auto-detected. This is bad for the reasons I stated above.
2) Sometimes, --without-foo or --with-foo is the default, but the default
may change with the next release of the package, and then you're going to
have to rewrite the ebuild, which nobody bothers doing, so it makes sense
to get it right the first time around.


Kind regards,

Karl T

--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] Ebuild programming question
  2002-11-20 14:05     ` Karl Trygve Kalleberg
@ 2002-11-21 15:42       ` Johannes Ballé
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Ballé @ 2002-11-21 15:42 UTC (permalink / raw
  To: gentoo-dev

Am Wednesday 20 November 2002 15:05 schrieb Karl Trygve Kalleberg:
> It is _not_ okay for a package's build script to automatically detect and
> depend on gtk only if it is installed.

Thanks, this was exactly the information I was looking for.

If the maintainer of the Gentoo Developers HOWTO reads this, maybe you could 
include a short summary of what Karl posted in the next revision? It would 
certainly be a good thing to have this in there.

Regards, Johannes

-- 
Johannes Ballé <joba123@arcor.de>


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-11-21 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-20  0:32 [gentoo-dev] Ebuild programming question Johannes Ballé
2002-11-20  1:15 ` Michael Cummings
2002-11-20  7:52   ` Johannes Ballé
2002-11-20 14:05     ` Karl Trygve Kalleberg
2002-11-21 15:42       ` Johannes Ballé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox