Subject: Re: fluxbox and -funroll-loops
To: None <tech-pkg@NetBSD.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 09/01/2004 07:39:43
On Tue, Aug 31, 2004 at 10:30:12AM -0400, Jan Schaumann wrote:
> 
> I don't think that's necessary.  I don't believe that our packages
> should try to compile every package with every possible CFLAG and then
> add the necessary transforms just in case the user chooses to add that
> CFLAG manually.
> 
> <strawm?n>
> Are we going to add
> 
> BUILDLINK_TRANSFORM+=	rm:-illegal-flag
> 
> on the off chance that the user adds "-illegal-flag" to his/her CFLAGS?
> </strawman>
> 
> ,-)

Imagine this conversation:

       User: Is it okay to add -funroll-loops to my CFLAGS in
             /etc/mk.conf?
  Developer: Yeah... but some packages will break.
       User: Well, how do I know which ones?
  Developer: Well, if it breaks when you're building, you know.  Or
             sometimes we document it in the package Makefile.  Or you
             could go search the Internet for some answers.
       User: Uh... that sounds kind of time-consuming.  I was just
             hoping to make a bunch of packages overnight because it
             takes a while to build these packages.
  Developer: Oh, well... tough break, kiddo.
       User: Hrmmph... well, after I find out which packages break,
             how do I build those?
  Developer: You have to edit CFLAGS in your /etc/mk.conf and remove
             -funroll-loops before building these packages.
       User: But some of those packages are dependencies for other
             packages I want to build.  I want those to build using
             -funroll-loops.
  Developer: Well, you'll have to edit your CFLAGS setting between
             builds of your packages to use the right ones for each
             package.
       User: Uh... that sounds _really_ time-consuming.
  Developer: Oh, well... tough break, kiddo.
       User: Hrmmph...

Now imagine this conversation:

       User: Is it okay to add -funroll-loops to my CFLAGS in
             /etc/mk.conf?
  Developer: Yes.
       User: Thanks!
  Developer: Keep in mind, though, that some packages can't actually
             build with -funroll-loops.
       User: Oh?  What do I have to do?
  Developer: Oh, no worries... those packages know to build themselves
             without -funroll-loops, so you don't have to do anything.
       User: Sweet!
  Developer: mmm... pkgsrc
       User: mmm... pkgsrc

Basically, I can't think of a compelling reason not to do this, since
it's so easy to do.  I think it's worthwhile because then we're not
basically restricting users to setting CFLAGS in /etc/mk.conf to some
lowest common denominator of compiler optimization options across all
packages he might wish to build.  We don't have to go out of our way
to hunt down these bad option/package pairs, but when we notice them,
it's rather easy to just fix it.

We could probably do a better job of organizing some of this material.
Right now, we stick all of this stuff in the package Makefiles
themselves, but this makes those Makefiles somewhat lengthy and harder
to understand.  We also document some of it in pkgsrc/doc/HACKS, but
mostly this file is just duplicate information to what's in the package
Makefile.  Maybe we should gather all of these workarounds into Makefile
fragments and separate them out of the main package Makefiles, e.g.
wm/fluxbox/hacks.mk, and we could have bsd.pkg.mk include hacks.mk if
it exists.  It becomes somewhat clearer which packages need workarounds
for build problems, i.e. "find /usr/pkgsrc -name hacks.mk".  If we
choose to do this, then I'll point out that this is a fairly easy
project for someone with a bit of spare time.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>