HOW TO COMPILE THE HTML VALIDATOR

The HTML extension uses some C / C++ code that need to be recompiled on each platform.
The extension is available on Windows and Linux.
There is a forum discussing the compilation issues  : here.

For Firefox 4.0 instructions, see here : http://www.htmlpedia.org/wiki/FirefoxCompilation

Download the source code

OLD INSTRUCTIONS

For other platforms, the solution is to compile the extension.

Step 1 - Download Firefox or Mozilla source code

To compile the extension, we need to compile Firefox or Mozilla.
To do this, we have to download the source of Firefox or Mozilla and follow the build instruction of Firefox or Mozilla

Here is the start point.

When you have downloaded all, and setup all to allow to compile the source. First and before to begin, please compile Firefox completely and check that is works.
After this you will have a "mozilla" directory with the source of Firefox or mozilla.

Step 2 - Include the source of the HTML Validator

Download the source code
The source of the extension is divided in 2 directories:

Description
Directory
C part of the extension mozilla/extensions/tidy
Javascript/XUL part of the extension tidy_extension

The goal is to have this hierarchy of directories:

+  build directory
    +  firefox
        +  mozilla  (this contains the source of Firefox)
            + ...
            + extensions
               + tidy  (this contains the C part of the extension)
    + tidy_extension (this contains the javascript part of the extension )

To do this:
0. place the Firefox source code in <build directory>/firefox.
1. copy the C part of the extension (mozilla/extensions/tidy) in <build directory>/firefox/mozilla/extensions/tidy
2. copy the Javascript part of the extension (tidy_extension) in <build directory>/tidy_extension
3. if you are running on Unix, set the chmod properties correctly

 chmod +x tidy_extension/build_xpi.sh
 chmod +x firefox/mozilla/extensions/tidy/build_all.sh

4. edit the file allmakefiles.sh in the root of mozilla and add the list of the Html Validator makefiles.

allmakefiles.sh
[...]
        sql ) MAKEFILES_extensions="$MAKEFILES_extensions
            $MAKEFILES_sql"
            ;;
        tidy ) MAKEFILES_extensions="$MAKEFILES_extensions
            extensions/tidy/Makefile
            extensions/tidy/src/Makefile
            extensions/tidy/test/Makefile
            " ;;
[...]


5. Edit the files configure and configure.in and add mozilla in the list of extensions. Look for MOZ_EXTENSIONS_DEFAULT. Take care that this line is present several times in the 2 files in newer firefox version

configure and configure.in
Old:
MOZ_EXTENSIONS_DEFAULT=" cookie ... negotiateauth"

New:
MOZ_EXTENSIONS_DEFAULT=" tidy cookie ... negotiateauth"

In Firefox 2, you will need to replace this line several times in the both files, this command can help to find all lines
> grep MOZ_EXTENSIONS_DEFAULT config*

6. If the file browser/config/mozconfig exists, add tidy to extensions list

browser/config/mozconfig
Old:
ac_add_options --enable-extensions=cookie,xml-rpc,xmlextras,pref,...

New:
ac_add_options --enable-extensions=tidy,cookie,xml-rpc,xmlextras,pref,...

Step 3 - Build mozilla

Go in the root mozilla directory and run configure.
> ./configure

First go to extension/tidy
and run :
> ./build_all.sh
or > build_all.bat

The build first will build the opensp library then will fails. But it will create the opensp library that Firefox build will need.

Rebuild Firefox:
> make -f client.mk build


and check the you can start it.

Step 4 - Make the XPI - tidy_firefox.xpi

Go in tidy_extension and depending of the platform run :
> ./build_xpi.sh or build_xpi.bat

The result will be a tidy_mozilla.xpi and a tidy_firefox.xpi

Step 5 - Install in your browser

Start Firefox or Mozilla and
  • Open file, choose the XPI file
  • Install the extension
  • Restart the browser.
  • Open a page
  • Press CTRL+U  (View Page Source)
And it should be there.

Problems / Comments

Please sent any comment to mgueury@skynet.be