Or dig this and help remove remaining gibberish and broken/abandoned links
(problems deliberately left here so they can be fixed if still desired) -
otherwise, for starters, this should be identical to the "old" document. Beware, though - as 4 eyes see more than 2, and so forth, somebody other please proofread this, or just use it as you build KM and fix whatever goes wrong.
(It might be a good idea to put "test used by <your name or nick> here so this notice can be removed once this page is sufficiently tested.)

<a> Documentation</a>

Developers - How to Build K-Meleon

Introduction

This document explains how to build K-Meleon from the source code.

What You Need

Before you can compile the K-Meleon sources, you need to get the Mozilla sources and build them on your system.

To build Mozilla, you have to install a lot of hogwash on your comp, but we'll walk you through it.
Have mercy though if something doesn't work right away.
Since K-Meleon and Mozilla are under constant development, the instructions may change.
Just ask on the K-Meleon Dev forum if something goes wrong.

Note: Your overall download size will total some _ MB.

What you'll definitely need on your system is Visual C++ 6 with service pack 3 or higher.
(It is said that you can also use VC++ 5, but I haven't tried that.
Get Visual Studio 6 Service Pack 5 here: http://msdn.microsoft.com/vstudio/sp/vs6sp5/default.asp (download size ___ MB)

It's also worth noting that as of Spring 2004 Microsoft have made the Visual C++ .NET compiler/linker available for free download from MSDN.
This doesn't include the graphical IDE that the full version of VC++ / Visual Studio contains, but it does have the command-line compiler/linker and all the necessary libraries to compile
VC++ source-code.
The compiler (called the Visual C++ Toolkit by Microsoft) is available from http://msdn.microsoft.com/visualc/vctoolkit2003/ (download size 32 MB)

This is a bit tricky, since the K-Meleon source you will be downloading might not use the latest Mozilla sources,
but some older version. Your chances are best when you get the latest source though, and if something goes wrong,
ask on the K-Meleon Dev forums if someone can point you to the currently used version of the Mozilla sources.

2. Set Up the Directory Structure and Environment

Next, you need to set up the correct directory structure for Mozilla to compile.

First of all, you must create a subdirectory in your projects directory
(the directory where your Visual C++ projects go) named "mozilla" (doh).
This is the home directory for the Mozilla build.

One word about directories: It's recommended that you don't use any directory names
that require putting them into quotes for windows to correctly use them in the absolute path
to the Mozilla home directory. This will most likely break the compilation process.
This means: avoid spaces and special chars in this path.

In this directory, you have to create the following batch file (name it "env.bat"):

=
@ECHO OFF
set CVSROOT=:pserver:anonymous»cvs±mirror:/cvsroot
set HOME=E:\Daten\Source\VC\Mozilla
set MOZ_CVS_FLAGS?=-z3
set MOZ_BITS=32
set MOZ_TOOLS=%HOME%\Mozilla
set OS_TARGET=WINNT
set WINOS=%OS_TARGET%
set _MSC_VER=1200
set DISABLE_TESTS=1
set MOZ_SRC=%HOME%
set MOZ_NO_ACTIVEX_SUPPORT?=1
set CONFIG_SHELL=SH.EXE
set PATH=%PATH%;%MOZ_TOOLS%\BIN
set PATH=%PATH%;%HOME%\PERL\BIN
set PATH=%PATH%;%HOME%CygWin\bin
set PATH=%PATH%;%HOME%\buildtools\windows\include
call "C:\Programme\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
=

Now, you'll have to customize this file so that it fits your local settings:

set HOME to the absolute path to the directory that you just created (\projects\mozilla)

set OS_TARGET to "WINNT" if you are using an NT system, or to "WIN95" if you are using a 9x system

set _MSC_VER to "1200" if you are using Visual C 6, or to "1100" if you are using Visual C 5.

The PATH settings are only correct if you follow the instructions to install
the Perl and CygWin? packages. If you want to install them into other directories
than the ones we advise, you'll have to adapt the path accordingly.

The last line in the batch file calls the batch file that sets up the environment
for Visual C++ - change this so that it points to the correct file on your system.

Extract and install WinCVS - we won't need this tool to build Mozilla, but we need the windows port of CVS.
Copy cvs.exe from the WinCVS program directory into \projects\mozilla\buildtools\windows\bin\x86

Open a dos prompt, change to the Mozilla home directory and run the batch file you just created
("env.bat"). If it gives you errors, you have done something wrong - check all pathes and try again.
If you can't get it to work, ask on the K-Meleon Dev forums.

If you are using a 9x system, you have to tell windows to give the DOS environment more
memory space by typing:

> command /E:4096

on the command prompt or directly running the prompt from "Start" -> "Run" with this parameter.

Change into \projects\mozilla\buildtools\windows and run install.bat.

This will install the Mozilla build tools into \projects\mozilla\mozilla\bin.

The files we just copied to the \projects\mozilla\buildtools\windows\bin\x86 directory
will be copied there, too, so if you delete the Mozilla source, you can simply reinstall
the build tools and the other needed files by running install.bat again.

Now, you should be ready to:

4. Build the Source

Copy mozilla-source.tar.bz2 (or whatever you downloaded from ftp.mozilla.org)
into \projects\mozilla.

Unpack the sources:

> bzcat mozilla-source.tar.bz2 | tar xv

And now, finally:

> cd mozilla
> nmake /f client.mak build_all

Now, get yourself a tea and someone to chat with, this will take a while
(about 45 minutes on my Athlon 500).

If you have troubles compiling Mozilla please consult the http://www.mozilla.org/build/win32.html?
on the mozilla site. There you will also find info on how to compile mozilla using gmake.

Once you pulled the sources form the repository, you should place them into \projects\k-meleon.

After that, you need to open the KMeleon.dsw workspace file and check some settings
(If you get dialog window asking for a urlbar.dsp and windowmanager.dsp file just hit cancel).

Right-Click 'K-Meleon classes' in your class view and select 'Set as active Project'.
Now everything should be ready to compile k-meleon.

Select "Build" -> "Rebuild All" from the menu.

If anything goes wrong, check the following settings: Go to "Project" -> "Settings"
and click on the "C/C++" tab. Choose "Preprocessor" from the Category pulldown menu,
and then enter the following string into the "Additional include directories" textbox:

(No backslashes, these are only used for line continuation in this doc.
Or in one long line for copying directly into your project settings: BuildToolsVCSetupLine? (Can't put his here because of a glitch in the wiki engine that will make all lines as long as the longest line, as it seems)

Yup, it is very long, but you need it. When you are done, click on the
"Link" tab and enter the correct path into the Output file name.
The path must be set to something like

\projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\k-meleon.exe,

but it has to be absolute, so you have to replace the "\projects"
part with the absolute path to your projects directory.

Ok, click "Ok" and build the source ("Build" -> "Rebuild all").

It should build fine now, but of course, anything can go wrong,
and if you don't manage to compile it, you should ask on the K-Meleon Dev forums
(you knew that).

6. Configure K-Meleon

After you have successfully built K-Meleon, you probably want to try it out.
Be warned though, it will miss a few files, and it won't know about your preferences.
To run K-Meleon, you need to do the following:

<Your K-Meleon install dir> is the directory where you keep your work version of the K-Meleon browser. The binary release.