[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

PNG libraries on Mac OS (was Re: [XaraXtreme-dev] Problems with ranlib while compiling XaraLX)

On 21/04/06, Ben Fowler <ben.the.mole@xxxxxxxxx> wrote:
> On 12/04/06, Phil Martin <phil@xxxxxxxx> wrote:
> > We have a lot of problems with png and jpeg libs on the Mac.
> [ snip ]
> > ...but: Doesn't wxWidgets contain those libs?
> ... suggest that at least in the short-term
> wxWidgets be configured to use its built-in libraries, treating Mac OS
> X as a platform without PNG and JPEG, ...
> I will try this out, and provide a patch to the build page.

The setup is not, in fact, how I thought it was, and arguably, I am back
to square one. My major misconception was that I thought that wxWidgets
would expose the internals of its PNG libraries, if necessary by providing
a copy of png.h in its own include directory (it does not).

What wx is doing, it seems to me, is using the specified library (its
built-in one if none other is available) as backing for its wxBitmap class.

I suspect that it would be fruitless to try get wx to provide low level
library routines for PNG and JPEG, and IMHO it would be best to stop
and think what is the best approach rather than trying to push on.

If it is felt necessary to work on the current lines (Xara LX inlcudes
png.h and uses png routines directly) then we will need to specify
a png library. There seems to be three possible approaches.

1. Require devs to install png libraries from fink (in /sw) or
Darwin ports (/usr/opt).

2. Independently install a 'blessed' version of PNG in /usr/local

3. Copy or link the wx PNG sources into our own folder and build
a framework.

Again IMHO, this looks like swings and roundabouts in the sense that
the costs and benefits seem equally balanced. Having said that, my guess
would be that in Gaddesden Place, and building an official release.
policy 2 looks more attractive than either of the others, and you might
want to settle on that plan, and note on the build page that this is how
the official builds are done. Independent devs may not be able to devote a
machine to be configured to match one project, but to be honest anyone
capable of contributing to a Vector Editor is going to be able to link PNG
libraries in their sleep.

This may not be the end of the story. Since wx makes use of PNG only as
backing for its wxBitmap class, there is an over-arching question of why
Camelot needs PNG at all. Whilst I haven't looked at every file, it would
seem plausible that the Kernel should use a Bitmap abstraction (such as
KernelBitmap) which could call through the Oil layer. If, for example,
that layer were to implement its Bitmap services simply by using wxBitmap,
there should be no need for Camelot to call any PNG routines, and no need
for any part of Camelot to include png.h.

I would be tempted to rip out the OILBitmap classes (preserved in amber
perhaps, in case the bitmap code needs to be made pluggable) and replace
with wxBitmap. Of course, even if this were agreed, it is quite possible
that the time is not right, but I hope that my reasoning is clear.

(The same applies to JPEG, TIFF and probably ZLIB).


> > Ben Fowler wrote:
> > >On 11/04/06, Andy Davison <andydavison@xxxxxxxxx> wrote:
> > >>On 11/04/06, Ben Fowler <ben.the.mole@xxxxxxxxx> wrote:
> > >>>On 10/04/06, Andy Davison <andydavison@xxxxxxxxx> wrote:
> > >>>
> > >>However, it still breaks down, this time with:
> > >>
> > >>.././wxOil/outputpng.h:109:17: error: png.h: No such file or directory
> > >
> > >I added the path to my installed png library, using CFLAGS. (Whilst I
> > >think that this is right, and I would hope that the autoconf for Xara
> > >LX is developed to make this more effective), I have a little niggle
> > >in the back of my mind that telling wx to use the fink png libraries
> > >is responsible for part of the badness in Bug 929 "Failure reading PNG
> > >bitmap on Mac".
> > >
> > >You probably have png.h in /sw/include/libpng12 and the libraries in
> > >/sw/lib : If you don't, you might want to install png independently
> > >(the instruction to use fink came from me, and I am not sure whether
> > >it is entirely correct - but I don't see how we can expect developers
> > >to remove chunks of their fink installation just to compile Xara). I
> > >really would like to see some clarity on this, and I fear that it may
> > >mean some work doing that there is nobody yet available to do!
> > >
> > >If you do decide to install png on a different path, you will have to
> > >choose a PREFIX for it; whilst /usr/local is appealing, I could only
> > >wholeheartedly recommend this on a machine that you are not using for
> > >any other development, which is not a likely state of affairs. You
> > >could try somewhere in your home directory, as with the wx libraries.
> > >
> > >You may have the same problem with the JPEG libraries, and you can
> > >assuredly work on the same lines.