The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Raptor RDF Parser Toolkit - Building and Installing from Source</title>
</head>
<body>

<h1>Raptor RDF Parser Toolkit - Building and Installing from Source</h1>
  

<h2>1. Getting the sources</h2>

<h2>1.1 Getting the sources from releases</h2>

<p>The released sources and available from
<a href="http://download.librdf.org/source/">http://download.librdf.org/source/</a> (master site) and also from the
<a href="http://sourceforge.net/projects/librdf/">SourceForge site</a>.</p>


<h2>1.2 Getting the sources from Subversion</h2>

<p><strong>NOTE</strong>: Raptor switched to use
<a href="http://subversion.tigris.org/">Subversion</a>
for version control after the 1.4.8 release.  If you were
using CVS, you will need to re-check out the sources.</p>

<pre>
  svn checkout http://svn.librdf.org/repository/raptor/trunk/
  mv trunk raptor
  cd raptor
</pre>

<p>At this stage, or after a <tt>svn update</tt> you will
need to create the automake and autoconf derived files, as described
below in <a href="#sec-create-configure">Create the configure program</a>
by using the <code>autogen.sh</code> script.</p>

<p>Building Raptor in this way requires some particular development
tools not needed when building from snapshot releases - automake and
autoconf.  The <code>autogen.sh</code> script looks for the newest
versions of the auto* tools and checks that they meet the minimum
versions.</p>


<h2>2. Configuring and building</h2>

<p>Raptor uses the GNU automake and autoconf to handle system
dependency checking.  It requires an XML parser - either libxml2
(2.4.0 or newer, 2.6.0 or later highly recommended) or expat.  It will
optionally use libcurl, libxml2 for retrieving URIs.  It will
optionally use libxslt (requiring libxml2 also) to provide the XSLT
functionality for the GRDDL parser.</p>

<p>Raptor is developed and built on x86 GNU/Linux
(Redhat Fedora Core 4, Debian unstable) but is also regularly tested on
sparc Sun Solaris, x86 FreeBSD, ppc Apple OSX 
and as part of Redland on several other systems via the 
<a href="http://sourceforge.net/">SourceForge</a> compile farm
(typically AMD64, Alpha, Solaris x86, OpenBSD, NetBSD).</p>


<h3><a id="sec-create-configure" name="sec-create-configure"></a>2.1. Create <code>configure</code> program</h3>

<p>If there is no <tt>configure</tt> program, you can create it 
using the <tt>autogen.sh</tt> script, as long as you have the
<a href="http://www.gnu.org/software/automake/automake.html">automake</a> and
<a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a>
tools.  This is done by:</p>
<pre>
  ./autogen.sh
</pre>
<p>and you can also pass along arguments intended for configure (see
below for what these are):</p>
<pre>
  ./autogen.sh --prefix=/usr/local/somewhere
</pre>

<blockquote>
<p>On OSX you may have to explicitly set the <code>LIBTOOLIZE</code>
variable for the <code>libtoolize</code> utility since on
OSX <code>libtoolize</code> is a different program:</p>
<pre>
  LIBTOOLIZE=glibtoolize ./autogen.sh
</pre>
</blockquote>

<p>Alternatively you can run them by hand with:</p>
<pre>
  aclocal; autoheader; automake --add-missing; autoconf
</pre>

<p>The automake and autoconf tools have many different versions and
at present development is being done with automake 1.8.3 (minimum
version 1.7), autoconf 2.59 (minimum version 2.54) and libtool 1.5.4
(minimum version 1.4).  These are only needed when compiling from Subversion
sources.  autogen.sh enforces the requirements.  In future
development will move to require automake 1.8, autoconf 2.58 and
libtool 1.5.</p>

<p>Raptor also requires
<a href="http://lex.sourceforge.net/">flex</a> version 2.5.31 or newer
(2.5.4 will not work) and
<a href="http://www.gnu.org/software/bison/bison.html">GNU Bison</a>
to build lexers and parsers.
These are only required when building from Subversion.</p>


<h3>2.2 Options for <tt>configure</tt></h3>

<p>Raptor also supports the following extra configure options:</p>

<dl>
<dt><tt>--disable-nfc-check</tt><br /></dt>
<dd><p>Disable Unicode Normal Form C (NFC) checking code.
The code primarily consists of large tables plus some checking code
which can be removed from the library with this option.  All NFC
checks will succeed when this is disabled.
</p></dd>

<dt><tt>--with-expat-source=DIR</tt><br /></dt>
<dd><p>Build against a statically compiled expat source tree in
directory <em>DIR</em>.  This handles the older and newer style 
expat source directory structures.
</p></dd>

<dt><tt>--enable-parsers=PARSERS</tt><br /></dt>
<dd><p>Pick the RDF parsers to build from the list:<br />
<code>rdfxml ntriples turtle rss-tag-soup</code><br />
The default when this option is omitted is to enable all parsers.
<code>grddl</code> requires libxml2 and libxstl so may not always be
available.  If all parsers are not enabled, parts of the test suite
will likely fail.</p>

<p>The parsers that a built library supports can be found from the
API level using functions such as
<code>raptor_parsers_enumerate</code> and
<code>raptor_syntaxes_enumerate</code> or from the
<code>rapper</code> utility in the help message.</p></dd>

<dt><tt>--enable-serializers=SERIALIZERS</tt><br /></dt>
<dd><p>Pick the RDF serializers to build from the list:<br />
<code>rdfxml ntriples rdfxml-abbrev</code><br />
The default when this option is omitted is to enable all serializers.
If all serializers are not enabled, parts of the test suite will
likely fail.</p>

