Accueil du site > INFORMATIQUE > HOW-TO build PEARDOC on Windows

Ce document n’est disponible qu’en version anglaise.

HOW-TO build PEARDOC on Windows

lundi 5 septembre 2005, par Thierry Bothorel

I proposed to the PEARDOC team in 2004 to add a FAQ entry to explain how to build the PEAR manual on Windows. Although I do not contribute to the PEAR manual for quite a while, it seems some people still refer to this document I previously published at http://www.thierrybo.freesurf.fr/di…. As some links seems broken, I decided to publish an updated version here.

1.16. I use Windows and I want to test my xml files before commiting

Although Cygwin tools should provide the same needed tools found on Linux, it is grown to be a very huge project and it includes many programs which are not needed for peardoc. Also it implies that you have a knowledge of Linux tools. If you select this choice, read section 1. If you want a simple solution to test single xml files on Windows, read section 2.

1.16.1. Installing the Tools to build the whole manual

Follow these steps to achieve a working Cygwin installation. They will guide you through the process of installation. These tools are port of standard Unix tools like sed, awk, autoconf, make, perl, … for Windows.

Warning

This step by step installation is intended for windows users just willing to use Cygwin to build the manual, with no or just a few unix knowledge, and getting their peardoc cvs sandbox from a windows tool like TortoiseCVS. So beware, some installation choices may NOT be appropriate for "hard core" unix developers,as they will likely use cvs command line in Cygwin.

Note

Be aware, that Cygwin is grown to be a very huge project and it includes many programs (such as postgres and apache) ported to Windows, which are not needed for peardoc. We are unable to give you a list of needed components from cygwin (which you should download and install), because the basic tools are interconnected, and depend on each other. If you manage to find the smallest needed installation, do not hesitate to contact us, and send the solution to us. Since the default value for each option is the logical choice for most installations, you can get a working minimal Cygwin environment installed by simply clicking the Next button at each page. The only exception to this is choosing a Cygwin mirror.

  1. You need to download and install the Cygwin tools. Just go to http://www.cygwin.com/ and select the "Install now !" link and download the file "setup.exe" (usually right click, "Save as..". in your web browser) to an empty directory. This directory will later hold all the archives that the installer downloads. Therefore you should not use a temporary directory for this purpose, but one that you keep in place, e.g. "C :\cygwin-install".

  2. Start setup

    Log in as an administrator, connect to the internet, and run "setup.exe". Select the "Install from Internet" option.

  3. Download and install the packages

    The setup dialog will ask you for the "install root directory". All Cygwin files will be installed in a hierarchy below this directory. Use something like "c :\Programs\cygwin".
    Important : change the "Default text file type" to DOS
    .

    Note To avoid problems, if your sandbox use "DOS" files, install Cygwin with DOS type text file, and if your sandbox uses UNIX files, install Cygwin with UNIX type text files.

    Keep the other option "Install for : all".

    If you are not behind a firewall, click on direct connection, then click Next

  4. Select the main mirror

    Next, you will be presented with a listbox of available mirrors. Select one close to your home for main cygwin packages. If you have problems connecting, try a different mirror.

  5. Select specific mirror for docbook tools

    Within the same screen, type in the bottom box : http://t.bothorel.free.fr/cygwin then click Add. Notice that you have now 2 selected mirrors , scroll the window to make sure they are selected. You can select multiple mirrors by holding down CTRL and clicking on each one. If this url does not work, please add a comment at the bottom of this page. You can try this other mirror also http://drewish.com/projects/cygwin/. It seems previous mirrors are not working any more ( http://www.thierrybo.freesurf.fr/cygwin or http://ns1.iocc.com/ joshua/cygwin/… ).

  6. Package selection

    Finally, you will get a listbox with available packages. They are organized in groups that can be opened by clicking their names. You definitely want the base package (leave default choices).
    Next, you have to select 6 additional packages :
    - 4 in Text category : docbook-dssl, docbook-sgml, openjade, sgml-base, and
    - 2 in Devel category : autoconf and make

  7. Click on "Text" to open the category.

  8. Browse to the line "docbook-dssl : DSSL style sheets …".

  9. Click on "Skip". This should replace "skip" with "1.76-1" (or newer) and the first check-box should be checked. You are done. For Text category, just select this one, and all three other packages should be automatically selected. Browse the category to verify that docbook-sgmlsgml-base and openjade packages are selected.

  10. WarningWhen I wrote the first draft of this document, "openjade" package was missing, or if one was available, it was the same version as the one I provide on http://t.bothorel.free.fr/cygwin. However at the time I updated this HOW-TO, Cygwin installer found a newer "openjade" package that seems available. You should see the version number "1.3.3-1" (or newer) on the "openjade" line. I was NOT able to successfully build PEAR manual with this version, all output goes to the screen. Instead click on "1.3.3-1" and this should switch to "1.3.1-1".

  11. Repeat from step 7 to select Devel:autoconf and Devel:make packages.
  12. Then click Next button on each page. Don’t worry if you see packages downloads you have not selected. Package dependancies are automatically selected.

  13. Copy your existing peardoc sandbox directory to
    C :\Programs\Cygwin\home\<your_windows_user_name>.

    If you don’t have your snapshot yet, execute your CVS tool to checkout your peardoc sandbox.

    Again, I make the assumption you still want to use Wincvs or TortoiseCVS and don’t want to use command line CVS from within Cygwin.

  14. Run Cygwin

    Run "Cygwin Bash Shell" command from the Programs menu (it will be added here by the previous step). From now, it is just like the unix way. You get a command line which behaves same as bash on Unix boxes. If you never worked with bash or Unix before, note that there are slashes (/) instead of backslashes (\) in paths. If you want to access the foo directory on drive c : write it as c :/foo instead of c :\foo.

    Warning

    Do NOT use symlinks with Cygwin, it’s buggy. (the shell doesn’t handle them very well either)

    Warning

    Running "Cygwin Bash Shell" will open a shell in your HOME directory. On Windows XP, this directory maps on the directory specified in §13. On Windows 2000, this is C :\Documents and Settings\<your_windows_user_name>\. Please change your peardoc directory in §13 if you use W2000.
    If for whatever reason you set an environment variable named HOME, Cygwin bash shell will open within the directory specified in your HOME variable.

  15. Change to the directory where your peardoc snapshot is (or where you want to have it). Use, just like in Windows, the cd command. In Cygwin, the dir command is also supported : cd peardoc

  16. Type

    $ autoconf
    $ ./configure [—with-lang=your_language_code]
    $ make [html|bightml|test]

    Substitute your_language_code with a language code you checked out the files of, and would like to work on. The —with-lang parameter is optional. If you don’t specify it, the default is en (English).

    Make html’ (or ’make’) will produce a bunch of html files, whereas ’make bightml’ will produce only one html file named pear_manual_your_language_code.html.

    If you didn’t get any errors, you’re ready to rock&roll. Otherwise, you could check out the installation appendix of "DocBook : The Definitive Guide". if you think that the problem is in the build system, ask on the mailing list.

  17. Open the file
    C :\Programs\Cygwin\home\<your_windows_user_name>\peardoc\html\index.html with your favorite web browser and see the result !

