Mozie: Build Instructions for the Mozilla XUL/SVG ActiveX Control/Plugin for MSIE

Background

Gear icon Official instructions for building Gecko can be found at: http://developer.mozilla.org/en/docs/Build_Documentation. The closest thing to documentation on building specifically the Mozilla ActiveX control can be found inside the Mozilla source tree in embedding/browser/activex/src/install/README.txt. These instructions are slightly outdated. The build procedure will vary, depending on exactly what functionality you want to include in the control.

The information on this page has become partially obsolete. Please download the free Ssrc SVG plugin for MSIE for a commercially supported version of the software.

The procedure described in the README.txt file involves building the embedded browser distribution. That is probably what you should do. I wanted to build xulrunner and didn't want to go through multiple compiles, so the instructions I'll provide are for a combined xulrunner/plugin build. That's fine for developers, but you probably don't want to distribute a full xulrunner distribution to your customers if all they need is an SVG plugin. Therefore, I will go back and produce a plugin-only distribution and document how to build it. Until then, here's how to do it by building xulrunner.

Prerequisites

There exist a lot of different combinations of Windows versions and compiler environments. The only combinations supported by Mozilla are documented at: http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites. Make sure you have one of the supported compilers and operating systems. I built Mozie using VC7.1 (Visual Studio 2003) on Windows Server 2003 and tested the resulting binary on Windows XP SP2. It's not clear to me whether or not it's possible to build on Windows Vista.

Pre-build Checklist
  1. Obtain a copy of the Mozilla source code. Donwloading a tarball of the Firefox source code will not work. It's difficult to figure out where to get the definitive Mozilla source, but you can get the latest source or a tagged snapshot from the stable integration tree at: http://hg.mozilla.org/mozilla-central/. You will need to clone the repository using the Mercurial source code management client. To avoid placing undue load on the Mozilla repository server, you should keep a copy of your checkout and only issue update requests in the future to avoid performing a complete checkout.

    You will need several hundred megabytes of hard drive space available to store the source code tree and about 1.5 Gigabytes to store both the source and compiled code.

  2. Download and install the latest MozillaBuildSetup installer from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/. This will install the MinGW MSYS environment, providing the minimum support tools required, such as bash and gmake. Also, it will install the NullSoft Installer, which will be used to package the plugin.

  3. Contrary to the Mozilla win32 build documentation, you do not need to install the Microsoft Windows Vista SDK. You do, however, need to obtain the Microsoft Windows Server 2003 R2 Platform SDK. That may take a little work because the MSDN Web page for the platform SDK now contains the Vista SDK. If you're not already running Vista, I recommend avoiding the Vista SDK at all costs (unless you're building inside of a throwaway VMware system) because it could produce a lot of unintended consequences.

    When you install the Windows Server 2003 R2 Platform SDK, you must install the core SDK, the IE Web Workshop API, and the Data Access Services SDK. Otherwsie, the build will fail.

  4. Open a command prompt and run vcvars32.bat to setup the Visual C++ environment. Then run the platform SDK's SetEnv.Cmd command. I ran it with the following arguments:

    SetEnv.Cmd /XP32 /RETAIL
  5. Assuming you installed MozillaBuildSetup to the default location, run:

    c:\mozilla-build\start-msvc71.bat

    If you're using a different compiler version, run the batch file for the version that matches your compiler.

    The command should open an rxvt window with a shell prompt. This shell should inherit the environment from the command prompt window and be ready to build the software. In my case, the rxvt window did not display text correctly, so I could not use it. Instead, after running the command, I closed the rxvt window. The command prompt window obtained all of the necessary environment variables from running the start-msvc batch file. Therefore, I changed to c:\mozilla-build\bin and ran

    bash --login -i

    If you have a home directory with a .bash_profile and .bashrc (perhaps mounted from another computer), unset your HOME environement variable before running bash. Otherwise, your .bash_profile and .bashrc will be executed, possibly ruining your build environment.

Build Procedure

  1. At the top of the source tree create a file called .mozconfig with the following content:

    . $topsrcdir/embedding/browser/activex/src/install/mozconfig.txt export MOZ_CO_PROJECT="xulrunner" mk_add_options MOZ_CO_PROJECT="xulrunner" ac_add_options --enable-application=xulrunner ac_add_options --enable-svg ac_add_options --disable-javaxpcom ac_add_options --disable-vista-sdk-requirements

    The --disable-vista-sdk-requirements option is essential for building without the Vista SDK or the build will fail for not being able to find wpcapi.h.

    For a non-xulrunner build, change --enable-application=xulrunner to --enable-application=browser. Also, change xulrunner to browser in the MOZ_CO_PROJECT lines.

  2. Next:

    touch .mozconfig.mk .mozconfig.out make -f client.mk build

    After several hours (depending on how fast your computer is), you may run into an error creating dist/lib/softokn3.chk and dist/lib/freebl3.chk. If that's the case, you must run the failed commands manually. For example:

    nss/shlibsign -v -i dist/lib/softokn3.dll nss/shlibsign -v -i dist/lib/freebl3.dll

    Then resume compiling with:

    make -f client.mk build
  3. After the build completes, copy embedding/browser/activex/src/install/client-win to embedding/config. Then:

    cd embedding/config make
  4. Next, adjust this mozie.xul.patch patch file to match your setup and apply it. The patch adjusts the packaging to include the xulrunner distribution. When building without xulrunner, the Embed directory should be left alone.

    Now, set your MOZ_SRC environment variable to the top of the source tree. For example:

    export MOZ_SRC='c:\src\mozilla'

    Run the build.pl command from the embedding/browser/activex/src/install/ directory. This will create the MozillaControl….exe plugin installer.