<p>The serializers that a built library supports can be found from the
API level using functions such as
<code>raptor_serializers_enumerate</code> or from the
<code>rapper</code> utility in the help message.</p></dd>

<dt><tt>--with-memory-signing</tt><br /></dt>
<dd><p>Enable signing of memory allocations so that when memory is
allocated with malloc() and released free(), a check is made that the
memory was allocated in the same library.</p></dd>

<dt><tt>--with-xml-parser=NAME</tt><br /></dt>
<dd><p>Pick an XML parser to use - either <tt>libxml</tt> (default)
minimum version 2.4.0 (2.6.0 or newer prefered)
or <tt>expat</tt>.  If this option is not given,
either will be used, with libxml preferred if both are present.
These can either be installed system libraries or source
trees in subdirectories of these sources named libxml, expat.</p>
<p>Raptor has been tested with various combinations of these libraries
including 
expat 1.95.1 (on RedHat 7.2),
expat 1.95.2-2 (on RedHat 7.3),
expat 1.95.2-6 (on Debian 3.0),
expat 1.95.7 (on Redhat Fedora Core 2),
expat 1.95.8 (on Debian unstable),
libxml 2.4.10 (on RedHat 7.2),
libxml 2.4.13 (on OSX 10.1.5),
libxml 2.4.17 (on FreeBSD 4.5-RELEASE-p2),
libxml 2.4.19 (on RedHat 7.2),
libxml 2.4.23 (on Debian 3.0),
libxml 2.4.24 (on FreeBSD 4.7-STABLE),
libxml 2.4.25, 2.4.28, 2.4.30 (Debian unstable),
libxml 2.5.3-2.5.4 (Redhat 9, Debian unstable, x86 Solaris 2.9),
libxml 2.5.7 (Redhat 9, Debian unstable),
libxml 2.5.8-2.5.9 (Debian unstable),
libxml 2.6.0-2.6.10 (Debian unstable),
libxml 2.6.8 (Redhat Fedora Core 2),
libxml 2.6.9 (FreeBSD 4.10-STABLE)
</p>
<p>libxml1 is not supported.</p>

<p>The libxml2 on Apple OSX 10.3.X is quite broken - the headers do
not match the libraries.  Install your own to get something
coherent.</p>
</dd>

<dt><tt>--with-www=NAME</tt><br /></dt>
<dd><p>Pick a WWW library to use - either <tt>curl</tt>, 
<tt>xml</tt> (for libxml), <tt>libwww</tt> for W3C libwww or
<tt>none</tt> to disable it.</p></dd>

<dt><tt>--with-xml2-config=NAME</tt><br /></dt>
<dd><p>Set the path to the libxml xml2-config program</p></dd>

<dt><tt>--with-xslt-config=NAME</tt><br /></dt>
<dd><p>Set the path to the libxslt xslt-config program</p></dd>

<dt><tt>--with-curl-config=NAME</tt><br /></dt>
<dd><p>Set the path to the <a href="http://curl.haxx.se/libcurl/">libcurl</a> curl-config program</p></dd>

<dt><tt>--with-libwww-config=NAME</tt><br /></dt>
<dd><p>Set the path to the W3C <a href="http://www.w3.org/Library/">WWW library</a> libwww-config program</p></dd>

</dl>

<h3>2.3 Configuring</h3>

<p>If everything is in the default place, do:</p>
<pre>
   ./configure
</pre>

<p>The most common configuration you will be doing something like this:</p>
<pre>
   ./configure --with-xml-parser=expat
</pre>


<h3>2.4 Compiling</h3>

<p>Compile the parser and the test program <tt>rapper</tt> with;</p>
<pre>
   make
</pre>
<p>Note: GNU make is probably required which may be called
gmake or gnumake if your system has a different make available too.</p>


<h3>2.5 Testing</h3>

<p>Raptor has a built-in test suite that can be invoked with:</p>
<pre>
  make check
</pre>

<p>which should emit lots of exciting test messages to the screen but
conclude with something like:<br />
  <tt>All </tt><em>n</em><tt> tests passed</tt><br />
if everything works correctly. There will be some Unicode NFC
checking tests that give ignored failures in 1.3.2 or later as NFC
checking has been temporarily removed.</p>

<p>Raptor builds a utility RDF parsing program <em>rapper</em> can
be tried with RDF/XML content like this:</p>

<pre>
  rapper dc.rdf
</pre>

<p>Raptor can also extract RDF content inside general XML when the
<tt>-s</tt> (<tt>--scan</tt>) option is user.  For example if some
RDF/XML is embedded inside some SVG, it could be extracted with:</p>

<pre>
  rapper -s /path/to/test/pic.svg
</pre>

<p>You can also run it on <a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a> files like this:</p>

<pre>
  rapper -i ntriples test.nt
</pre>

<p>The default output is a simple statement dump format, but it can
be changed to emit <a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a> by using the <code>-o</code> option, like this:</p>

<pre>
  rapper -o ntriples dc.rdf
</pre>



<h2>3. Using the library</h2>

<p>Once the library has been configured and built, there are 
some C example programs that can be built apart from the rapper utility.
They are in the <code>examples</code> sub-directory and can be built with:</p>
<pre>
   cd examples

   # Raptor GUI - only if you have the GTK libraries
   make grapper

   # If you have all requirements
   make examples
</pre>

<p>The public Raptor API is described in the
<a href="libraptor.html">libraptor.3</a> UNIX manual/web page
</p>


<hr />

<p>Copyright 2000-2006 <a href="http://purl.org/net/dajobe/">Dave Beckett</a><br />Copyright 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p>

</body>
</html>