scons: Parse = operator in source lists too.
[mesa.git] / docs / install.html
1 <HTML>
2
3 <TITLE>Compiling and Installing</TITLE>
4
5 <link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7 <BODY>
8
9
10 <H1>Compiling and Installing</H1>
11
12 <ol>
13 <li><a href="#prereq-general">Prerequisites for building</a>
14 <ul>
15 <li><a href="#prereq-general">General prerequisites</a>
16 <li><a href="#prereq-dri">For DRI and hardware acceleration</a>
17 </ul>
18 <li><a href="#autoconf">Building with autoconf (Linux/Unix/X11)</a>
19 <li><a href="#scons">Building with SCons (Windows)</a>
20 <li><a href="#legacy">Building with legacy Makefiles (deprecated)</a>
21 <li><a href="#other">Building for other systems</a>
22 <li><a href="#libs">Library Information</a>
23 <li><a href="#pkg-config">Building OpenGL programs with pkg-config
24 </ol>
25
26
27 <a name="prereq-general">
28 <h1>1. Prerequisites for building</h1>
29
30 <h2>1.1 General</h2>
31 <ul>
32 <li>lex / yacc - for building the GLSL compiler.
33 On Linux systems, flex and bison are used.
34 Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
35 <br>
36 <br>
37 On Windows with MinGW, install flex and bison with:
38 <pre>mingw-get install msys-flex msys-bison</pre>
39 </li>
40 <li>python - Python is needed for building the Gallium components.
41 Version 2.6.4 or later should work.
42 <br>
43 <br>
44 To build OpenGL ES 1.1 and 2.0 you'll also need
45 <a href="http://xmlsoft.org/sources/win32/python/libxml2-python-2.7.7.win32-py2.7.exe">libxml2-python</a>.
46 </li>
47 </ul>
48
49
50 <a name="prereq-dri">
51 <h3>1.2 For DRI and hardware acceleration</h3>
52
53 <p>
54 The following are required for DRI-based hardware acceleration with Mesa:
55 </p>
56
57 <ul>
58 <li><a href="http://xorg.freedesktop.org/releases/individual/proto/"
59 target="_parent">dri2proto</a> version 2.6 or later
60 <li><a href="http://dri.freedesktop.org/libdrm/" target="_parent">libDRM</a>
61 version 2.4.33 or later
62 <li>Xorg server version 1.5 or later
63 <li>Linux 2.6.28 or later
64 </ul>
65 </p>
66 <p>
67 If you're using a fedora distro the following command should install all
68 the needed dependencies:
69 <pre>
70 sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
71 gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
72 expat-devel llvm-devel
73 </pre>
74
75
76
77 <a name="autoconf">
78 <H1>2. Building with autoconf (Linux/Unix/X11)</H1>
79
80 <p>
81 The primary method to build Mesa on Unix systems is with autoconf.
82 </p>
83
84 <p>
85 The general approach is the standard:
86 <pre>
87 ./configure
88 make
89 sudo make install
90 </pre>
91 But please read the <a href="autoconf.html">detailed autoconf instructions</a>
92 for more details.
93 </p>
94
95
96
97 <a name="scons">
98 <H1>3. Building with SCons (Windows)</H1>
99
100 <p>
101 To build Mesa with SCons on Linux or Windows do
102 </p>
103 <pre>
104 scons
105 </pre>
106 <p>
107 The build output will be placed in
108 build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
109 example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
110 by -debug for debug builds.
111 </p>
112
113 <p>
114 To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
115 </p>
116 <pre>
117 scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
118 </pre>
119 <p>
120 This will create:
121 </p>
122 <ul>
123 <li>build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll &mdash; Mesa + swrast, binary compatible with Windows's opengl32.dll
124 <li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
125 </ul>
126 <p>
127 Put them all in the same directory to test them.
128 </p>
129
130
131
132 <a name="legacy">
133 <h1>4. Building with legacy Makefiles (deprecated)</h1>
134
135 <p>
136 The legacy Mesa build system is based on a collection of pre-defined
137 system configurations.
138 Some of these might work for older systems not supported by autoconf.
139 </p>
140 <p>
141 To see the list of configurations, just type <code>make</code>.
142 Then choose a configuration from the list and type <code>make</code>
143 <em>configname</em>.
144 </p>
145
146 <p>
147 Mesa may be built in several different ways using the predefined configurations:
148 </p>
149 <ul>
150 <li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as
151 a software renderer using Xlib to do all rendering.
152 The libGL.so library will be a self-contained rendering library that will
153 allow you to run OpenGL/GLX applications on any X server (regardless of
154 whether it supports the GLX X server extension).
155 You will <em>not</em> be able to use hardware 3D acceleration.
156 <p>
157 To compile stand-alone Mesa type <code>make</code> in the top-level directory.
158 You'll see a list of supported system configurations.
159 Choose one from the list (such as linux-x86), and type:
160 </p>
161 <pre>
162 make linux-x86
163 </pre>
164 <p>This will produce libGL.so and several other libraries</p>
165 </li>
166
167 <li><b><em>DRI/accelerated</em></b> - The DRI hardware drivers for
168 accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
169 The libGL.so library will support the GLX extension and will load/use
170 the DRI hardware drivers.
171
172
173 <p>
174 Build Mesa and the DRI hardware drivers by running
175 </p>
176 <pre>
177 make linux-dri
178 </pre>
179 <p>
180 There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>,
181 and <code>linux-ppc</code> configurations which are optimized for those
182 architectures.
183 </p>
184 <p>
185 Make sure you have the prerequisite versions of DRM and Xserver mentioned
186 above.
187 </p>
188
189 </ul>
190
191
192 <p>
193 Later, if you want to rebuild for a different configuration run
194 <code>make realclean</code> before rebuilding.
195 </p>
196
197
198
199 <a name="install">
200 <H2>Installing the header and library files</H2>
201
202 <p>
203 The standard location for the OpenGL header files on Unix-type systems is
204 in <code>/usr/include/GL/</code>.
205 The standard location for the libraries is <code>/usr/lib/</code>.
206 For more information see, the
207 <a href="http://oss.sgi.com/projects/ogl-sample/ABI/" target="_parent">
208 Linux/OpenGL ABI specification</a>.
209 </p>
210
211 <p>
212 If you'd like Mesa to co-exist with another implementation of OpenGL that's
213 already installed, you'll have to choose different directories, like
214 <code>/usr/local/include/GL/</code> and <code>/usr/local/lib/</code>.
215 </p>
216
217 <p>
218 To install Mesa's headers and libraries, run <code>make install</code>.
219 But first, check the Mesa/configs/default file and examine the values
220 of the <b>INSTALL_DIR</b> and <b>DRI_DRIVER_INSTALL_DIR</b> variables.
221 Change them if needed, then run <code>make install</code>.
222 </p>
223
224 <p>
225 The variable
226 <b>DESTDIR</b> may also be used to install the contents to a temporary
227 staging directory.
228 This can be useful for package management.
229 For example: <code>make install DESTDIR=/somepath/</code>
230 </p>
231
232 <p>
233 Note: at runtime you can use the LD_LIBRARY_PATH environment variable
234 (on Linux at least) to switch
235 between the Mesa libraries and other vendor's libraries whenever you want.
236 This is a handy way to compare multiple OpenGL implementations.
237 </p>
238
239
240
241
242 <a name="other">
243 <H1>5. Building for other systems</H1>
244
245 <p>
246 Documentation for other environments (some may be very out of date):
247 </p>
248
249 <UL>
250 <li><A HREF="README.VMS">README.VMS</A> - VMS
251 <LI><A HREF="README.CYGWIN">README.CYGWIN</A> - Cygwin
252 <LI><A HREF="README.WIN32">README.WIN32</A> - Win32
253 </UL>
254
255
256
257 <a name="libs">
258 <H1>6. Library Information</H1>
259
260 <p>
261 When compilation has finished, look in the top-level <code>lib/</code>
262 (or <code>lib64/</code>) directory.
263 You'll see a set of library files similar to this:
264 </p>
265 <pre>
266 lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
267 lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
268 -rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
269 lrwxrwxrwx 1 brian users 11 Mar 26 07:53 libGLU.so -> libGLU.so.1*
270 lrwxrwxrwx 1 brian users 20 Mar 26 07:53 libGLU.so.1 -> libGLU.so.1.3.060100*
271 -rwxr-xr-x 1 brian users 549269 Mar 26 07:53 libGLU.so.1.3.060100*
272 lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
273 lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
274 -rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
275 </pre>
276
277 <p>
278 <b>libGL</b> is the main OpenGL library (i.e. Mesa).
279 <br>
280 <b>libGLU</b> is the OpenGL Utility library.
281 <br>
282 <b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
283 </p>
284
285 <p>
286 If you built the DRI hardware drivers, you'll also see the DRI drivers:
287 </p>
288 <pre>
289 -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
290 -rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i965_dri.so
291 -rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
292 -rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
293 -rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
294 </pre>
295
296 <p>
297 If you built with Gallium support, look in lib/gallium/ for Gallium-based
298 versions of libGL and device drivers.
299 </p>
300
301
302 <a name="pkg-config">
303 <H1>7. Building OpenGL programs with pkg-config</H1>
304
305 <p>
306 Running <code>make install</code> will install package configuration files
307 for the pkg-config utility.
308 </p>
309
310 <p>
311 When compiling your OpenGL application you can use pkg-config to determine
312 the proper compiler and linker flags.
313 </p>
314
315 <p>
316 For example, compiling and linking a GLUT application can be done with:
317 </p>
318 <pre>
319 gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
320 </pre>
321
322 <br>
323
324
325 </body>
326 </html>