install.html revision 848b8605
1848b8605Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2848b8605Smrg<html lang="en">
3848b8605Smrg<head>
4848b8605Smrg  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5848b8605Smrg  <title>Compiling and Installing</title>
6848b8605Smrg  <link rel="stylesheet" type="text/css" href="mesa.css">
7848b8605Smrg</head>
8848b8605Smrg<body>
9848b8605Smrg
10848b8605Smrg<div class="header">
11848b8605Smrg  <h1>The Mesa 3D Graphics Library</h1>
12848b8605Smrg</div>
13848b8605Smrg
14848b8605Smrg<iframe src="contents.html"></iframe>
15848b8605Smrg<div class="content">
16848b8605Smrg
17848b8605Smrg<h1>Compiling and Installing</h1>
18848b8605Smrg
19848b8605Smrg<ol>
20848b8605Smrg<li><a href="#prereq-general">Prerequisites for building</a>
21848b8605Smrg  <ul>
22848b8605Smrg  <li><a href="#prereq-general">General prerequisites</a>
23848b8605Smrg  <li><a href="#prereq-dri">For DRI and hardware acceleration</a>
24848b8605Smrg  </ul>
25848b8605Smrg<li><a href="#autoconf">Building with autoconf (Linux/Unix/X11)</a>
26848b8605Smrg<li><a href="#scons">Building with SCons (Windows/Linux)</a>
27848b8605Smrg<li><a href="#other">Building for other systems</a>
28848b8605Smrg<li><a href="#libs">Library Information</a>
29848b8605Smrg<li><a href="#pkg-config">Building OpenGL programs with pkg-config</a>
30848b8605Smrg</ol>
31848b8605Smrg
32848b8605Smrg
33848b8605Smrg<h1 id="prereq-general">1. Prerequisites for building</h1>
34848b8605Smrg
35848b8605Smrg<h2>1.1 General</h2>
36848b8605Smrg<ul>
37848b8605Smrg<li><a href="http://www.python.org/">Python</a> - Python is required.
38848b8605SmrgVersion 2.6.4 or later should work.
39848b8605Smrg</li>
40848b8605Smrg<br>
41848b8605Smrg<li><a href="http://www.scons.org/">SCons</a> is required for building on
42848b8605SmrgWindows and optional for Linux (it's an alternative to autoconf/automake.)
43848b8605Smrg</li>
44848b8605Smrg<br>
45848b8605Smrg<li>lex / yacc - for building the GLSL compiler.
46848b8605Smrg<br>
47848b8605Smrg<br>
48848b8605SmrgOn Linux systems, flex and bison are used.
49848b8605SmrgVersions 2.5.35 and 2.4.1, respectively, (or later) should work.
50848b8605Smrg<br>
51848b8605Smrg<br>
52848b8605SmrgOn Windows with MinGW, install flex and bison with:
53848b8605Smrg<pre>mingw-get install msys-flex msys-bison</pre>
54848b8605SmrgFor MSVC on Windows, you can find flex/bison programs on the
55848b8605Smrg<a href="ftp://ftp.freedesktop.org/pub/mesa/windows-utils/">Mesa ftp site</a>.
56848b8605Smrg</li>
57848b8605Smrg</ul>
58848b8605Smrg
59848b8605Smrg
60848b8605Smrg<h3 id="prereq-dri">1.2 For DRI and hardware acceleration</h3>
61848b8605Smrg
62848b8605Smrg<p>
63848b8605SmrgThe following are required for DRI-based hardware acceleration with Mesa:
64848b8605Smrg</p>
65848b8605Smrg
66848b8605Smrg<ul>
67848b8605Smrg<li><a href="http://xorg.freedesktop.org/releases/individual/proto/">
68848b8605Smrgdri2proto</a> version 2.6 or later
69848b8605Smrg<li><a href="http://dri.freedesktop.org/libdrm/">libDRM</a>
70848b8605Smrgversion 2.4.33 or later
71848b8605Smrg<li>Xorg server version 1.5 or later
72848b8605Smrg<li>Linux 2.6.28 or later
73848b8605Smrg</ul>
74848b8605Smrg<p>
75848b8605SmrgIf you're using a fedora distro the following command should install all
76848b8605Smrgthe needed dependencies:
77848b8605Smrg</p>
78848b8605Smrg<pre>
79848b8605Smrg  sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
80848b8605Smrg  gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
81848b8605Smrg  expat-devel llvm-devel
82848b8605Smrg</pre>
83848b8605Smrg
84848b8605Smrg
85848b8605Smrg
86848b8605Smrg<h1 id="autoconf">2. Building with autoconf (Linux/Unix/X11)</h1>
87848b8605Smrg
88848b8605Smrg<p>
89848b8605SmrgThe primary method to build Mesa on Unix systems is with autoconf.
90848b8605Smrg</p>
91848b8605Smrg
92848b8605Smrg<p>
93848b8605SmrgThe general approach is the standard:
94848b8605Smrg</p>
95848b8605Smrg<pre>
96848b8605Smrg  ./configure
97848b8605Smrg  make
98848b8605Smrg  sudo make install
99848b8605Smrg</pre>
100848b8605Smrg<p>
101848b8605SmrgBut please read the <a href="autoconf.html">detailed autoconf instructions</a>
102848b8605Smrgfor more details.
103848b8605Smrg</p>
104848b8605Smrg
105848b8605Smrg
106848b8605Smrg
107848b8605Smrg<h1 id="scons">3. Building with SCons (Windows/Linux)</h1>
108848b8605Smrg
109848b8605Smrg<p>
110848b8605SmrgTo build Mesa with SCons on Linux or Windows do
111848b8605Smrg</p>
112848b8605Smrg<pre>
113848b8605Smrg    scons
114848b8605Smrg</pre>
115848b8605Smrg<p>
116848b8605SmrgThe build output will be placed in
117848b8605Smrgbuild/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
118848b8605Smrgexample linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
119848b8605Smrgby -debug for debug builds.
120848b8605Smrg</p>
121848b8605Smrg
122848b8605Smrg<p>
123848b8605SmrgTo build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
124848b8605Smrg</p>
125848b8605Smrg<pre>
126848b8605Smrg    scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
127848b8605Smrg</pre>
128848b8605Smrg<p>
129848b8605SmrgThis will create:
130848b8605Smrg</p>
131848b8605Smrg<ul>
132848b8605Smrg<li>build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll &mdash; Mesa + swrast, binary compatible with Windows's opengl32.dll
133848b8605Smrg<li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
134848b8605Smrg</ul>
135848b8605Smrg<p>
136848b8605SmrgPut them all in the same directory to test them.
137848b8605Smrg</p>
138848b8605Smrg
139848b8605Smrg
140848b8605Smrg
141848b8605Smrg<h1 id="other">4. Building for other systems</h1>
142848b8605Smrg
143848b8605Smrg<p>
144848b8605SmrgDocumentation for other environments (some may be very out of date):
145848b8605Smrg</p>
146848b8605Smrg
147848b8605Smrg<ul>
148848b8605Smrg<li><a href="README.VMS">README.VMS</a> - VMS
149848b8605Smrg<li><a href="README.CYGWIN">README.CYGWIN</a> - Cygwin
150848b8605Smrg<li><a href="README.WIN32">README.WIN32</a> - Win32
151848b8605Smrg</ul>
152848b8605Smrg
153848b8605Smrg
154848b8605Smrg
155848b8605Smrg<h1 id="libs">5. Library Information</h1>
156848b8605Smrg
157848b8605Smrg<p>
158848b8605SmrgWhen compilation has finished, look in the top-level <code>lib/</code>
159848b8605Smrg(or <code>lib64/</code>) directory.
160848b8605SmrgYou'll see a set of library files similar to this:
161848b8605Smrg</p>
162848b8605Smrg<pre>
163848b8605Smrglrwxrwxrwx    1 brian    users          10 Mar 26 07:53 libGL.so -> libGL.so.1*
164848b8605Smrglrwxrwxrwx    1 brian    users          19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
165848b8605Smrg-rwxr-xr-x    1 brian    users     3375861 Mar 26 07:53 libGL.so.1.5.060100*
166848b8605Smrglrwxrwxrwx    1 brian    users          14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
167848b8605Smrglrwxrwxrwx    1 brian    users          23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
168848b8605Smrg-rwxr-xr-x    1 brian    users       23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
169848b8605Smrg</pre>
170848b8605Smrg
171848b8605Smrg<p>
172848b8605Smrg<b>libGL</b> is the main OpenGL library (i.e. Mesa).
173848b8605Smrg<br>
174848b8605Smrg<b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
175848b8605Smrg</p>
176848b8605Smrg
177848b8605Smrg<p>
178848b8605SmrgIf you built the DRI hardware drivers, you'll also see the DRI drivers:
179848b8605Smrg</p>
180848b8605Smrg<pre>
181848b8605Smrg-rwxr-xr-x   1 brian users 16895413 Jul 21 12:11 i915_dri.so
182848b8605Smrg-rwxr-xr-x   1 brian users 16895413 Jul 21 12:11 i965_dri.so
183848b8605Smrg-rwxr-xr-x   1 brian users 11849858 Jul 21 12:12 r200_dri.so
184848b8605Smrg-rwxr-xr-x   1 brian users 11757388 Jul 21 12:12 radeon_dri.so
185848b8605Smrg</pre>
186848b8605Smrg
187848b8605Smrg<p>
188848b8605SmrgIf you built with Gallium support, look in lib/gallium/ for Gallium-based
189848b8605Smrgversions of libGL and device drivers.
190848b8605Smrg</p>
191848b8605Smrg
192848b8605Smrg
193848b8605Smrg<h1 id="pkg-config">6. Building OpenGL programs with pkg-config</h1>
194848b8605Smrg
195848b8605Smrg<p>
196848b8605SmrgRunning <code>make install</code> will install package configuration files
197848b8605Smrgfor the pkg-config utility.
198848b8605Smrg</p>
199848b8605Smrg
200848b8605Smrg<p>
201848b8605SmrgWhen compiling your OpenGL application you can use pkg-config to determine
202848b8605Smrgthe proper compiler and linker flags.
203848b8605Smrg</p>
204848b8605Smrg
205848b8605Smrg<p>
206848b8605SmrgFor example, compiling and linking a GLUT application can be done with:
207848b8605Smrg</p>
208848b8605Smrg<pre>
209848b8605Smrg   gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
210848b8605Smrg</pre>
211848b8605Smrg
212848b8605Smrg<br>
213848b8605Smrg
214848b8605Smrg</div>
215848b8605Smrg</body>
216848b8605Smrg</html>
217