# Redland RDF Application Framework Bindings - Building and Installing from Source

## 1. Get pre-requisites

The Redland Bindings require a previously built and installed Redland package with the same version number. In particular, the header files, shared libraries and SWIG interface files that Redland provides are required for most language bindings. An alternative to installation is to extract the Redland sources in a parent directory or a sibling directory called 'librdf'.

## 2. Getting the sources

There are several ways to get the sources. The most stable and tested versions are the sources shipped with each release and these are recommended as the first place to start. For the latest developent sources, anonymous Subversion access is available but this may require some configuring of developer tools that are not needed for the snapshot releases.

The source bundle and package files contain all the HTML files and documentation provided on the web site.

### 2.1. Getting the sources from releases

The released sources and available from http://download.librdf.org/source/ master site as well as the SourceForge site.

### 2.2. Getting the sources from Subversion

NOTE: Redland Bindings switched to use Subversion for version control after the 1.0.3.1 release. If you were using CVS, you will need to re-check out the sources.

      svn checkout http://svn.librdf.org/repository/bindings/trunk/
      mv trunk bindings
      cd bindings

At this stage, or after a `svn update` you will need to create the automake and autoconf derived files, as described below in Create the configure program by using the `autogen.sh` script.

Building the Redland bindings in this way requires some particular development tools not needed when building from snapshot releases - automake, autoconf and swig. The `autogen.sh` script looks for the newest versions of the auto* tools and checks that they meet the minimum versions.

## 3. Configuring and building

Redland bindings uses the GNU automake and autoconf to handle system dependency checking. `configure` tries very hard to find several programs and libraries that the Redland bindings need. These include the binding binaries: perl, python, etc., headers for the bindings such as the JDK, Python etc. and various others. A summary of the parts found is given at the end of the configure run. Several options to configure given below can be used to point to locations or names of dependencies that cannot be automatically determined.

Redland Bindings 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 SourceForge compile farm (typically AMD64, Alpha, Solaris x86, OpenBSD, NetBSD).

### 3.1. Create `configure` program

If there is no `configure` program, you can create it by running the `autogen.sh` script, as long as you have the automake and autoconf tools. This is done by:

      ./autogen.sh

and you can also pass along arguments intended for configure (see below for what these are):

      ./autogen.sh --prefix=/usr/local/somewhere

Alternatively you can run the automake and autoconf programs by hand with:

      aclocal; autoheader; automake --add-missing; autoconf

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.

### 3.2. Options for `configure`

See also the generic GNU installation instructions in INSTALL for information about general options such as `--prefix` etc.

`--with-java`(=JAVA-COMMAND)
`--with-perl`(=PERL-COMMAND)
`--with-php`(=PHP-COMMAND)
`--with-python`(=PYTHON-COMMAND)
`--with-ruby`(=RUBY-COMMAND)
`--with-tcl`(=TCL-COMMAND)

  Enable the given language APIs - the default is to build no language APIs automatically. If the option value is omitted or yes, configure will guess the location of the language command. If the option value is no or no option is given, the language API will be disabled - this is the default, not to build any language API.

  If the option is given a value, that is used as the appropriate language command to use. For example `--with-ruby=ruby1.8` will use the 'ruby1.8' binary, whereas `--with-ruby` will use 'ruby' as the binary, both of these will be searched for in the PATH. An absolute path could alternatively be given such as `--with-python=/opt/mypython/bin/python` to use a python installation in a different location.

`--with-python-ldflags`(=FLAGS)

  Set the linker flags for linking Python. This can also be done by setting the environment variable `PYTHON_LDFLAGS`. If neither is set, `configure` will guess an appropriate set for the current system.

`--with-jdk=`DIR

  Choose the location of the Java JDK to use for building the Java API with Java JNI. If omitted, Redland will guess likely locations but this is not guaranteed to work.

`--with-redland=` `system` or `internal`

  This option tells the bindings to use either the system installed version of redland or an internal version, in a parent or sibling directory as described above. If the option is omittted, the system one is prefered, and if none is available, configure will stop.

### 3.3 Configuring

If everything is in the default place, do:

       ./configure

More commonly you will be doing something like this, indicating which binding or bindings are wanted:

       ./configure --with-python

If you are having problems with configuring several times when adding or removing options, you may have to tidy up first with either of these:

       make clean
       rm -f config.cache

### 3.4 Compiling

       make

## 3.5. Testing

You can build and run the built-in tests for Redland with:

        make check

which will run these tests for the enabled languages. These may fail if the main redland libraries (librdf and raptor, rasqal) are not installed but are used in nearby source trees. So in this case you should install redland, raptor and rasqal first

The language-specific tests can also be built and run with:

       cd language
       make check

### 3.6 Installing the bindings

To install the bindings, do:

       make install

Otherwise, the language-specific installations can be made with:

      cd language
      make install

## 4. Using the library

There are many examples for all of the language interfaces in the corresponding sub-directories such as `perl/example.pl` which may be easier to modify.

## 5. Using the Perl interface

See the Redland Perl Interface document for full information on installing and using Redland from Perl.

## 6. Using the Python interface

See the Redland Python Interface document for full information on installing and using Redland from Python.

## 7. Using the Tcl interface

See the Redland Tcl Interface document for full information on installing and using Redland from Tcl, and/or Tcl/Tk.

## 8. Using the Java interface

See the Redland Java Interface document for full information on installing and using Redland from Java.

## 9. Using the Ruby interface

See the Redland Ruby Interface document for full information on installing and using Redland from Ruby.

## 10. Using the PHP interface

See the Redland PHP Interface document for full information on installing and using Redland from PHP.

## 11. Using the C# interface

See the Redland C# Interface document for full information on installing and using Redland from C# or an ECMA CLI language.

## 12. Using the Obj-C interface

See the Redland Obj-C Interface document for information on obtaining and installing the Objective-C bindings for OSX which are maintained separately.

Copyright (C) 2004-2006 Dave Beckett
Copyright (C) 2004-2005 University of Bristol