G'day,

I'm experimenting with building the Mozilla platform for Darwin/X11.
More specifically, I want my Thunderbird instance, which currently
happily sits in Aqua, to live in my X session.

At one stage in the past, though, the platform could compile for
Darwin/X11.  MacPorts has a listing for `thunderbird-x11` which is
best summarised as follows:

    > port info thunderbird-x11
    thunderbird-x11 @2.0.0.22 (mail, x11)

Yes, that's right: 2.0.0.22.  Let me, thus, rephrase: at one stage in
the _distant_ past. 

I've spent the last few days experimenting with building the platform
for Darwin/X11.  I started by effectively building the way that the
MacPorts Portfile suggested, and added a few more autoconf flags along
the way:

    PKG_CONFIG_PATH=$HOME/Applications/lib/pkgconfig \
    CC=clang CXX=clang++ \
    CFLAGS="-I$HOME/Applications/include -I/opt/X11/include 
-I/opt/local/include" \
    LDFLAGS="-L$HOME/Applications/lib -L/opt/X11/lib -L/opt/local/lib" \
    ./configure --prefix=$HOME/Applications --enable-application=mail \
    --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib \
    --enable-official-branding --disable-static --enable-shared \
    --enable-default-toolkit=cairo-gtk2 --enable-xft --enable-freetype2 \
    --enable-xinerama --with-pthreads --enable-gnomevfs \
    --enable-postscript --disable-prebinding --disable-debug \
    --enable-strip --enable-optimize='-O3' --disable-tests \
    --with-default-mozilla-five-home=$HOMe/Applications/lib/thunderbird \
    --with-system-zlib=/opt/local --disable-plugins \
    --with-system-nspr --with-nspr-prefix=$HOME/Applications \
    --with-system-nss --with-nss-prefix=$HOME/Applications \
    --enable-xterm-updates

That _seems_ to run stably.  A few notes on this:

- Many of these flags are copied straight out of the MacPorts
  Portfile, and in an ideal world, many of them could probably be
  trimmed safely.

- I cranked up the optimisation level, although in hindsight, I should
  have probably stuck to a full-debugging configuration to weed out
  the inevitable segfaults. 

- Configure doesn't seem to search for X properly, necessitating
  manually specifying the location of the X libraries and includes.
  I'm still not entirely sure why.

- I've enabled freetype2.  MacPorts disables this, but I see no issue
  with it; the version of freetype2 shipped with the X server seems to
  work properly, so likely this is a holdover from a broken X server.

- I build my own NSPR and NSS instances, but I suspect it's safe to
  use the ones in-tree.  I haven't tried this.~

- None of the countless libjpeg's or libpng's I found on my system are
  compatible with the platform; none of the libpng's have APNG on, and
  no libjpeg's supported JCS_EXTENSIONS.  There also are no knobs in
  MacPorts to turn these on.  I decided to stick to the in-tree
  libjpeg and libpng. 

- MacPorts specifies use-system-cairo.  We all know how that ends up.
  I opted for the in-tree Cairo.

- I know I'm not meant to use "official" branding.  I'll just idly
  slap myself on the wrist.  And, in any case, because I'm using the
  18.0b1 source bundle, forked from comm-beta, it only has Aurora
  (well, Earlybird) and Nightly brandings. 

I cannot remember offhand what the first build error was.  I've run
make in `mozilla` and subdirectories about 400 times so far, each time
correcting for at least one error, if not more. 

My observations are as follows:

- It seems that the platform code effectively flags that any sign of
  Darwin means XP_MACOSX needs to be set, and because there is
  effectively no need for there to be any separation of Cocoa from
  XP_MACOSX, it appears almost impossible to build _on_ Darwin
  _without_ Cocoa. 

- Separating out XP_MACOSX is not as simple as disabling it in
  mozilla-config.h.  Trust me.  I tried.

- In hindsight, I suspect many of the errors I saw were issues that
  GCC would never have picked up.

- The QuickDraw framework is deeply embedded in NPAPI for Cocoa.  The
  --disable-plugins flag does not disable NPAPI.

- There's a sizeof(sockaddr_un::sunpath) buried deep within the
  Chromium IPC code which causes clang to barf; this appears to be an
  issue with Darwin itself. 

- Getting mozilla/gfx (Thebes) to pick the right graphics library is
  annoying and painful. 

- ... and many others.

These tasks are make much harder by the fact that I'm running a full
version of Mac OS X, Cocoa and all, and thus it's hard to tell which
bits I actually need to disable. 

There's remarkably little documentation of this usecase, which is
hardly surprising considering how rare it must be.  But, are thare any
tips for getting at least the platform to compile and run in this
situation? 

Cheers,

Jashank

--
Jashank Jeremy
PGP: 0x25A5C309

Attachment: pgpVnd09QbfET.pgp
Description: PGP signature

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to