| 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> |
| 4 | <head> |
| 5 | <title>Redland librdf Language Bindings - Building and Installing from Source</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | |
| 9 | <h1>Redland librdf Language Bindings - Building and Installing from Source</h1> |
| 10 | |
| 11 | |
| 12 | <h2>1. Get pre-requisites</h2> |
| 13 | |
| 14 | <p>The Redland Bindings require a previously built and installed |
| 15 | Redland package with the same version number. In particular, the |
| 16 | header files, shared libraries and SWIG interface files that Redland |
| 17 | provides are required for most language bindings. An alternative to |
| 18 | installation is to extract the Redland sources in a parent directory |
| 19 | or a sibling directory called 'librdf'.</p> |
| 20 | |
| 21 | |
| 22 | <h2>2. Getting the sources</h2> |
| 23 | |
| 24 | <p>There are several ways to get the sources. The most stable and |
| 25 | tested versions are the sources shipped with each release and these |
| 26 | are recommended as the first place to start. For the latest |
| 27 | developent sources, anonymous GIT access is available but this may |
| 28 | require some configuring of developer tools that are not needed for |
| 29 | releases.</p> |
| 30 | |
| 31 | <p>The source bundle and package files contain all the HTML files and |
| 32 | documentation provided on the web site.</p> |
| 33 | |
| 34 | |
| 35 | <h3>2.1. Getting the sources from releases</h3> |
| 36 | |
| 37 | <p>The released sources and available from |
| 38 | <a href="http://download.librdf.org/source/">http://download.librdf.org/source/</a> master site as well as the |
| 39 | <a href="http://sourceforge.net/projects/librdf/">SourceForge site</a>. |
| 40 | </p> |
| 41 | |
| 42 | |
| 43 | <h3>2.2. Getting the sources from GIT</h3> |
| 44 | |
| 45 | <pre> |
| 46 | git clone git://github.com/dajobe/redland-bindings.git |
| 47 | cd redland-bindings |
| 48 | </pre> |
| 49 | |
| 50 | <p>At this stage, or after a <code>git pull</code> you will |
| 51 | need to create the automake and autoconf derived files, as described |
| 52 | below in <a href="#sec-create-configure">Create the configure program</a> |
| 53 | by using the <code>autogen.sh</code> script.</p> |
| 54 | |
| 55 | <p>Building the Redland bindings in this way requires some particular |
| 56 | development tools not needed when building from snapshot releases - |
| 57 | automake, autoconf and swig. |
| 58 | The <code>autogen.sh</code> script looks for the newest versions |
| 59 | of the auto* tools and checks that they meet the minimum versions.</p> |
| 60 | |
| 61 | |
| 62 | |
| 63 | <h2>3. Configuring and building</h2> |
| 64 | |
| 65 | <p>Redland uses the GNU automake and autoconf to handle system |
| 66 | dependency checking. It is developed and built on x86 Linux |
| 67 | and x86 OSX but is also tested on other systems occasionally. |
| 68 | </p> |
| 69 | |
| 70 | <p><code>configure</code> tries very hard |
| 71 | to find several programs and libraries that the Redland bindings |
| 72 | need. These include the binding binaries: perl, python, etc., |
| 73 | C header files for the bindings such as for Python etc. and various |
| 74 | others. A summary of the parts found is given at the end of the |
| 75 | configure run. Several options to configure given below can be used |
| 76 | to point to locations or names of dependencies that cannot be |
| 77 | automatically determined.</p> |
| 78 | |
| 79 | <h3><a id="sec-create-configure" name="sec-create-configure"></a>3.1. Create <code>configure</code> program</h3> |
| 80 | |
| 81 | <p>If there is no <code>configure</code> program, you can create it |
| 82 | by running the <code>autogen.sh</code> script, as long as you have the |
| 83 | <a href="http://www.gnu.org/software/automake/automake.html">automake</a> and |
| 84 | <a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a> |
| 85 | tools. This is done by:</p> |
| 86 | <pre> |
| 87 | ./autogen.sh |
| 88 | </pre> |
| 89 | <p>and you can also pass along arguments intended for configure (see |
| 90 | below for what these are):</p> |
| 91 | <pre> |
| 92 | ./autogen.sh --prefix=/usr/local/somewhere |
| 93 | </pre> |
| 94 | |
| 95 | <blockquote> |
| 96 | <p>On OSX you may have to explicitly set the <code>LIBTOOLIZE</code> |
| 97 | variable for the <code>libtoolize</code> utility since on |
| 98 | OSX <code>libtoolize</code> is a different program. The full |
| 99 | path to the utility should be given:</p> |
| 100 | <pre> |
| 101 | LIBTOOLIZE=/opt/local/bin/glibtoolize ./autogen.sh |
| 102 | </pre> |
| 103 | </blockquote> |
| 104 | |
| 105 | <p>Alternatively you can run the automake and autoconf programs by |
| 106 | hand with:</p> |
| 107 | <pre> |
| 108 | aclocal; autoheader; automake --add-missing; autoconf |
| 109 | </pre> |
| 110 | |
| 111 | <p>The automake and autoconf tools have many different versions and |
| 112 | <code>autogen.sh</code> enforces the minimums. At present development |
| 113 | is being done with automake 1.10.2 (minimum version 1.7), autoconf |
| 114 | 2.63 (minimum version 2.54) and libtool 2.2.6 (minimum version 2.2.0). |
| 115 | These are only needed when compiling from GIT sources. |
| 116 | autogen.sh enforces the requirements.</p> |
| 117 | |
| 118 | |
| 119 | <h3>3.2. Options for <code>configure</code></h3> |
| 120 | |
| 121 | <p>See also the generic GNU installation instructions in |
| 122 | <a href="INSTALL">INSTALL</a> for information about general options |
| 123 | such as <code>--prefix</code> etc.</p> |
| 124 | |
| 125 | <dl> |
| 126 | |
| 127 | <dt><code>--with-lua</code>(=<em>LUA-COMMAND</em>)<br /></dt> |
| 128 | <dt><code>--with-perl</code>(=<em>PERL-COMMAND</em>)<br /></dt> |
| 129 | <dt><code>--with-php</code>(=<em>PHP-COMMAND</em>)<br /></dt> |
| 130 | <dt><code>--with-python</code>(=<em>PYTHON-COMMAND</em>)<br /></dt> |
| 131 | <dt><code>--with-ruby</code>(=<em>RUBY-COMMAND</em>)<br /></dt> |
| 132 | <dd><p>Enable the given language APIs - the default is to build |
| 133 | no language APIs automatically. If the option value is omitted or |
| 134 | <em>yes</em>, configure will guess the location of the language |
| 135 | command. If the option value is <em>no</em> or no option is given, |
| 136 | the language API will be disabled - this is the default, not |
| 137 | to build any language API.</p> |
| 138 | |
| 139 | <p>If the option is given a value, that is used as the appropriate |
| 140 | language command to use. For example <code>--with-ruby=ruby1.8</code> |
| 141 | will use the 'ruby1.8' binary, whereas <code>--with-ruby</code> will use |
| 142 | 'ruby' as the binary, both of these will be searched for in the PATH. |
| 143 | An absolute path could alternatively be given such as |
| 144 | <code>--with-python=/opt/mypython/bin/python</code> |
| 145 | to use a python installation in a different location.</p></dd> |
| 146 | |
| 147 | <dt><code>--with-perl-makemaker-args</code>=<em>ARGS</em><br /></dt> |
| 148 | <dd><p>Set the arguments for the Perl |
| 149 | <a href="http://perldoc.perl.org/ExtUtils/MakeMaker.html">ExtUtils::MakeMaker</a> |
| 150 | Makefile.PL invocation. The default arguments is ''. This is useful |
| 151 | to set the set of installation directories such as with |
| 152 | <code>--with-perl-makemaker-args=INSTALLDIRS=vendor</code> |
| 153 | to move the installation to the vendor directories. Useful choices |
| 154 | are '', 'perl', 'site' and 'vendor'. See the ExtUtils::MakeMaker |
| 155 | docs above for more information on the options. |
| 156 | </p></dd> |
| 157 | |
| 158 | <dt><code>--with-python-get-python-lib-args</code>=<em>ARGS</em><br /></dt> |
| 159 | <dd><p>Set the arguments for the Python |
| 160 | <code>distutils.sysconfig</code> function |
| 161 | <a href="http://docs.python.org/distutils/apiref.html#module-distutils.sysconfig"><code>get_python_lib()</code></a> which determines the install directory |
| 162 | for the shared object for the python binding. The default value is '' |
| 163 | which puts the installed objects in the general library dir for |
| 164 | third-party extensions. Other useful values are probably '1' which |
| 165 | returns the platform-dependent library dir and '1,1' which returns |
| 166 | the standard library directory for platform-dependent libraries. |
| 167 | </p></dd> |
| 168 | |
| 169 | <dt><code>--with-python-ldflags</code>(=<em>FLAGS</em>)<br /></dt> |
| 170 | <dd><p>Set the linker flags for linking Python. This can also be |
| 171 | done by setting the environment variable <code>PYTHON_LDFLAGS</code>. |
| 172 | If neither is set, <code>configure</code> will guess an appropriate |
| 173 | set for the current system. Cygwin example:</p> |
| 174 | <pre> |
| 175 | -with-python-ldflags='-shared -L/usr/lib/python2.5/config -lpython2.5' |
| 176 | </pre> |
| 177 | </dd> |
| 178 | |
| 179 | <dt><code>--with-python-libext</code>=<em>.EXT</em><br /></dt> |
| 180 | <dd><p>Set the python shared library link extension (default <code>.so</code>). |
| 181 | Useful on systems where .so does not work as a shared library extension. |
| 182 | Cygwin example:</p> |
| 183 | <pre> |
| 184 | -with-python-libext=.dll |
| 185 | </pre> |
| 186 | </dd> |
| 187 | |
| 188 | <dt><code>--with-ruby-install-dir</code>=<em>DIR</em><br /></dt> |
| 189 | <dd><p> |
| 190 | Set the directory to install the archhitecture-independent Ruby bindings files. |
| 191 | The default value is '' which will install the files to directory given |
| 192 | by the the value of the <code>Config::CONFIG['rubylibdir']</code> variable |
| 193 | </p></dd> |
| 194 | |
| 195 | <dt><code>--with-ruby-arch-install-dir</code>=<em>DIR</em><br /></dt> |
| 196 | <dd><p> |
| 197 | Set the directory to install the architecture-specific Ruby bindings files. |
| 198 | The default value is '' which will use the value of the variable |
| 199 | configured by <code>--with-ruby-arch-install-dir-variable</code> to get |
| 200 | the the installation directory. |
| 201 | Setting this configuration overrides setting the variable name. |
| 202 | </p></dd> |
| 203 | |
| 204 | <dt><code>--with-ruby-arch-install-dir-variable</code>=<em>NAME</em><br /></dt> |
| 205 | <dd><p> |
| 206 | Set the <code>Config::CONFIG['sitearchdir']</code> variable name |
| 207 | to get the the installation directory for installing architecture-specific Ruby |
| 208 | bindings files. The default variable is 'archdir'. |
| 209 | Other useful values are probably 'sitearchdir'. |
| 210 | This is overridden if <code>--with-ruby-arch-install-dir</code> is set. |
| 211 | </p></dd> |
| 212 | |
| 213 | <dt><code>--with-ruby-linking</code>=<em>TYPE</em><br /></dt> |
| 214 | <dd><p> |
| 215 | Set the Ruby module linking type: one of 'so', 'dylib' (OSX) or |
| 216 | 'bundle' (OSX). Otherwise the defaults are guessed. |
| 217 | </p></dd> |
| 218 | </dl> |
| 219 | |
| 220 | |
| 221 | <h3>3.3 Configuring</h3> |
| 222 | |
| 223 | <p>If everything is in the default place, do:</p> |
| 224 | <pre> |
| 225 | ./configure |
| 226 | </pre> |
| 227 | |
| 228 | <p>More commonly you will be doing something like this, indicating |
| 229 | which binding or bindings are wanted:</p> |
| 230 | <pre> |
| 231 | ./configure --with-python |
| 232 | </pre> |
| 233 | |
| 234 | <p>NOTE: It is usually safe to use older redland bindings with newer |
| 235 | redland releases, it will just omit any new functions added. |
| 236 | <code>configure</code> may warn about this and stop, and if this is |
| 237 | the case, you can override it with <code>--with-redland=system</code> |
| 238 | to let configuration continue. |
| 239 | </p> |
| 240 | |
| 241 | <p>If you are having problems with configuring several times when |
| 242 | adding or removing options, you may have to tidy up first with either |
| 243 | of these:</p> |
| 244 | <pre> |
| 245 | make clean |
| 246 | rm -f config.cache |
| 247 | </pre> |
| 248 | |
| 249 | <h3>3.4 Compiling</h3> |
| 250 | |
| 251 | <pre> |
| 252 | make |
| 253 | </pre> |
| 254 | |
| 255 | |
| 256 | <h2 id="sec-testing">3.5. Testing</h2> |
| 257 | |
| 258 | <p>You can build and run the built-in tests for Redland with:</p> |
| 259 | <pre> |
| 260 | make check |
| 261 | </pre> |
| 262 | <p>which will run these tests for the enabled languages. These |
| 263 | <em>may fail</em> if the main redland libraries (librdf and |
| 264 | raptor, rasqal) are not installed but are used in nearby source trees. |
| 265 | So in this case you should install redland, raptor and rasqal first</p> |
| 266 | |
| 267 | <p>The language-specific tests can also be built and run with:</p> |
| 268 | <pre> |
| 269 | cd language |
| 270 | make check |
| 271 | </pre> |
| 272 | |
| 273 | <p><b>NOTE</b>: For some language bindings you may need to set the |
| 274 | shared library search path before the tests will work, if Redland's |
| 275 | <code>librdf.so</code> (librdf.dylib etc.) is not installed in a |
| 276 | standard system library patth such as /usr/lib (if it was installed |
| 277 | with <code>--prefix=/usr</code>. |
| 278 | On most systems you can set the <code>LD_LIBRARY_PATH</code> |
| 279 | environment variable to include the directory where the |
| 280 | <code>librdf</code shared library is found. (On OSX this is |
| 281 | <code>DYLD_LIBRARY_PATH</code>). You can also configure it via a |
| 282 | system wide file - see the <code>ld</code>, <code>ld.so</code>, |
| 283 | or<code>ld.so.1</code> or <code>dyld</code> manual pages for details. |
| 284 | </p> |
| 285 | |
| 286 | <h3 id="sec-install">3.6 Installing the bindings</h3> |
| 287 | |
| 288 | <p>To install the bindings, do:</p> |
| 289 | |
| 290 | <pre> |
| 291 | make install |
| 292 | </pre> |
| 293 | |
| 294 | <p>Otherwise, the language-specific installations can be made with:</p> |
| 295 | <pre> |
| 296 | cd language |
| 297 | make install |
| 298 | </pre> |
| 299 | |
| 300 | |
| 301 | |
| 302 | <h2>4. Using the library</h2> |
| 303 | |
| 304 | <p>There are many examples for all of the language interfaces in the |
| 305 | corresponding sub-directories such as <code>perl/example.pl</code> |
| 306 | which may be easier to modify.</p> |
| 307 | |
| 308 | |
| 309 | |
| 310 | <h2>5. Using the Perl interface</h2> |
| 311 | |
| 312 | <p>See the <a href="docs/perl.html">Redland Perl Interface</a> document for |
| 313 | full information on installing and using Redland from Perl.</p> |
| 314 | |
| 315 | <h2>6. Using the Python interface</h2> |
| 316 | |
| 317 | <p>See the <a href="docs/python.html">Redland Python Interface</a> document for |
| 318 | full information on installing and using Redland from Python.</p> |
| 319 | |
| 320 | <h2>7. Using the Ruby interface</h2> |
| 321 | |
| 322 | <p>See the <a href="docs/ruby.html">Redland Ruby Interface</a> document for |
| 323 | full information on installing and using Redland from Ruby.</p> |
| 324 | |
| 325 | <h2>8. Using the PHP interface</h2> |
| 326 | |
| 327 | <p>See the <a href="docs/php.html">Redland PHP Interface</a> document for |
| 328 | full information on installing and using Redland from PHP.</p> |
| 329 | |
| 330 | |
| 331 | <hr /> |
| 332 | |
| 333 | <p>Copyright (C) 2004-2013 <a href="http://www.dajobe.org/">Dave Beckett</a><br />Copyright (C) 2004-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 334 | |
| 335 | </body> |
| 336 | </html> |