source: yaz/trunk/fuentes/doc/installation.unix.html @ 265

Last change on this file since 265 was 265, checked in by mabarracus, 4 years ago

Add new source code 5.15.2

File size: 19.3 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2. UNIX</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="installation.html" title="Chapter 2. Compilation and Installation"><link rel="prev" href="installation.html" title="Chapter 2. Compilation and Installation"><link rel="next" href="installation.win32.html" title="3. Windows"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2. UNIX</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="installation.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Compilation and Installation</th><td width="20%" align="right"> <a accesskey="n" href="installation.win32.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="installation.unix"></a>2. UNIX</h2></div></div></div><p>
2    We provide
3    <a class="ulink" href="http://www.debian.org/" target="_top">Debian GNU/Linux</a> (i386 and amd64),
4    <a class="ulink" href="http://www.ubuntu.com" target="_top">Ubuntu</a> (i386 and amd64)
5    and
6    <a class="ulink" href="http://www.centos.org/" target="_top">CentOS</a> (amd64 only) packages for YAZ.
7    You should be able to create packages for other CPUs by building
8    them from the source package.
9   </p><p>
10    YAZ is also part of several packages repositories. Some of them are
11   </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
12      Solaris CSW: <a class="ulink" href="http://www.opencsw.org/packages/yaz/" target="_top">http://www.opencsw.org/packages/yaz/</a>
13     </p></li><li class="listitem"><p>
14      Solaris: <a class="ulink" href="http://unixpackages.com" target="_top">http://unixpackages.com</a>
15     </p></li><li class="listitem"><p>
16      FreeBSD: <a class="ulink" href="http://www.freshports.org/net/yaz" target="_top">http://www.freshports.org/net/yaz</a>
17     </p></li><li class="listitem"><p>
18      Debian: <a class="ulink" href="http://packages.debian.org/search?keywords=yaz" target="_top">http://packages.debian.org/search?keywords=yaz</a>
19     </p></li><li class="listitem"><p>
20      Ubuntu: <a class="ulink" href="https://launchpad.net/ubuntu/+source/yaz" target="_top">https://launchpad.net/ubuntu/+source/yaz</a>
21     </p></li><li class="listitem"><p>
22      NetBSD:
23      <a class="ulink" href="http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/yaz/README.html" target="_top">http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/yaz/README.html</a>
24     </p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="installation.source.unix"></a>2.1. Compiling from source on Unix</h3></div></div></div><p>
25     You can choose to compile YAZ from official tar releases from
26     <a class="ulink" href="http://ftp.indexdata.com/pub/yaz/" target="_top">http://ftp.indexdata.com/pub/yaz/</a>
27     or clone it via Github
28     <a class="ulink" href="https://github.com/indexdata/yaz.git" target="_top">https://github.com/indexdata/yaz.git</a>.
29    </p><p>
30     If you wish to use character set conversion facilities in YAZ or if you
31     are compiling YAZ for use with Zebra it is a good idea to ensure that
32     the iconv library is installed. Some Unixes today already have it
33     - if not, we suggest
34     <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">GNU libiconv</a>.
35    </p><p>
36     YAZ 3.0.16 and later includes a wrapper for the
37     <a class="ulink" href="http://www.icu-project.org/" target="_top">ICU</a>
38     (International Components for Unicode).
39     In order to use this, the developer version of the ICU library
40     must be available. ICU support is recommended for applications
41     such as Pazpar2 and Zebra.
42    </p><p>
43     The <a class="ulink" href="http://xmlsoft.org/XSLT/" target="_top">libxslt</a>,
44     <a class="ulink" href="http://xmlsoft.org/" target="_top">libxml2</a> librararies are required
45     if YAZ is to support SRU/Solr.
46     These libraries are very portable and should compile out-of-the
47     box on virtually all Unix platforms. It is available in binary
48     forms for Linux and others.
49    </p><p>
50     The GNU tools
51     <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top">Autoconf</a>,
52     <a class="ulink" href="http://www.gnu.org/software/automake/" target="_top">Automake</a> and
53     <a class="ulink" href="http://www.gnu.org/software/libtool/" target="_top">Libtool</a>
54     are used to generate Makefiles and configure YAZ for the system.
55     You do <span class="emphasis"><em>not</em></span> need these tools unless you're using the
56     Git version of YAZ.
57    </p><p>
58     The CQL parser for YAZ is built using
59     GNU <a class="ulink" href="http://www.gnu.org/software/bison/" target="_top">Bison</a>.
60     This tool is only needed if you're using the Git version of YAZ.
61    </p><p>
62     YAZ includes a tiny ASN.1 compiler. This compiler is
63     written in <a class="ulink" href="http://www.tcl.tk/" target="_top">Tcl</a>.
64     But as for Bison you do not need it unless you're using Git
65     version of YAZ or you're using the compiler to build your own codecs
66     for private ASN.1.
67    </p><p>
68     If you are checking out from Git, run:
69     </p><pre class="screen">
70      ./buildconf.sh
71     </pre><p>
72     This will create the <code class="filename">configure</code> script and Makefiles.
73    </p><p>
74     The next step is always:
75    </p><pre class="screen">
76     ./configure
77    </pre><p>
78     The configure script attempts to use use the C compiler specified by
79     the <code class="literal">CC</code> environment variable. If not set, GNU C will be
80     used if it is available. The <code class="literal">CFLAGS</code> environment
81     variable holds options to be passed to the C compiler. If you're using
82     Bourne-compatible shell you may pass something like this to use a
83     particular C compiler with optimization enabled:
84    </p><pre class="screen">
85     CC=/opt/ccs/bin/cc CFLAGS=-O ./configure
86    </pre><p>
87     To customize YAZ, the configure script also accepts a set of options.
88     The most important are:
89     </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
90        <code class="literal">--prefix</code>=<em class="replaceable"><code>prefix</code></em>
91       </span></dt><dd><p>Specifies installation prefix for YAZ. This is
92        only needed if you run <code class="literal">make install</code> later to
93        perform a "system" installation. The prefix is
94        <code class="literal">/usr/local</code> if not specified.
95        </p></dd><dt><span class="term">
96        <code class="literal">--enable-tcpd</code>
97       </span></dt><dd><p>The front end server will be built using Wietse's
98        <a class="ulink" href="http://ftp.porcupine.org/pub/security/index.html" target="_top">TCP wrapper library</a>.
99        It allows you to allow/deny clients depending on IP number.
100        The TCP wrapper library is often used in GNU/Linux and
101        BSD distributions.
102        See
103        <span class="citerefentry"><span class="refentrytitle">hosts_access</span>(5)</span>
104        and
105        <span class="citerefentry"><span class="refentrytitle">tcpd</span>(8)</span>.
106        </p></dd><dt><span class="term">
107        <code class="literal">--enable-threads</code>
108       </span></dt><dd><p>YAZ will be built using POSIX threads.
109        Specifically, <code class="constant">_REENTRANT</code> will be defined during
110        compilation.
111        </p></dd><dt><span class="term">
112        <code class="literal">--disable-shared</code>
113       </span></dt><dd><p>The make process will not create shared
114        libraries (also known as shared objects <code class="filename">.so</code>).
115        By default, shared libraries are created -
116        equivalent to <code class="literal">--enable-shared</code>.
117       </p></dd><dt><span class="term">
118        <code class="literal">--disable-shared</code>
119       </span></dt><dd><p>The make process will not create
120        static libraries (<code class="filename">.a</code>).
121        By default, static libraries are created -
122        equivalent to <code class="literal">--enable-static</code>.
123        </p></dd><dt><span class="term">
124        <code class="literal">--with-iconv</code>[=<em class="replaceable"><code>prefix</code></em>]
125       </span></dt><dd><p>Compile YAZ with iconv library in directory
126        <em class="replaceable"><code>prefix</code></em>. By default configure will
127        search for iconv on the system. Use this option if it
128        doesn't find iconv. Alternatively,
129        <code class="literal">--without-iconv</code>, can be used to force YAZ
130        not to use iconv.
131        </p></dd><dt><span class="term">
132        <code class="literal">--with-xslt</code>[=<em class="replaceable"><code>prefix</code></em>]
133       </span></dt><dd><p>Compile YAZ with
134        <a class="ulink" href="http://xmlsoft.org/XSLT/" target="_top">libxslt</a> in directory
135        <em class="replaceable"><code>prefix</code></em>.
136        Use this option if you want XSLT and XML support.
137        By default, configure will
138        search for libxslt on the system. Use this option if
139        libxslt is not found automatically. Alternatively,
140        <code class="literal">--without-xslt</code>, can be used to force YAZ
141        not to use libxslt.
142        </p></dd><dt><span class="term">
143        <code class="literal">--with-xml2</code>[=<em class="replaceable"><code>prefix</code></em>]
144       </span></dt><dd><p>Compile YAZ with
145        <a class="ulink" href="http://xmlsoft.org/" target="_top">libxml2</a> in directory
146        <em class="replaceable"><code>prefix</code></em>.
147        Use this option if you want YAZ to use XML and support SRU/Solr.
148        By default, configure will
149        search for libxml2 on the system. Use this option if
150        libxml2 is not found automatically. Alternatively,
151        <code class="literal">--without-xml2</code>, can be used to force YAZ
152        not to use libxml2.
153        </p><p>
154         Note that option <code class="literal">--with-xslt</code>
155         also enables libxml2.
156        </p></dd><dt><span class="term">
157        <code class="literal">--with-gnutls</code>[=<em class="replaceable"><code>prefix</code></em>]
158       </span></dt><dd><p>YAZ will be linked with the GNU TLS libraries and
159        an SSL COMSTACK will be provided. By default configure enables
160        SSL support for YAZ if the GNU TLS development libraries are found
161        on the system.
162        </p></dd><dt><span class="term">
163        <code class="literal">--with-icu</code>[=<em class="replaceable"><code>prefix</code></em>]
164       </span></dt><dd><p>YAZ will be linked the
165        <a class="ulink" href="http://www.icu-project.org/" target="_top">ICU</a> library in the prefix if given.
166        If prefix is not given, the libraries exposed by the script
167        <span class="application">icu-config</span> will be used if found.
168        </p></dd><dt><span class="term">
169        <code class="literal">--with-memcached</code>
170       </span></dt><dd><p>YAZ will be linked with
171        <a class="ulink" href="http://libmemcached.org/" target="_top">libMemcached</a> to allow
172        for result-set caching for ZOOM.
173        The prefix can not be given.
174        Note that 0.40 of libmemcached is required.
175       </p></dd><dt><span class="term">
176        <code class="literal">--with-redis</code>
177       </span></dt><dd><p>YAZ will be linked with the hiredis C library
178        to allow for result-set caching for ZOOM on a
179        <a class="ulink" href="http://redis.io/" target="_top">redis</a> server.
180        The prefix can not be given.
181       </p></dd></dl></div><p>
182    </p><p>
183     When configured, build the software by typing:
184     </p><pre class="screen">
185      make
186     </pre><p>
187    </p><p>
188     The following files are generated by the make process:
189     </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">src/libyaz.la</code></span></dt><dd><p>
190        Main YAZ library. This is no ordinary library. It's
191        a Libtool archive.
192        By default, YAZ creates a static library in
193        <code class="filename">lib/.libs/libyaz.a</code>.
194       </p></dd><dt><span class="term"><code class="filename">src/libyaz_server.la</code></span></dt><dd><p>
195         Generic Frontend server. This is an add-on for libyaz.la.
196         Code in this library uses POSIX threads functions - if POSIX
197         threads are available on the platform.
198        </p></dd><dt><span class="term"><code class="filename">src/libyaz_icu.la</code></span></dt><dd><p>
199        Functions that wrap the ICU library.
200        </p></dd><dt><span class="term"><code class="filename">ztest/yaz-ztest</code></span></dt><dd><p>Test Z39.50 server.
201       </p></dd><dt><span class="term"><code class="filename">client/yaz-client</code></span></dt><dd><p>Z39.50 client for testing the protocol.
202       See chapter <a class="link" href="yaz-client.html" title="yaz-client">
203       YAZ client</a> for more information.
204       </p></dd><dt><span class="term"><code class="filename">util/yaz-config</code></span></dt><dd><p>A Bourne-shell script, generated by configure, that
205       specifies how external applications should compile - and link with
206       YAZ.
207       </p></dd><dt><span class="term"><code class="filename">util/yaz-asncomp</code></span></dt><dd><p>The ASN.1 compiler for YAZ. Requires the
208       Tcl Shell, <span class="application">tclsh</span>, in
209       <code class="literal">PATH</code> to operate.
210       </p></dd><dt><span class="term"><code class="filename">util/yaz-iconv</code></span></dt><dd><p>This program converts data in one character set to
211       another. This command exercises the YAZ character set
212       conversion API.
213       </p></dd><dt><span class="term"><code class="filename">util/yaz-marcdump</code></span></dt><dd><p>This program parses ISO2709 encoded MARC records
214       and prints them in line-format or XML.
215       </p></dd><dt><span class="term"><code class="filename">util/yaz-icu</code></span></dt><dd><p>This program exposes the ICU wrapper library if that
216       is enabled for YAZ. Only if ICU is available this program is
217       useful.
218       </p></dd><dt><span class="term"><code class="filename">util/yaz-url</code></span></dt><dd><p>This program is a simple HTTP page fetcher ala
219       wget or curl.
220       </p></dd><dt><span class="term"><code class="filename">zoom/zoomsh</code></span></dt><dd><p>
221        A simple shell implemented on top of the
222        <a class="link" href="zoom.html" title="Chapter 3. ZOOM">ZOOM</a> functions.
223        The shell is a command line application that allows you to enter
224        simple commands to perform ZOOM operations.
225       </p></dd><dt><span class="term"><code class="filename">zoom/zoomtst1</code>,
226       <code class="filename">zoom/zoomtst2</code>, ..</span></dt><dd><p>
227        Several small applications that demonstrates the ZOOM API.
228       </p></dd></dl></div><p>
229    </p><p>
230     If you wish to install YAZ in system directories
231     <code class="filename">/usr/local/bin</code>,
232     <code class="filename">/usr/local/lib</code> .. etc, you can type:
233    </p><pre class="screen">
234     make install
235    </pre><p>
236     You probably need to have root access in order to perform this.
237     You must specify the <code class="literal">--prefix</code> option for configure if
238     you wish to install YAZ in other directories than the default
239     <code class="filename">/usr/local/</code>.
240    </p><p>
241     If you wish to perform an un-installation of YAZ, use:
242    </p><pre class="screen">
243     make uninstall
244    </pre><p>
245     This will only work if you haven't reconfigured YAZ (and therefore
246     changed installation prefix). Note that uninstall will not
247     remove directories created by make install, e.g.
248     <code class="filename">/usr/local/include/yaz</code>.
249    </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="installation-linking-yaz-unix"></a>2.2. How to make apps using YAZ on UNIX</h3></div></div></div><p>
250     This section describes how to compile - and link your own
251     applications using the YAZ toolkit.
252     If you're used to Makefiles this shouldn't be hard. As for
253     other libraries you have used before, you need to set a proper include
254     path for your C/C++ compiler and specify the location of
255     YAZ libraries. You can do it by hand, but generally we suggest
256     you use the <code class="filename">yaz-config</code> that is generated
257     by <code class="filename">configure</code>. This is especially
258     important if you're using the threaded version of YAZ which
259     require you to pass more options to your linker/compiler.
260    </p><p>
261     The <code class="filename">yaz-config</code> script accepts command line
262     options that makes the <code class="filename">yaz-config</code> script print
263     options that you should use in your make process.
264     The most important ones are:
265     <code class="literal">--cflags</code>, <code class="literal">--libs</code>
266     which prints C compiler flags, and linker flags respectively.
267    </p><p>
268     A small and complete <code class="literal">Makefile</code> for a C
269     application consisting of one source file,
270     <code class="filename">myprog.c</code>, may look like this:
271     </p><pre class="screen">
272      YAZCONFIG=/usr/local/bin/yaz-config
273      CFLAGS=`$(YAZCONFIG) --cflags`
274      LIBS=`$(YAZCONFIG) --libs`
275      myprog: myprog.o
276         $(CC) $(CFLAGS) -o myprog myprog.o $(LIBS)
277      </pre><p>
278    </p><p>
279     The CFLAGS variable consists of a C compiler directive that will set
280     the include path to the <span class="emphasis"><em>parent</em></span> directory
281     of <code class="filename">yaz</code>. That is, if YAZ header files were
282     installed in <code class="filename">/usr/local/include/yaz</code>,
283     then include path is set to <code class="filename">/usr/local/include</code>.
284     Therefore, in your applications you should use
285     </p><pre class="screen">
286      #include &lt;yaz/proto.h&gt;
287     </pre><p>
288     and <span class="emphasis"><em>not</em></span>
289     </p><pre class="screen">
290      #include &lt;proto.h&gt;
291     </pre><p>
292    </p><p>
293     For Libtool users, the <code class="filename">yaz-config</code> script provides
294     a different variant of option <code class="literal">--libs</code>, called
295     <code class="literal">--lalibs</code> that returns the name of the
296     Libtool archive(s) for YAZ rather than the ordinary ones.
297    </p><p>
298     For applications using the threaded version of YAZ,
299     specify <code class="literal">threads</code> after the
300     other options. When <code class="literal">threads</code> is given,
301     more flags and linker flags will be printed by
302     <code class="filename">yaz-config</code>. If our previous example was
303      using threads, you'd have to modify the lines that set
304     <code class="literal">CFLAGS</code> and <code class="literal">LIBS</code> as
305     follows:
306     </p><pre class="screen">
307      CFLAGS=`$(YAZCONFIG) --cflags threads`
308      LIBS=`$(YAZCONFIG) --libs threads`
309     </pre><p>
310     There is no need specify POSIX thread libraries in your Makefile.
311     The <code class="literal">LIBS</code> variable includes that as well.
312    </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="installation.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="installation.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="installation.win32.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Compilation and Installation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3. Windows</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.