Code

Merge branch 'upstream-1.3' into experimental
[pkg-rrdtool.git] / doc / rrdbuild.pod
1 =head1 NAME
3 rrdbuild - Instructions for building RRDtool
5 =head1 OVERVIEW
7 If you downloaded the source of rrdtool you have to compile it. This
8 document will give some information on how this is done.
10 RRDtool relies on services of third part libraries. Some of these libraries
11 may already be installed on your system. You have to compile copies of the other
12 ones before you can build RRDtool.
14 This document will tell you about all the necessary steps to get going.
16 These instructions assume you are using a B<bash> shell. If you use csh/tcsh,
17 then you can either type F<bash> to switch to bash for the compilation or if
18 you know what you are doing just replace the export bits with
19 setenv.
21 We further assume that your copies of B<tar> and B<make> are actually B<GNU
22 tar> and B<GNU make> respectively. It could be that they are installed as
23 B<gtar> and B<gmake> on your system.
25 =head1 OPTIMISTIC BUILD
27 Before you start to build RRDtool, you have to decide two things:
29 =over
31 =item 1.
33 In which directory you want to build the software.
35 =item 2.
37 Where you want to install the software.
39 =back
41 Once you have decided. Save the two locations into environment variables.
43  BUILD_DIR=/tmp/rrdbuild
44  INSTALL_DIR=/usr/local/rrdtool-1.3.1
47 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
48 a different directory!
50 Now make sure the BUILD_DIR exists and go there:
52  mkdir -p $BUILD_DIR
53  cd $BUILD_DIR
55 Lets first assume you already have all the necessary libraries
56 pre-installed. 
58  wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.1.tar.gz
59  gunzip -c rrdtool-1.3.1.tar.gz | tar xf -
60  cd rrdtool-1.3.1
61  ./configure --prefix=$INSTALL_DIR && make && make install
63 Ok, this was very optimistic. This try will probably have ended with
64 B<configure> complaining about several missing libraries.
66 =head1 INSTALLING DEPENDENCIES
68 If your OS lets you install additional packages from a software repository,
69 you may get away with installing the missing packages. When the packages are
70 installed, run configure again and try to compile again. Below you find some
71 hints on getting your OS ready for the rrdtool compilation.
73 Additions to this list are welcome.
75 =head2 OpenSolaris 2008.05
77 Just add a compiler and the gnome development package:
79  pkg install sunstudioexpress
80  pkg install SUNWgnome-common-devel
82 There is a problem with F<cairo.pc> on opensolaris. It suggests that
83 xrender is required for compilation with cairo. This is not true and also
84 bad since opensolaris does not include an F<xrender.pc> file. Use perl to
85 fix this:
87  perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc 
89 =head2 Debian / Ubuntu
91 Use apt-get to make sure you have all that is required. A number
92 of packages will get added through dependencies.
94  apt-get install libpango1.0-dev libxml2-dev
96 =head2 Gentoo
98 In Gentoo installing rrdtool is really simple you just need to B<emerge
99 rrdtool>. All dependencies will be handled automatically by the portage
100 system. The only thing you should care about are USE flags, which allow you
101 fine tune features rrdtool will be built with. Currently the following USE
102 flags are available:
104  doc    - install .html and .txt documentation
105           into /usr/share/doc/rrdtool-1.x.xx/
106  perl   - build and install perl language bindings
107  python - build and install python language bindings
108  ruby   - build and install ruby language bindings
109  tcl    - build and install tcl language bindings
110  rrdcgi - build and install rrdcgi
112 After you've decided which USE flags you need, set them either in
113 F<make.conf> or F</etc/portage/package.use> and finally run:
115  # emerge -va rrdtool
117 Take a look at Gentoo handbook for further details on how to manage USE
118 flags: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2
120 =head1 BUILDING DEPENDENCIES
122 But again this may have been too optimistic still, and you actually have to
123 compile your own copies of some of the required libraries. Things like
124 libpng and zlib are pretty standard so you will probably have them on your
125 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
126 possible that they are pretty old and thus don't live up to our
127 expectations, so you may want to compile their latest versions.
129 =head2 General build tips for AIX
131 If you are working with AIX, you may find the the B<--disable-shared> option
132 will cause things to break for you. In that case you may have to install the
133 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
134 instead.
136 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
138  export CC=/usr/vac/bin/cc
139  export PERLCC=$CC
141 (Better instructions for AIX welcome!)
143 =head2 Build Instructions
145 In order to build rrdtool need a compiler on your system. Unfortunately
146 compilers are not all alike. This has an effect on the CFLAGS you want to
147 set. The examples below are for the popular GCC compiler suite. If you have
148 an other compilers here are some ides:
150 =over
152 =item Sun Forte
154  CFLAGS="-xO3 -kPIC"
156 =back
158 Some libraries want to know where other libraries are. For this to work,
159 set the following environment variable
161  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
162  export PATH=$INSTALL_DIR/bin:$PATH
164 The above relies on the presence of the F<pkgconfig> program. Below you find instructions
165 on how to compile pkgconfig.
167 Since we are compiling libraries dynamically, they must know where to find
168 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
169 the syntax again differs from system to system:
171 =over
173 =item Solaris
175  export LDFLAGS=-R${INSTALL_DIR}/lib 
177 =item Linux
179  export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" 
181 =item HPUX
183  export LDFLAGS="+b${INSTALL_DIR}/lib"
185 =item AIX
187  export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
189 =back 
191 If you have GNUmake installed and it is not called 'make',
192 then do
194  export MAKE=gmake
195  export GNUMAKE=gmake
197 otherwise just do
199  export MAKE=make
201 =head3 Building pkgconfig
203 As mentioned above, without pkgconfig the whole build process will be lots
204 of pain and suffering, so make sure you have a copy on your system. If it is
205 not available natively, here is how to compile it.
207  wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
208  gunzip -c pkg-config-0.23.tar.gz | tar xf -
209  cd pkg-config-0.23
210  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
211  $MAKE
212  $MAKE install
214 =head3 Building zlib
216 Chances are very high that you already have that on your system ... 
218  cd $BUILD_DIR
219  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
220  gunzip -c zlib-1.2.3.tar.gz | tar xf -
221  cd zlib-1.2.3
222  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared
223  $MAKE
224  $MAKE install
226 =head3 Building libpng
228 Libpng itself requires zlib to build, so we need to help a bit. If you
229 already have a copy of zlib on your system (which is very likely) you can
230 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
231 the end of line 4 means that line 4 and line 5 are on one line.
233  cd $BUILD_DIR
234  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
235  gunzip -c libpng-1.2.18.tar.gz | tar xf -
236  cd libpng-1.2.10
237  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
238  $MAKE
239  $MAKE install
241 =head3 Building freetype
243  cd $BUILD_DIR
244  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
245  gunzip -c freetype-2.3.5.tar.gz | tar xf -
246  cd freetype-2.3.5
247  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
248  $MAKE
249  $MAKE install
251 If you run into problems building freetype on Solaris, you may want to try to
252 add the following at the start the configure line:
254  env EGREP=egrep
256 =head3 Building LibXML2
258  cd $BUILD_DIR
259  wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-sources-2.6.31.tar.gz
260  gunzip -c libxml2-sources-2.6.32.tar.gz | tar xf -
261  cd libxml2-sources-2.6.32
262  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
263  $MAKE
264  $MAKE install
266 =head3 Building fontconfig
268 Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you
269 may want to adjust that so that fontconfig finds the fonts on your system.
270 Run the fc-cache program to build the fontconfig cache after changing the
271 config file.
273  cd $BUILD_DIR
274  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
275  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
276  cd fontconfig-2.4.2
277  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
278  $MAKE
279  $MAKE install
281 =head3 Building Pixman
283  cd $BUILD_DIR
284  wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz
285  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
286  cd pixman-0.10.0
287  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
288  $MAKE
289  $MAKE install
291 =head3 Building Cairo
293  cd $BUILD_DIR
294  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz
295  gunzip -c cairo-1.4.10.tar.gz   | tar xf -
296  cd cairo-1.4.10
297  ./configure --prefix=$INSTALL_DIR \
298     --enable-xlib=no \
299     --enable-xlib-render=no \
300     --enable-win32=no \
301     CFLAGS="-O3 -fPIC"
302  $MAKE
303  $MAKE install
305 =head3 Building Glib
307  cd $BUILD_DIR
308  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz
309  gunzip -c glib-2.12.13.tar.gz  | tar xf -
310  cd glib-2.12.13
311  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
312  $MAKE
313  $MAKE install
315 =head3 Building Pango
317  cd $BUILD_DIR
318  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.gz
319  gunzip -c pango-1.21.1.tar.gz  | tar xf -
320  cd pango-1.21.1
321  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x
322  $MAKE
323  $MAKE install
325 =head2 Building rrdtool (second try)
327 Now all the dependent libraries are built and you can try again. This time
328 you tell configure where it should be looking for libraries and include
329 files. This is done via environment variables. Depending on the shell you
330 are running, the syntax for setting environment variables is different.
332 And finally try building again. We disable the python and tcl bindings
333 because it seems that a fair number of people have ill configured python and
334 tcl setups that would prevent rrdtool from building if they are included in
335 their current state.
337  cd $BUILD_DIR/rrdtool-1.3.1
338  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
339  $MAKE clean
340  $MAKE
341  $MAKE install
343 SOLARIS HINT: if you want to build  the perl module for the native perl (the
344 one shipping with Solaris) you will need the Sun Forte compiler installed on
345 your box or you have to hand-tune bindings/perl-shared/Makefile while
346 building!
348 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
349 your build has been successful.
351 =head1 AUTHOR
353 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>