updated build instructions
[rrdtool.git] / doc / rrdbuild.pod
1 =head1 NAME
2
3 rrdbuild - Instructions for building RRDtool
4
5 =head1 DESCRIPTION
6
7 =head2 Overview
8
9 If you downloaded the source of rrdtool you have to compile it. This
10 document will give some information on how this is done.
11
12 RRDtool relies on services of thrid part libraries. Some of these libraries
13 may already be installed on your system. You have to compile copies of the other
14 ones before you can build RRDtool.
15
16 This document will tell you about all the necessary steps to get going.
17
18 =head2 Building
19
20 Before you start to build RRDtool, you have to decide two things:
21
22 =over
23
24 =item 1.
25
26 In which directory you want to build the software.
27
28 =item 2.
29
30 Where you want to install the software.
31
32 =back
33
34 Once you have decided. Save the two locations into environment variables.
35 Depending on the shell you are using, you can do either (bash,zsh):
36
37  BUILD_DIR=/tmp/rrdbuild
38  INSTALL_DIR=/usr/local/rrdtool-1.2.99907080300
39
40 Or if you run tcsh:
41
42  set BUILD_DIR=/tmp/rrdbuild
43  set INSTALL_DIR=/usr/local/rrdtool-1.2.99907080300
44
45 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
46 a different directory!
47
48 Now make sure the BUILD_DIR exists and go there:
49
50  mkdir -p $BUILD_DIR
51  cd $BUILD_DIR
52
53 Lets first assume you already have all the necessary libraries
54 pre-installed. Note that these instructions assume that your copies of
55 B<tar> and B<make> are actually B<GNU tar> and B<GNU make> respectively. It
56 could be that they are installed as B<gtar> and B<gmake> on your system.
57
58  wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.99907080300.tar.gz
59  tar zxf rrdtool-1.2.99907080300.tar.gz
60  cd rrdtool-1.2.99907080300
61  ./configure --prefix=$INSTALL_DIR && make && make install
62
63 Ok, this was very optimistic. This try will probably have ended with
64 B<configure> complaining about several missing libraries. If you are on a
65 Linux or *bsd system you may want to just install the missing bits from your
66 software repository. When you do that, make sure you also get the B<-dev>
67 package for each library you install. Once you have the missing bits on
68 board, just re-run the last line of the instructions above.
69
70 But again this may have been too optimistic, and you actually have to
71 compile your own copies of the required libraries.
72
73 =head3 Build Tipps for AIX
74
75 If you are woking with AIX, you may find the the B<--disable-shared> option
76 will cause things to break for you. In that case you may have to install the
77 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
78 instead.
79
80 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
81
82  export CC=/usr/vac/bin/cc
83  export PERLCC=$CC
84
85 (Better instructions for AIX welcome!)
86
87 =head2 Building Libraries
88
89 In order to build the libraries you need a compiler on your system.
90 Unfortunately compilers are not all alike. This has an effect on the CFLAGS
91 you want to set. The examples below are for the popular GCC compiler suite.
92 If you have an other compile you have to use the following settings:
93
94 =over
95
96 =item Sun Forte
97
98  CFLAGS="-xO3 -kPIC"
99
100 =back
101
102 =over 
103
104 Some libraries want to know where other libraries are. For this to work,
105 set the following environamen variable
106
107  export PKG_CONFIG_PATH=${INSTALLDIR}/lib/pkgconfig
108  
109 or in tcsh
110
111  setenv PKG_CONFIG_PATH ${INSTALLDIR}/lib/pkgconfig
112
113 =item Building zlib
114
115 Chances are very high that you already have that on your system ... 
116
117  cd $BUILD_DIR
118  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
119  tar  zxf zlib-1.2.3.tar.gz
120  cd zlib-1.2.3
121  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
122  make
123  make install
124
125 =item Building libpng
126
127 Libpng itself requires zlib to build, so we need to help a bit. If you
128 already have a copy of zlib on your system (which is very likley) you can
129 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
130 the end of line 4 means that line 4 and line 5 are on one line.
131
132  cd $BUILD_DIR
133  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
134  tar zxvf libpng-1.2.18.tar.gz
135  cd libpng-1.2.10
136  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
137  make
138  make install
139
140 =item Building freetype
141
142  cd $BUILD_DIR
143  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
144  tar zxvf freetype-2.3.5.tar.gz
145  cd freetype-2.3.5
146  env CFLAGS="-O3 -fPIC" \
147      ./configure --prefix=$INSTALL_DIR
148  make
149  make install
150
151 If you run into problems building freetype on Solaris, you may want to try to
152 add the following at the end of the configure line:
153
154  GNUMAKE=gmake EGREP=egrep
155
156 =item Building fontconfig
157
158 Note that fontconfig has a runtime configuration file in INSTALL_DIR/etc you
159 may want to adjust that so that fontconfig finds the fonts on your system.
160 Run the fc-cache program to build the fontconfig cache after changeing the
161 config file.
162
163  cd $BUILD_DIR
164  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
165  tar zxvf fontconfig-2.4.2.tar.gz  
166  cd fontconfig-2.4.2
167  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
168  make
169  make install
170
171 =item Building Cairo
172
173  cd $BUILD_DIR
174  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.4.10.tar.gz
175  tar zxvf cairo-1.4.10.tar.gz  
176  cd cairo-1.4.10
177  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR \
178     --enable-xlib=no \
179     --enable-xlib-render=no \
180     --enable-win32=no
181  make
182  make install
183
184 =item Building Glib
185
186  cd $BUILD_DIR
187  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.12.13.tar.gz
188  tar zxvf glib-2.12.13.tar.gz 
189  cd glib-2.12.13
190  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
191  make
192  make install
193
194 =item Building Pango
195
196  cd $BUILD_DIR
197  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.17.5.tar.gz
198  tar zxvf pango-1.17.5.tar.gz 
199  cd pango-1.17.5
200  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
201  make
202  make install
203
204 =back
205
206 Now all the dependent libraries are built and you can try again. This time
207 you tell configure where it should be looking for libraries and include
208 files. This is done via environment variables. Depending on the shell you
209 are running, the syntax for setting environment variables is different.
210 Under csh/tcsh you use:
211
212  setenv CPPFLAGS -I$INSTALL_DIR/include
213  setenv LDFLAGS "-L$INSTALL_DIR/lib -R$INSTALL_DIR/lib"
214  setenv CFLAGS -O3
215
216 If you are running bash/sh/ash/ksh/zsh use this:
217
218  CPPFLAGS=-I$INSTALL_DIR/include
219  LDFLAGS="-R$INSTALL_DIR/lib -L$INSTALL_DIR/lib"
220  CFLAGS=-O3
221  export CPPFLAGS LDFLAGS CFLAGS
222
223 And finally try building again. We disable the python and tcl bindings
224 because it seems that a fair number of people have ill configured python and
225 tcl setups that would prevent rrdtool from building if they are included in
226 their current state.
227
228  cd $BUILD_DIR/rrdtool-1.2.99907080300
229  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
230  make clean
231  make
232  make install
233
234 SOLARIS HINT: if you want to build  the perl module for the native perl (the
235 one shipping with solaris) you will need the sun forte compiler installed on
236 your box or you have to hand-tune bindings/perl-shared/Makefile while
237 building!
238
239 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
240 your build has been successful.
241
242 =head1 AUTHOR
243
244 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
245