INSTALL 6.68 KB
Newer Older
1 2
Installation Notes for CDuce
============================
3

4
CDuce is written in the OCaml programming language. It has been
5 6
successfully compiled under Intel Linux, Mac OSX, SunOS 5.7, FreeBSD 4.7.
and Windows XP.
7 8
(See INSTALL.WIN32 for installation under Windows)

9 10 11
------------------------------------------------------------------------------
Prerequisites
------------------------------------------------------------------------------
12

13 14 15 16 17 18 19 20 21 22 23 24 25
An easy way to get a system ready to compile CDuce is to use
the GODI distribution:

  http://www.ocaml-programming.de/godi/

It includes all the mandatory and optional packages listed below,
and also the special modules needed to build the OCaml/CDuce interface.



Mandatory packages:
-------------------

26 27
Before compiling CDuce, you need to install recent releases of the
following packages:
28

29
ocaml      >= 3.10
30
  http://caml.inria.fr/ocaml/distrib.html
31
findlib    >= 1.0.3
32
  http://www.ocaml-programming.de/packages
33
ulex       >= 1.0
34 35 36
  http://www.cduce.org/download.html
pcre-ocaml >= 5.13.0
  http://ocaml.info/home/ocaml_sources.html#toc16
37
ocamlnet   >= 0.98
38
  http://www.ocaml-programming.de/packages
39

40 41 42
Additional optional packages:
-----------------------------

43 44 45 46
* You'll probably want to build CDuce with an XML parser. You will need one of:

pxp         >= 1.1.95
  http://www.ocaml-programming.de/packages/documentation/pxp/index_dev.html
47
ocaml-expat >= 0.9.1
48 49 50 51 52
  http://home.wanadoo.nl/maas/ocaml/


* CDuce can use one the the ocurl and netclient library to fetch external
  URLs. You will need one of:
53

54
ocurl      >= 0.15
55 56
  http://sourceforge.net/projects/ocurl/

57
netclient  >= 0.90.1
58 59
  http://www.ocaml-programming.de/programming/netclient.html

60 61
netclient support only the http protocol. 
curl supports in addition https, ftp, and other protocols.
62

63

64
Important notes:
65
----------------
66

67
- pcre-ocaml: you may also need to install the PCRE library
68
  from http://www.pcre.org/ (use version >=4.4)
69 70
  [red-hat users: pcre (rawhide) packages may not work with the
  latest pcre-ocaml versions, use tarballs]
71
  In this case, configure it with the  --enable-utf8 option.
72
  >= 5.03 recommended but previous versions may work
73

74
- PXP:
75 76
  It is enough to build support for UTF8 and ISO-8859-1 ocamllex-lexers:

77
  ./configure -without-wlex -without-wlex-compat -lexlist utf8,iso88591
78

79
  You can also build pxp with wlex support (more compact code). This
80
  can be done by installing wlex runtime support library *before* pxp
81 82
    http://www.eleves.ens.fr/home/frisch/soft.html#wlex
  and build pxp -with-wlex*. When building CDuce you still have the
83 84
  choice whether to use wlex or ocamllex (to choose wlex,
  do ./configure --with-pxp_wlex or set PXP_WLEX=true in Makefile.conf).
85

86 87
- ocurl: 
  you may also need to install libcurl (http://curl.haxx.se/libcurl/)
88 89 90

- ocaml-expat:
  you may also need to install libexpat (http://expat.sourceforge.net/)
91

92

93 94 95
------------------------------------------------------------------------------
Compilation
------------------------------------------------------------------------------
96

97 98 99 100 101
There is a configure script. It will check for the presence of
mandatory packages, and detect automatically optional ones.  It will
also set installation directories.  Running the script produces a
Makefile.conf file.  You can get usage information about the script
with: ./configure --help
102

103 104
Alternatively, it is also possible to copy Makefile.conf.template to
Makefile.conf and modify it by hand.
105

106

107
The usual command line for configuring and building CDuce:
108

109
./configure && make all && make install
110

111
To see all the configuration options:
112

113 114
./configure --help

115
You need a GNU Make (or equivalent). The Makefile defines the following goals:
116

117 118 119
- make help
  print a summary of what follows

120
- make all
121
  build binaries and libraries (does not build dtd2cduce)
122

123
- make cduce
124
  compiles the CDuce command line interpreter
125

126
- make dtd2cduce
127 128
  compiles the dtd2cduce tools (converts DTD to CDuce types).
  The PXP package must be available to build dtd2cduce.
129 130 131
  If you cannot build dtd2cduce locally, you can use on online
  version available at this URL:
  http://www.cduce.org/dtd2cduce.html
132

133 134
- make doc
  compiles in the subdirectory web/doc the HTML documentation for CDuce
135

136 137
- make all

138
- make install
139 140
  installs binaries into $(BINDIR), manpages into $(MANDIR)/man1,
  and registers the cduce_lib library with findlib.
141

142 143 144 145 146 147 148
- make test
  runs the first test suite, all the tests in this suite should pass.

- make extendedtest
  runs the extended test suite, some tests are broken and need investigation,
  others are testing future features of CDuce.

149 150 151
- make clean
  back to the starting point

152
- make uninstall
153
  removes installed files
154

155
------------------------------------------------------------------------------
156
Building the CDuce/OCaml interface
157 158
------------------------------------------------------------------------------

159 160 161
If you want to build the OCaml/CDuce interface, you need a copy
of the OCaml source tree matching your current OCaml version.
You must pass the location of this tree to the configure script:
162

163
 ./configure --mliface=$HOME/ocaml-3.09
164 165

------------------------------------------------------------------------------
166
Note on XML parsers
167 168
------------------------------------------------------------------------------

169 170
When CDuce is built with support for both expat and PXP, it uses by default
expat to parse XML files. You can still use PXP by adding "--no expat" to 
171
the CDuce command line.
172

173 174 175 176 177 178 179 180
- error messages:
  The error messages provided by expat when parsing ill-formed XML documents
  are less informative than those given by PXP.

- efficiency:
  * expat is more efficient than PXP, and produces smaller executables.
  * for PXP, ocamllex lexers are more efficient than wlex lexers.

Pietro Abate's avatar
Pietro Abate committed
181 182 183 184
------------------------------------------------------------------------------
Compile Cduce 0.5.5 using ocaml 3.12.1 and opam
------------------------------------------------------------------------------

185 186 187 188 189 190 191 192 193 194 195 196 197 198
The lastest stable version compatible with ocaml 3.12.1 is cudce 0.5.5
the git branch ocamlinterface is a fork from tag 0.5.5 and links the
ocaml source code (tags/3.12.1) via a git submodule. To correctly setup
the environment, first you need to switch on the ocamlinterface and 
setup the ocaml submodule.

git clone -b ocamlinterface https://git.cduce.org/cduce
git submodule init
git submodule update

Then using OPAM you need to install and configure the correct compiler and 
modules needed to build cduce. Ocamlfind will take care of installing the
cduce libraries and make them available.

199
./opam_config.sh 3.12.1
Pietro Abate's avatar
Pietro Abate committed
200 201 202 203 204 205 206 207

./configure --mliface=ocaml --prefix=$LOCALSWDIR
make
make install
 
ocamlfind list | grep cduce
find $HOME/.opam/ -name cduce_lib\*
which cduce
208 209 210

The directory tests contains few tests to check if the ocaml interface was 
compiled correctly.