This document explains how to build K-Meleon from the source code.
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)
To build Mozilla, you need to download the following tools:
-- for Windows 9x systems: http://www.activestate.com/download/contrib/Microsoft/9x/InstMsi.exe (download size ___ MB)
-- for Windows NT/2000/XP systems: http://www.activestate.com/download/contrib/Microsoft/NT/InstMsi.exe (download size 1.5 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.
For now, try this file:
http://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest/mozilla-source.tar.bz2 (download size 26 MB as of version 1.7, could be higher now)
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:
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.
Install CygWin? into \projects\mozillaCygWin
You'll need to select (or rather, unselect everything but) following:
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:
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.
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:/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:
(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
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).
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>\profiless This will tell the build to use your profile so that you don't lose your settings.
Ok, that should be it. Have fun!
"design by splif. Last updated: 19 Apr, 2004"
copied to the wiki and roughly edited (not tested yet) by kmbr4711