Subject: Re: Unneeded dependencies on MesaLib
To: Jonathan Schleifer <jschleifer@gmail.com>
From: Adam <adam@albedo.art.pl>
List: tech-pkg
Date: 07/25/2005 00:01:58
> I just wanted to play a bit foobillard over ethernet on an accelerated
> display, but I had only about 0.5 fps. So I looked further into this
> and found out that it dependes on MesaLib, which is pure software
> rendering. I also found out that /usr/X11R6/lib/libGL.so.1 exists, so
> there's no need for MesaLib. If MesaLib is installed, MesaLib's
> libGL.so is used instead of X11's. That's why I just removed it, but
> this raised very strange behaviour:
> ldd /usr/pkg/bin/zsnes shows that it now uses
> /usr/X11R6/lib/libGL.so.1 instead of MesaLibs's
> /usr/pkg/lib/libGL.so.1 which is just fine, but ldd
> /usr/pkg/bin/foobillard shows this:
> -lGL.1 => /usr/X11R6/lib/libGL.so.1
> -lGL.1 => not found
> ldd zsnes only shows the first line. So I thought I'd just have to
> recompile foobillard without MesaLib and removed that .include
> "../../graphics/MesaLib/buildlink3.mk" in the Makefile.
> Even after this, it still wanted MesaLib, so I looked further into it
> and found out that GLU, GLUT, SDL and many more also depend on
> MesaLib. Even those don't need it if /usr/X11R6/lib/libGL.so.1 exists.
> I also found out that the libGL.so.1 that comes with X11 is also on
> unaccelerated displays much faster than MesaLib. With MesaLib, I get
> about 144 fps on my unaccelerated notebook, without it, I get about
> 224 fps.
>
> That's why I would suggest the following:
> It would be better if there would be mk/gl.mk and that would be
> included instead of MesaLib's buildlink3.mk.
> This file should check if /usr/X11R6/lib/libGL.so.1 exists, and if it
> does, then this one is used. If it doesn't exists, then MesaLib is
> built and used.
> This way, it would be possible to use X11's faster libGL.so, that even
> has acceleration on remote displays, on machines with X11 and to use
> MesaLib on machines without X11 (for example for svgalib). Also, it
> would be possible to run GL games and apps on accelerated remote
> displays, which is very fast. If someone really wants MesaLib on X11,
> it's still possible to install it manually and then MesaLib is used.
>
> Please also post your ideas. Maybe it's all my fault and I've overseen
> something important? Any feedback is welcome!

Yes, this is a good idea. I've had something similar rolling on my  
mind, but just didn't have the time to take a look at it. :)
The important thing is, X11 and Mesa are not the only one OpenGL  
implementations around.  I would like to see pkgsrc using OpenGL  
framework on Mac OS X (where I manually disable MesaLib dependencies,  
like in SDL), and I believe IRIX has it's own set of libraries as well.

Any suggestions here? Would mk/opengl.buildlink3.mk be better than an  
opengl meta-package?

Cheers,
Adam