Contents
Building the DRI with Mesa as a normal user
This is a basic guide to building DRI from source. It currently only focuses on building and testing the 3D drivers, but it will allow you to try out the latest drivers from CVS and your own modifications to them without having to modify your current X installation. It is an alternative to the procedure described on the Building page and as such refers to that page for some steps.
The 3D drivers now live in the Mesa tree, so you will have to check out both the DRI CVS tree (for 2D driver and X bits) and the Mesa CVS tree (for 3D driver and GL stuff). You should also get the DRM tree for the updated kernel modules.
Howto
Getting the CVS trees
There are three trees to check out: the DRI tree, the DRM tree and the Mesa tree.
Get the CVS trees using the cvs command. There is no password for anonymous CVS so just hit enter when prompted. You should run all of these commands from the same directory. Once they've all run, you will have three new subdirectories: xc, Mesa, and drm.
Getting DRI (optional)
The source for libGL.so is in this tree. If you want to have debug symbols in libGL.so, you need this tree. If you are going to do some development on the 3D drivers and you plan on using the libGL.so of your current installation, you don't really need this tree. Steps for building libGL.so will be marked as optional throughout this document.
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri login cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri co xc
Getting DRM
This contains the kernel driver source.
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri login cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri co drm
Getting Mesa
The mesa tree is where the sources of the 3D drivers live. This is the place where most developers will do their work. As the Building page explains, you can also build the drivers from the DRI tree, but that is not the preferred way for developers. The rest of this page will assume you do your development in the Mesa tree.
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/mesa login cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/mesa co Mesa
Editing configurations
xc/xc/config/cf/host.def (optional)
Search for the definitions of XF86CardDrivers and DriDrivers for your architecture and remove any driver names from both of these definitions. For i386 it should look like this:
#elif defined(i386Architecture) #define XF86CardDrivers #define DriDrivers
This will exclude the drivers from the build in the DRI tree and save you some time, because you are going to build the drivers in the Mesa tree anyway.
Mesa/configs/default
If necessary, edit the following line to point to the DRM tree you downloaded. If the Mesa tree and the DRM tree are both in the same directory, the default value for DRM_SOURCE_PATH will do. Note that if you for example were in the directory /foo/drm when you downloaded DRM, the DRM source tree would be in /foo/drm/drm, since the cvs process creates a subfolder containing the source.
DRM_SOURCE_PATH=/path/to/drm
Compiling
libGL.so (optional)
Change to the xc/xc/ directory in the DRI tree and run:
make World >& world.log
drivers
To build the drivers for the first time, change to the root of the Mesa tree and run:
make
This will show you all configurations you can build. For example, if you would like to build only the 3D drivers for linux, you could do:
make linux-dri
If you would like to build those drivers using x86 or x86-64 assembly where possible, use linux-dri-x86 or linux-dri-x86-64 respectively. After you have built a configuration once, it has become the default configuration. Future builds can be done by a simple make.
Running
There are a couple of things you need to set up in your environment.
LD_LIBRARY_PATH (optional)
If you want to use the libGL.so that you built in the DRI tree, you need to add the correct path to LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=/path/to/xc/xc/exports/lib:$LD_LIBRARY_PATH
LIBGL_DRIVERS_DIR
To have libGL.so look for the 3D driver in your development tree, you also have to set the LIBGL_DRIVERS_DIR:
export LIBGL_DRIVERS_DIR=/path/to/Mesa/lib
Building the DRM
Please refer to the Building page for instructions on how to build the DRM kernel module.
Finishing up
The Building page has some additional instructions on finishing up.
Troubleshooting
Some build-time troubleshooting hints can also be found on the Building page. However, the issue that is mentioned with Gentoo's OpenGL package switch is not applicable for the approach on this page.


