| 10 |
Prerequisites |
Prerequisites |
| 11 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
| 12 |
|
|
| 13 |
|
An easy way to get a system ready to compile CDuce is to use |
| 14 |
|
the GODI distribution: |
| 15 |
|
|
| 16 |
|
http://www.ocaml-programming.de/godi/ |
| 17 |
|
|
| 18 |
|
It includes all the mandatory and optional packages listed below, |
| 19 |
|
and also the special modules needed to build the OCaml/CDuce interface. |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
Mandatory packages: |
| 24 |
|
------------------- |
| 25 |
|
|
| 26 |
Before compiling CDuce, you need to install recent releases of the |
Before compiling CDuce, you need to install recent releases of the |
| 27 |
following packages: |
following packages: |
| 28 |
|
|
| 29 |
ocaml => 3.07 |
ocaml => 3.08.1 |
| 30 |
http://caml.inria.fr/ocaml/distrib.html |
http://caml.inria.fr/ocaml/distrib.html |
| 31 |
findlib |
findlib => 1.0.3 |
| 32 |
http://www.ocaml-programming.de/packages |
http://www.ocaml-programming.de/packages |
| 33 |
ulex |
ulex => 0.4 |
| 34 |
http://www.cduce.org/download |
http://www.cduce.org/download |
| 35 |
pcre-ocaml |
pcre-ocaml => 5.03 |
| 36 |
http://www.ai.univie.ac.at/~markus/home/ocaml_sources.html |
http://www.ai.univie.ac.at/~markus/home/ocaml_sources.html |
| 37 |
ocamlnet |
ocamlnet => 0.98 |
| 38 |
http://sourceforge.net/projects/ocamlnet |
http://www.ocaml-programming.de/packages |
| 39 |
pxp => 1.9.93 |
pxp => 1.1.95 |
| 40 |
http://www.ocaml-programming.de/packages/documentation/pxp/index_dev.html |
http://www.ocaml-programming.de/packages/documentation/pxp/index_dev.html |
| 41 |
|
|
|
Important notes: |
|
| 42 |
|
|
| 43 |
- OCaml: cduce uses recursive modules so versions of OCaml before 3.07 |
Additional optional packages: |
| 44 |
will not work. Also the standard distribution has two bugs that make |
----------------------------- |
| 45 |
CDuce compilation fail. Patch OCaml source by |
|
| 46 |
|
* If you want to load xml, html, and schema files remotely on the |
| 47 |
http://caml.inria.fr/bin/caml-bugs/fixed?id=1863;page=77;user=guest |
web (http, https, ftp, ...: e.g. load_html "http://www.cduce.org") you will |
| 48 |
http://www.cduce.org/download/patch-ocaml-3.07 |
need one of: |
| 49 |
|
|
| 50 |
or (better) install OCaml cvs version |
ocurl => 0.15 |
| 51 |
cvs -d":pserver:anoncvs@camlcvs.inria.fr:/caml" login |
http://sourceforge.net/projects/ocurl/ |
| 52 |
hit enter key when asked for password |
|
| 53 |
cvs -d":pserver:anoncvs@camlcvs.inria.fr:/caml" co ocaml |
netclient => 0.90.1 |
| 54 |
|
http://www.ocaml-programming.de/programming/netclient.html |
| 55 |
|
|
| 56 |
|
netclient support only the http protocol. |
| 57 |
|
curl supports in addition https, ftp, and other protocols. |
| 58 |
|
|
| 59 |
|
* You can also use the expat parser instead of PXP to load XML documents |
| 60 |
|
(PXP is still needed): |
| 61 |
|
|
| 62 |
|
ocaml-expat => 0.1.0 |
| 63 |
|
http://home.wanadoo.nl/maas/ocaml/ |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
Important notes: |
| 68 |
|
---------------- |
| 69 |
|
|
| 70 |
- pcre-ocaml: you may also need to install the PCRE library |
- pcre-ocaml: you may also need to install the PCRE library |
| 71 |
from http://www.pcre.org/ [red-hat users: 4.3 package does |
from http://www.pcre.org/ (use version >=4.4) |
| 72 |
not work with the latest pcre-ocaml version, use tarballs] |
[red-hat users: pcre (rawhide) packages may not work with the |
| 73 |
|
latest pcre-ocaml versions, use tarballs] |
| 74 |
|
In this case, configure it with the --enable-utf8 option. |
| 75 |
>= 5.03 recommended but previous versions may work |
>= 5.03 recommended but previous versions may work |
| 76 |
|
|
| 77 |
- PXP: |
- PXP: |
| 78 |
CDuce requires a development version >= 1.1.93. |
CDuce requires a development version >= 1.1.94.2. |
| 79 |
|
Notes: It is enough to build support UTF8 and ISO-8859-1 ocamllex-lexers: |
|
Note: |
|
|
It is enough to build support UTF8 and ISO-8859-1 ocamllex-lexers: |
|
| 80 |
./configure -without-wlex -without-wlex-compat -lexlist utf8,iso88591 |
./configure -without-wlex -without-wlex-compat -lexlist utf8,iso88591 |
| 81 |
|
You can also build pxp with wlex support (more compact code). This |
| 82 |
|
can be done by installing wlex runtime support library *before* pxp |
| 83 |
|
http://www.eleves.ens.fr/home/frisch/soft.html#wlex |
| 84 |
|
and build pxp -with-wlex*. When building CDuce you still have the |
| 85 |
|
choice whether to use wlex or ocamllex (to choose wlex, |
| 86 |
|
do ./configure --with-pxp_wlex or set PXP_WLEX=true in Makefile.conf). |
| 87 |
|
|
| 88 |
|
- ocurl: |
| 89 |
|
you may also need to install libcurl (http://curl.haxx.se/libcurl/) |
| 90 |
|
|
| 91 |
|
- ocaml-expat: |
| 92 |
|
you may also need to install libexpat (http://expat.sourceforge.net/) |
| 93 |
|
|
| 94 |
|
|
| 95 |
Efficiency issues: |
Efficiency issues: |
| 96 |
|
|
| 97 |
- OCamlnet: if you plan to load XML file with encodings other than |
- PXP: ocamllex lexers are more efficient than wlex lexers. |
| 98 |
UTF-8, it is advised to use a recent version of OCamlnet (>= 0.96). |
|
|
Indeed, the netconversion module in the previous release (0.95) was |
|
|
very slow, and it has been rewritten since then. |
|
| 99 |
|
|
| 100 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
| 101 |
Compilation |
Compilation |
| 102 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
| 103 |
|
|
| 104 |
You need a GNU Make (or equivalent) to use the Makefile from the |
There is a configure script. It will check for the presence of |
| 105 |
distribution. It defines the following goals: |
mandatory packages, and detect automatically optional ones. It will |
| 106 |
|
also set installation directories. Running the script produces a |
| 107 |
|
Makefile.conf file. You can get usage information about the script |
| 108 |
|
with: ./configure --help |
| 109 |
|
|
| 110 |
|
Alternatively, it is also possible to copy Makefile.conf.template to |
| 111 |
|
Makefile.conf and modify it by hand. |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
The usual command line for configuring and building CDuce: |
| 115 |
|
|
| 116 |
|
./configure && make all && make install |
| 117 |
|
|
| 118 |
|
To see all the configuration options: |
| 119 |
|
|
| 120 |
|
./configure --help |
| 121 |
|
|
| 122 |
|
You need a GNU Make (or equivalent). The Makefile defines the following goals: |
| 123 |
|
|
| 124 |
|
- make help |
| 125 |
|
print a summary of what follows |
| 126 |
|
|
| 127 |
- make cduce |
- make cduce |
| 128 |
compiles the CDuce command line interpreter |
compiles the CDuce command line interpreter |
| 130 |
- make dtd2cduce |
- make dtd2cduce |
| 131 |
compiles the dtd2cduce tools (converts DTD to CDuce types) |
compiles the dtd2cduce tools (converts DTD to CDuce types) |
| 132 |
|
|
| 133 |
- make webiface |
- make cduce_validate |
| 134 |
compiles the CDuce web interface interpreter (to be used as a CGI script) |
compiles the schema validation tool |
| 135 |
|
|
| 136 |
- make webpages |
- make doc |
| 137 |
compiles in the web/www/ subdirectory the HTML files for the CDuce website |
compiles in the subdirectory web/doc the HTML documentation for CDuce |
|
(including the tutorial and manual) |
|
|
|
|
|
- make install_web |
|
|
compiles webiface and webpages, and install everything (see Makefile.conf) |
|
| 138 |
|
|
| 139 |
- make all |
- make all |
| 140 |
equivalent to (make cduce dtd2cduce) |
equivalent to (make cduce dtd2cduce cduce_validate) |
| 141 |
|
|
| 142 |
- make install |
- make install |
| 143 |
it installs |
installs binaries into $(BINDIR), manpages into $(MANDIR)/man1, |
| 144 |
cduce and dtd2cduce into $(PREFIX)/bin |
and registers the cduce_lib library with findlib. |
|
cduce.1 into $(PREFIX)/man/man1 |
|
|
(see PREFIX below) |
|
| 145 |
|
|
| 146 |
Makefile accepts the following options. |
- make clean |
| 147 |
|
back to the starting point |
| 148 |
|
|
| 149 |
NATIVE=true : use the OCaml native code compiler (ocamlopt) to build CDuce |
- make uninstall |
| 150 |
NATIVE=false : use the OCaml bytecode compiler (ocamlc) |
removes installed files |
|
default: true (the native code version is much faster) |
|
| 151 |
|
|
| 152 |
PXP_WLEX=true : use wlex for parsing UTF-8 XML files |
------------------------------------------------------------------------------ |
| 153 |
PXP_WLEX=false: use ocamllex for parsing UTF-8 XML files |
Building the CDuce/OCaml interface |
| 154 |
default: false (ocamllex is faster; wlex is more compact) |
------------------------------------------------------------------------------ |
| 155 |
|
|
| 156 |
EXPAT=true: build expat support (see below) |
If you want to build the OCaml/CDuce interface, you will need some |
| 157 |
|
parts of the OCaml compilers which are not installed by default with |
| 158 |
|
OCaml. The files you need are the compiled units from the |
| 159 |
|
subdirectories utils/ parsing/ and typing/ of the OCaml standard |
| 160 |
|
distribution (the .cmi files, and either the corresponding .cmo or the |
| 161 |
|
.cmx+.o). If you still have the compiled OCaml source tree that you used |
| 162 |
|
to build the current version of ocamlc/ocamlopt, in, say |
| 163 |
|
$HOME/ocaml-3.07, you can activate the OCaml/CDuce interface with: |
| 164 |
|
|
| 165 |
|
./configure --mliface=$HOME/ocaml-3.08 |
| 166 |
|
|
| 167 |
|
Another option is to copy all the needed files (.cmi,.cmo/.cmx+.o) |
| 168 |
|
to a single directory, say $HOME/ocaml-modules. Then you can do: |
| 169 |
|
|
| 170 |
|
./configure --mliface=$HOME/ocaml-modules |
| 171 |
|
|
| 172 |
|
(the configure script automatically detect whether the files |
| 173 |
|
are directly in the specified directory, or in utils/ parsing/ typing/ |
| 174 |
|
subdirectories) |
| 175 |
|
|
| 176 |
PREFIX=/usr/local by default: where to install CDuce files (see |
Note for GODI users: |
| 177 |
Makefile.conf) |
==================== |
| 178 |
|
|
| 179 |
E.g.: |
The GODI distribution *does* install the files in |
| 180 |
make cduce NATIVE=false |
$(LOCALBASE)/lib/ocaml/compiler-lib. |
| 181 |
|
|
|
You can also modify Makefile.conf to set values for these choices. |
|
| 182 |
|
|
| 183 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
| 184 |
Support for the expat parser |
Note on using the expat parser |
| 185 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
| 186 |
|
|
| 187 |
CDuce can uses two XML parsers: PXP and expat. PXP is needed |
CDuce can uses two XML parsers: PXP and expat. PXP is needed |
| 188 |
to build CDuce, and expat support can be additionnaly added. |
to build CDuce, and expat support can be additionnaly added. |
|
Here is how to do so. |
|
|
|
|
|
You need to install the expat C library and the OCaml wrapper. |
|
|
The wrapper can be found at: |
|
|
|
|
|
http://home.wanadoo.nl/maas/ocaml/ |
|
| 189 |
|
|
| 190 |
Once the wrapper and be installed, you can build CDuce with |
When CDuce is built with expat support, it uses by default expat to |
| 191 |
the Makefile option EXPAT=true (which can be set on make command |
load XML files. You can still use PXP by adding "--no expat" to |
| 192 |
line or in Makefile.conf). |
the CDuce command line. |
|
|
|
|
The interpreter is now using expat for loading XML files. |
|
|
You can still use PXP by providing the --pxp switch on the command |
|
|
line. |
|
| 193 |
|
|
| 194 |
Note: the current wrapper for expat does not support inclusion |
Note: the current wrapper for expat does not support inclusion |
| 195 |
of external entities. Moreover, the error messages in case of |
of external entities. Moreover, the error messages in case of |