1.16.2. Installing the Tools to build single xml files

Basically, you will have to install the DTD Docbook, Jade and Docbook Stylesheets :

  1. Install DocBook XML OASIS Standard DTD

    Go to the The DocBook Document Type expressed in XML page at http://www.oasis-open.org/docbook/xml/ and follow the link to the latest DocBook XML DTD (ie. V4.2). Then download the zip archive and unzip in C :\Programs\Docbook.

  2. Install Jade DSSSL engine

    Go to http://www.jclark.com/jade/#getting page and download the current binary distribution. Then unzip in C :\Programs\Jade .

  3. Install DocBook DSSSL stylesheets

    Follow the link http://sourceforge.net/project/showfiles.php?group_id=21935 and download the current docbook-dsssl package (ie. docbook-dsssl-1.78.zip). Then unzip in C :\Programs\Stylesheets\Docbook-dsssl.

  4. Install the Linux Documentation Project customized version of the DocBook DSSSL Style Sheet

    You can find the latest copy of the file at http://www.tldp.org/authors/tools/ldp.dsl. Once you have the file ldp.dsl, edit the following line (#6) to the file by bringing it up under your favorite text editor :

    < !ENTITY docbook.dsl PUBLIC
     "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
    CDATA dsssl>
    ]]>
    < !ENTITY % print "INCLUDE">
    < ![%print ;[
    < !ENTITY docbook.dsl PUBLIC
     "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
     CDATA dsssl>

    to

    < !ENTITY docbook.dsl SYSTEM 
    "docbook.dsl"
    CDATA dsssl>
    ]]>
    < !ENTITY % print "INCLUDE">
    < ![%print ;[
    < !ENTITY docbook.dsl SYSTEM
    "docbook.dsl"
    CDATA dsssl>

    Then place it in C :\Programs\Stylesheets\docbook-dsssl\html and in C :\Programs\Stylesheets\docbook-dsssl\print .
  5. Adjust PATH

    Change the PATH system environment variable to include the Jade directory. This is done via the system settings. Select the "Environment" tab in the System dialog, click on the PATH entry in the upper pane (System variables), and append the path, e.g. C :\Programs\Jade, to the semicolon-separated list. Click Set and close the dialog box.

  6. Create SGML_CATALOG_FILES

    Create a SGML_CATALOG_FILES system environment variable. These catalog files are used to resolve public identifiers to local filenames. In the Environment tab of the system dialog enter SGML_CATALOG_FILES as a new variable name in the upper pane. The value of this variable is a semicolon-separated list of catalog files. Be aware that this variable is not a list of directories that contains catalog files, but rather a list of the paths of individual catalog files. Set the value of the environment variable as follows :

    C :\Programs\Jade\catalog ;C :\Programs\Docbook\docbook.cat ; _
    C :\Programs\Stylesheets\Docbook-dsssl\catalog
  7. Create a docbook2html.bat file

    Create a batch file named docbook2html.bat file in your system PATH, ie.

    C :\Programs\Jade\. Then enter theses lines :

    @echo off
    echo Build HTML …
    jade -t sgml -d C :\Programs\Stylesheets\docbook-dsssl\html\ldp.dsl#html %1%.xml
    echo Done
  8. All done ! (don’t forget to boot your system so that system knows your new environment variables)

  9. How to use

    First open a NT command-line window. Change into the directory which contains your xml files and type the following command (without .xml extension) :

    c :\yourfolder> docbook2html xml_file_name

    Jade should create several files in the current directory. Open index.html to see the result.

    Don’t worry about general entity and reference to identity errors. Peardoc xml files are not designed to be built individually, then <link/> are not shown and <ulink/> have empty urls, but at least you got the overall look and feel of your files, and you can test your xml tags.

Note I just saw that the PEARDOC team now provide a PHP script to build only some parts of the manual. This was not available at the time I wrote this 1.16.2 part, so have a look at this solution also. See "Partial builds" at
 http://pear.php.net/manual/en/developers.documentation.php

P.-S.

Please if you have any problems with the url for my docbook package (well I just collected files and repacked them !), please leave a message at the bottom of this page. Currently this is http://t.bothorel.free.fr/cygwin , but as for the former one at http://www.thierrybo.freesurf.fr/di… , these free hosting services can stop availability of these files.

Répondre à cet article | RétroLiens :0


Répondre à cet article