Get Involved

SourceForge Logo
Spam Chongqed








Documentation - Developers - How to Build K-Meleon


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. What you'll definately 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:

1. Get the Tools

To build Mozilla, you need to download the following tools:

Netscape Wintools



MSI installer
http://www.activestate.com/download/contrib/Microsoft/9x/InstMsi.exe for Windows 9x systems
http://www.activestate.com/download/contrib/Microsoft/NT/InstMsi.exe for Windows NT systems


Cygwin utils



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. For now, try this file:

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"):



set CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
set HOME=E:\Daten\Source\VC\Mozilla

set MOZ_BITS=32
set MOZ_TOOLS=%HOME%\Mozilla
set _MSC_VER=1200


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.

3. Install the Tools

Install CygWin into \projects\mozilla\CygWin

You'll need to select (or rather, unselect everything but) following:
* ash
* bzip2
* cygwin
* diff
* fileutils
* gawk
* grep
* sed
* sh-utils
* tar
* terminfo
* textutils

Run the MSI installer, if your system doesn't support .msi files already.

Install ActivePerl into \projects\mozilla\Perl

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

Extract zip23xN.zip and copy zip.exe into \projects\mozilla\buildtools\windows\bin\x86

Extract unz542xN.exe and copy unzip.exe 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 build docs on the mozilla site. There you will also find info on how to compile mozilla using gmake.

5. Install and Build K-Meleon

Next, you need to pull the latest K-Meleon sources from the CVS repository. You can either do that manually or use WinCVS (http://www.cvsgui.org/). For information on how to use CVS, check out http://sourceforge.net/cvs/?group_id=14285 (The CVS Root is :pserver:anonymous@cvs.kmeleon.sourceforge.net:/cvsroot/kmeleon ; the module called k-meleon)

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:

../mozilla/mozilla/dist/include/docshell, ../mozilla/mozilla/dist/include/dom, ../mozilla/mozilla/dist/include/embed_base, ../mozilla/mozilla/dist/include/exthandler, ../mozilla/mozilla/dist/include/find, ../mozilla/mozilla/dist/include/gfx, ../mozilla/mozilla/dist/include/helperAppDlg, ../mozilla/mozilla/dist/include/intl, ../mozilla/mozilla/dist/include/layout, ../mozilla/mozilla/dist/include/necko, ../mozilla/mozilla/dist/include/nkcache, ../mozilla/mozilla/dist/include/pref, ../mozilla/mozilla/dist/include/profile, ../mozilla/mozilla/dist/include/shistory, ../mozilla/mozilla/dist/include/string, ../mozilla/mozilla/dist/include/uriloader, ../mozilla/mozilla/dist/include/wallet, ../mozilla/mozilla/dist/include/webBrowser_core, ../mozilla/mozilla/dist/include/webbrowserpersist, ../mozilla/mozilla/dist/include/webshell, ../mozilla/mozilla/dist/include/widget, ../mozilla/mozilla/dist/include/windowwatcher, ../mozilla/mozilla/dist/include/xpcom, ../mozilla/mozilla/dist/include/nspr

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. Copy <Your K-Meleon install dir>\components\txmgr.dll to \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\components Copy <Your K-Meleon install dir>\nssckbi.dll to \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin

Rename <Your K-Meleon install dir>\chrome\embed.jar to embed.zip, and unpack it. Rename \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\chrome\embed.jar to embed.zip, and unpack it. Copy the unpacked files from <Your K-Meleon install dir>\chrome\embed (or wherever you put them) into \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\chrome\embed, overwriting the existing stuff. Zip \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\chrome\embed to \projects\Mozilla\mozilla\dist\WIN32_O.OBJ\bin\chrome\embed.zip, and rename it to embed.jar.

Run your K-Meleon build as follows:
k-meleon -profilesDir <Your K-Meleon install dir>\profiles
This will tell the build to use your profile so that you don't lose your settings.

Ok, that should be it. Have fun!

Last updated: May 15, 2002
Created: December 15, 2001

(c) 2000-2001 kmeleon.org. All rights reserved.
design by splif.