Floodgap's Power MachTen Hacking Page: Rolling a Graphical Browser

What, Lynx isn't good enough for you, you picture-loving elitist snob? More usefully, you don't want to build a client on another machine and then use the ssh we built with X11 forwarding to leverage MachTen's outstanding built-in X server as an X terminal? (Seriously. This is a smashing idea.)

Fine then. First of all, you need to build most of what was on the base recommended software page, not only as prerequisites, but simply because you will go less crazy after you have done, and also you need to be familiar with the gotchas and getchas of building packages on MachTen before you tackle these larger projects.

Once you've done so, we'll pick up with our set here. Remember, we can't really use anything based on modern toolkits such as GTK+, wxWidgets, etc., because we can't compile them (the gcc is too old, among other things). MachTen does include Motif, so we can use that. Before we get that far, however, we have some specific prerequisites we need to build beforehand.

libjpeg (6b)

This is so ancient (comparatively) that it builds pretty much without comment.
./configure --prefix=/opt --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
After this runs, you can optionally change the -O2 in the Makefile to -O3 to get to those Blake Lively JPEGs a microsecond faster. Hawt. Too bad she's a total twit.
make test
su # optional
make install # might bug out with missing directories, this is ok
mkdir /opt/include # if non-existent
make install-headers
mkdir /opt/lib # if non-existent
make install-lib

libpng (1.2.35)

STOP! SHUT DOWN AND BACK UP YOUR MachTen FOLDER NOW! libpng is one of the packages with a GNU configure suite known to crash MachTen! You must patch the configure suite first! (If you don't know how to do this, go back to the base packages page and repeat basic training.)

After you've done that,

./configure --prefix=/opt
make check
su # optional
make install

Now what?

At this point you need to choose what browser you want to build. I offer you a choice of two, both of which are not impossibly old, just appallingly so.

If you have at least 128MB of RAM, I strongly recommend building Mosaic-CK -- yes, it's Mosaic, but it's a pumped up Mosaic, and thanks to my patches it will build out of the box on MachTen and a goodly other smattering of historical OSes. However, it requires such a large base stack allocation to even start up that it is not a good choice for low memory systems and the cheapskates who run them.

If you don't have enough memory for that, or want a prayer of using something that actually supports stuff like CSS, then your best bet is Arena. [Click for a 142K enlargement of this Arena screenshot.]

Arena (beta 3b)

Arena was the W3C testbed web browser before they chucked it and threw in behind Amaya, which is cool, but needs a crapload of widget toolkits and won't work for us. W3C gave it to Yggdrasil to do further development, whereupon the wacky Ygg guys did their impression of a leaf and, well, left; I have not been able to find this source out there, but I would love it if you'd tell me if you have a copy. The Wayback Machine has a copy of the Yggdrasil website, but the source was apparently only available via FTP, depressing us all.

Beta 3B is very syntactically strict (nay, impossibly finicky), supports a very strict basic set of style sheets, maybe even tables on a good day, and occasionally chokes on its own vomit and bombs. Also, it does not know what to do with the current version of libpng, so even though it will try to display them, it does not fully work. I might work on this later when I run out of things to do. If you notice other easily corrected bugs, let me know and I might look at them as well (though I suspect getting the Ygg source would be a better basis).

Alarmingly, Arena includes its own copies of libjpeg, zlib and libpng, but these are buggy and have security holes. Don't let it build or use them! Undoing their well-intentioned inclusion makes our setup is a little complicated. First, edit the BUILD script and add

setenv WWW_MACH unix
Around the block starting with Building Image Directory and the endif after building Image/libpng/$WWW_MACH/libpng.a, either delete it entirely, or bracket it with

if (0 == 1) then

such that this section of the script will not be executed (and delete the Image directory entirely, just in case). Next, go into Library and

mkdir unix
cp sun4/Makefile unix
Edit that Makefile, change WWW_MACH to unix, comment out ASIS_MACH, add -O3 -DNO_TIMEGM -I/opt/include to CFLAGS, uncomment LFLAGS=-static and add -L/opt/lib to it, and finally change BINDIR to /opt/bin.

Next, go into the Arena directory and

mkdir unix
cp netbsd/Makefile unix
Again, edit that Makefile, change WWW_MACH to unix, comment out ASIS_MACH, change CFLAGS to -O3 -I/opt/include, uncomment LFLAGS=-static and add -L/opt/lib to it, and change BINDIR to /opt/bin. Finally, change XLIBDIR to X11R6, JPEGLIB to /opt/lib/libjpeg.a, PNGLIB to /opt/lib/libpng.a, and ZLIB to /usr/lib/libz.a

But wait, now we have to hack the source too! To Library/Implementation/HTMulti.c, add

#include <unistd.h>
to the initial set of preprocessor #includes. Then, add
#define png_error(X,Y) mypng_error(X,Y)
#define png_warning(X,Y) mypng_warning(X,Y)
to Arena/Implementation/png.c and change the function definitions for png_error and png_warning to mypng_error and mypng_warning (or just substitute the names out, your choice).


cp Arena/unix/arena /opt/bin
You will get a lot of libpng warnings; my patch above is just to get it to cooperate, but many PNGs are not viewable, and you might even get a Bus error now and then. Arena was not optimized (for obvious reasons), so even on fast systems you may get a bit of stuttering. But it's not that the dog walked well, as they say.


Okay, so you got sick of that. Now try Mosaic, which lacks the more advanced layout of Arena, but, for lack of a better expression, works better.

Or, run screaming frantically to the safety of the main page.

Cameron Kaiser