Redland

Dave Beckett

 
 
Hosted by
Dreamhost

since 2005.

Data

DOAP
(See DOAP Project)

Redland librdf Language 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 GIT access is available but this may require some configuring of developer tools that are not needed for 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 GIT

  git clone git://github.com/dajobe/redland-bindings.git
  cd redland-bindings

At this stage, or after a git pull 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 uses the GNU automake and autoconf to handle system dependency checking. It is developed and built on x86 Linux and x86 OSX but is also tested on other systems occasionally.

configure tries very hard to find several programs and libraries that the Redland bindings need. These include the binding binaries: perl, python, etc., C header files for the bindings such as for 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.

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

On OSX you may have to explicitly set the LIBTOOLIZE variable for the libtoolize utility since on OSX libtoolize is a different program. The full path to the utility should be given:

  LIBTOOLIZE=/opt/local/bin/glibtoolize ./autogen.sh

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 autogen.sh enforces the minimums. At present development is being done with automake 1.10.2 (minimum version 1.7), autoconf 2.63 (minimum version 2.54) and libtool 2.2.6 (minimum version 2.2.0). These are only needed when compiling from GIT sources. autogen.sh enforces the requirements.

3.2. Options for configure

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

--with-lua(=LUA-COMMAND)
--with-perl(=PERL-COMMAND)
--with-php(=PHP-COMMAND)
--with-python(=PYTHON-COMMAND)
--with-ruby(=RUBY-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-perl-makemaker-args=ARGS

Set the arguments for the Perl ExtUtils::MakeMaker Makefile.PL invocation. The default arguments is ''. This is useful to set the set of installation directories such as with --with-perl-makemaker-args=INSTALLDIRS=vendor to move the installation to the vendor directories. Useful choices are '', 'perl', 'site' and 'vendor'. See the ExtUtils::MakeMaker docs above for more information on the options.

--with-python-get-python-lib-args=ARGS

Set the arguments for the Python distutils.sysconfig function get_python_lib() which determines the install directory for the shared object for the python binding. The default value is '' which puts the installed objects in the general library dir for third-party extensions. Other useful values are probably '1' which returns the platform-dependent library dir and '1,1' which returns the standard library directory for platform-dependent libraries.

--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. Cygwin example:

  -with-python-ldflags='-shared -L/usr/lib/python2.5/config -lpython2.5'
--with-python-libext=.EXT

Set the python shared library link extension (default .so). Useful on systems where .so does not work as a shared library extension. Cygwin example:

  -with-python-libext=.dll
--with-ruby-install-dir=DIR

Set the directory to install the archhitecture-independent Ruby bindings files. The default value is '' which will install the files to directory given by the the value of the Config::CONFIG['rubylibdir'] variable

--with-ruby-arch-install-dir=DIR

Set the directory to install the architecture-specific Ruby bindings files. The default value is '' which will use the value of the variable configured by --with-ruby-arch-install-dir-variable to get the the installation directory. Setting this configuration overrides setting the variable name.

--with-ruby-arch-install-dir-variable=NAME

Set the Config::CONFIG['sitearchdir'] variable name to get the the installation directory for installing architecture-specific Ruby bindings files. The default variable is 'archdir'. Other useful values are probably 'sitearchdir'. This is overridden if --with-ruby-arch-install-dir is set.

--with-ruby-linking=TYPE

Set the Ruby module linking type: one of 'so', 'dylib' (OSX) or 'bundle' (OSX). Otherwise the defaults are guessed.

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

NOTE: It is usually safe to use older redland bindings with newer redland releases, it will just omit any new functions added. configure may warn about this and stop, and if this is the case, you can override it with --with-redland=system to let configuration continue.

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 Ruby interface

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

8. Using the PHP interface

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