+ <para> First of all you need to configure the build process executing
+ <userinput>./configure</userinput>. This will check that all needed
+ tools and library are installed and prepare the sources for compilation
+ and installation. </para>
+
+ <para> Quite a few (optional) arguments may be passed to the
+ <application>configure</application> command line to change build time
+ parameters. They are listed below, together with their
+ default values: </para>
+
+ <variablelist>
+ <title> <application>configure</application> command line
+ arguments</title>
+
+ <varlistentry>
+ <term>
+ <userinput>--with-runtime-dir=<replaceable>dir</replaceable></userinput>
+ </term>
+ <listitem>
+ <para>
+ (<emphasis>Default:</emphasis>
+ <filename>/usr/local/matita</filename>) Runtime base directory
+ where all &appname; stuff (executables, configuration files,
+ standard library, ...) will be installed
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <userinput>--with-dbhost=<replaceable>host</replaceable></userinput>
+ </term>
+ <listitem>
+ <para>
+ (<emphasis>Default:</emphasis> localhost) Default SQL server
+ hostname. Will be used while building the standard library
+ during the installation and to create the default &appname;
+ configuration. May be changed later in configuration file.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <userinput>--enable-debug</userinput>
+ </term>
+ <listitem>
+ <para>
+ (<emphasis>Default:</emphasis> disabled) Enable debugging code.
+ Not for the casual user.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para> Then you will manage the build and install process using
+ <application><ulink type="http"
+ url="http://www.gnu.org/software/make/">make</ulink></application>
+ as usual. Below are reported the targets you have to invoke in sequence
+ to build and install:
+ </para>
+
+ <variablelist>
+ <title><application>make</application> targets</title>
+
+ <varlistentry>
+ <term><userinput>world</userinput></term>
+ <listitem>
+ <para>builds components needed by &appname; and &appname; itself
+ (in bytecode or native code depending
+ on the availability of the OCaml native code compiler) </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><userinput>install</userinput></term>
+ <listitem>
+ <para>installs &appname; related tools, standard library and the
+ needed runtime stuff in the proper places on the filesystem.
+ </para>
+ <para>As a part of the installation process the &appname;
+ standard library will be compiled, thus testing that the just
+ built <application>matitac</application> compiler works
+ properly.</para>
+ <para>For this step you will need a working SQL database (for
+ indexing the standard library while you are compiling it). See
+ <ulink type="http" url="#database_setup">Database setup</ulink>
+ for instructions on how to set it up.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+ </sect1>
+
+ <sect1 id="matita.conf.xml">
+ <title>Configuring &appname;</title>
+ <para>
+ The configuration file is divided in four sections. The user and
+ matita ones are self explicative and does not need user
+ intervention. Here we report a sample snippet for these two
+ sections. The remaining db and getter sections will be explained in
+ details later.
+ <programlisting>
+<![CDATA[
+ <section name="user">
+ <key name="home">$(HOME)</key>
+ <key name="name">$(USER)</key>
+ </section>
+ <section name="matita">
+ <key name="basedir">$(user.home)/.matita</key>
+ <key name="rt_base_dir">/usr/share/matita/</key>
+ <key name="owner">$(user.name)</key>
+ </section>
+]]></programlisting>
+ </para>
+ <para>
+ &appname; needs to store/fetch data and metadata. Data is essentially
+ composed of XML files, metadata is a set of tuples for a relational
+ model. Data and metadata can produced by the user or be already
+ available. Both kind of data/metadata can be local and/or remote.
+ </para>
+ <para>
+ The db section tells &appname; where to store and retrieve metadata,
+ while the getter section describes where XML files have to be
+ found. The following picture describes the suggested configuration.
+ Dashed arrows are determined by the configuration file.
+ </para>
+ <figure><title>Configuring the Databases</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="figures/database.png" format="PNG" srccredit="Enrico Tassi"/>
+ </imageobject>
+ <textobject><phrase>How to configure the databases.</phrase></textobject>
+ </mediaobject>
+ </figure>
+ <para>The getter</para>
+ <para>
+ Consider the following snippet and the URI
+ <userinput>cic:/matita/foo/bar.con</userinput>. If &appname;
+ is asked to read that object it will resolve the object trough
+ the getter. Since the first two entries are equally specific
+ (longest match rule applies) first the path
+ <userinput>file://$(matita.rt_base_dir)/xml/standard-library/foo/bar.con</userinput>
+ and then <userinput>file://$(user.home)/.matita/xml/matita/foo/bar.con</userinput>
+ are inspected.
+ <programlisting>
+<![CDATA[
+ <section name="getter">
+ <key name="cache_dir">$(user.home)/.matita/getter/cache</key>
+ <key name="prefix">
+ cic:/matita/
+ file://$(matita.rt_base_dir)/xml/standard-library/
+ ro
+ </key>
+ <key name="prefix">
+ cic:/matita/
+ file://$(user.home)/.matita/xml/matita/
+ </key>
+ <key name="prefix">
+ cic:/Coq/
+ http://mowgli.cs.unibo.it/xml/
+ legacy
+ </key>
+ </section>
+]]>
+ </programlisting>
+ if the same URI has to be written, the former prefix is skipped
+ since it is marked as readonly (<userinput>ro</userinput>).
+ Objects resolved using the third prefix are readonly too, and are
+ retrieved using the network. There is no limit to the number of
+ prefixes the user can define. The distinction between prefixes marked
+ as readonly and legacy is that, legacy ones are really read only, while
+ the ones marked with <userinput>ro</userinput> are considered for
+ writing when &appname; is started in system mode (used to publish user
+ developments in the library space).
+ </para>
+ <para>The db</para>
+ <para>
+ The database subsystem has three fron ends: library, user and
+ legacy. The latter is the only optional one. Every query is done on
+ every frontend, making the duplicate free union of the results.
+ The user front end kepps metadata produced by the user, and is thus
+ heavily accessed in read/write mode, while the library and legacy
+ fron ends are read only. Every front end can be connected to
+ backend, the storage actually.
+ Consider the following snippet.
+ <programlisting>
+<![CDATA[
+ <section name="db">
+ <key name="metadata">mysql://mowgli.cs.unibo.it matita helm none legacy</key>
+ <key name="metadata">file://$(matita.rt_base_dir) metadata.db helm helm library</key>
+ <key name="metadata">file://$(matita.basedir) user.db helm helm user</key>
+ </section>
+]]>
+ </programlisting>
+ Here the usr database is a file (thus locally accessed trough the
+ Sqlite library) placed in the user's home directory. The library one is
+ placed in the &appname; runtime directory. The legacy fron end is
+ connected to a remote &MYSQL; based storage. Every metadata key
+ takes a path to the storage, the name of the database, the user name,
+ a password (or <userinput>none</userinput>) and the name of the front
+ end to which it is attached.
+ </para>
+ </sect1>
+
+</chapter>