The X.Org Modular Tree User's Guide
Contents
Introduction
This is a quick guide for compiling the Xserver or a driver from git. It takes advantage of modularization to minimize the required download and compilation time to get the latest Xserver/driver. Once the basic environment is setup, it is easy to add more advanced features using a similar procedure. See ModularDevelopersGuide for a more detailed introduction to the modular tree and the git repositories, and UsingGit for git.
[The scripts and guides I've heard of are targeted for people with rich space/bandwidth/CPU resources. This is for people who want to get started on X or users who submit bug reports and want to test latest server/driver. I prefer a guide to a script because most of the dependencies will soon be satisfied by distros.]
[for such a guide using jhBuild, refer to JhBuildInstructions]
Repositories
In order to build the Xserver, several X.org modules are required which are available in the following repositories:
http://ftp.x.org/pub/individual/ for released tarballs.
http://cgit.freedesktop.org/ for git development repositories.
In addition to the X.org repositories, each module should also be available from your distribution. With the exception of a few modules, the basic modules are stable and hardly change. Thus, it should be possible to satisfy the Xserver dependencies mostly with distribution packages and then add 4 or 5 modules from the released tarballs or the development repositories.
Build macros
The build macros module contains a set of macros used by the build scripts across X.org modules. They are needed by both the Xserver and the drivers, if you are compiling from git.
$ git-clone git://anongit.freedesktop.org/git/xorg/util/macros $ cd macros $ ./autogen.sh --prefix=/opt/xorg $ make install
After installing the build macros, you should point your build environment to the newly installed macros. Add "/opt/xorg/share/aclocal" at the include patch of the aclocal tool:
Bash:
$ export ACLOCAL="aclocal -I /opt/xorg/share/aclocal"
C shell:
$ setenv ACLOCAL "aclocal -I /opt/xorg/share/aclocal"
Compile Xserver
The Xserver requires several modules, it is suggested to install them from distribution packages, if proper versions are available.
Protocol headers
The protocol headers define the constants, types and requests for the core X11 protocol and its extensions. The Xserver understands and implements this protocol.
- proto/x11proto 7.0
- proto/xextproto 7.0
- proto/bigreqsproto 1.0
- proto/xcmiscproto 1.1
- proto/fontsproto 2.0
- proto/inputproto 1.3
- proto/kbproto 1.0
- proto/resourceproto 1.0
proto/scrnsaverproto 1.1
- proto/videoproto 2.2
- proto/recordproto 1.13
- proto/trapproto 3.4
- proto/xf86bigfontproto 1.1
- proto/xf86dgaproto 2.0
- proto/xf86miscproto 0.9
- proto/xf86vidmodeproto 2.2
proto/compositeproto 0.3.1
- proto/damageproto 1.0
proto/fixesproto 4.0
- proto/randrproto 1.1
- proto/renderproto 0.9
- proto/evieproto 1.0
- proto/xineramaproto 1.1
proto/glproto 1.4.7
- proto/xf86driproto 2.0
$ git-clone git://anongit.freedesktop.org/git/xorg/proto/x11proto $ cd x11proto $ ./autogen.sh --prefix=/opt/xorg $ make install
No special configure options should be required.
Libraries
The Xserver requires some libraries both internally developed and from external projects. The build and runtime systems need to be pointed to the location of these libraries. Add "/opt/xorg/lib/pkgconfig" at the beginning of the PKG_CONFIG_PATH environment variable and "/opt/xorg/lib" at the beginning of the LD_LIBRARY_PATH and LD_RUN_PATH environment variables:
Bash:
$ export PKG_CONFIG_PATH=/opt/xorg/lib/pkgconfig:${PKG_CONFIG_PATH}
$ export LD_LIBRARY_PATH=/opt/xorg/lib:${LD_LIBRARY_PATH}
$ export LD_RUN_PATH=/opt/xorg/lib:${LD_RUN_PATH}C Shell:
$ setenv PKG_CONFIG_PATH /opt/xorg/lib/pkgconfig:${PKG_CONFIG_PATH}
$ setenv LD_LIBRARY_PATH /opt/xorg/lib:${LD_LIBRARY_PATH}
$ setenv LD_RUN_PATH /opt/xorg/lib:${LD_RUN_PATH}
Libraries - External
The Xserver requires some common libraries from external projects.
- freetype
- zlib
Libraries - Mesa
The Mesa libraries provide the infrastructure for 3D graphics.
- mesa/libdrm 2.3
- mesa/mesa git
$ git-clone git://anongit.freedesktop.org/git/mesa/drm $ cd drm $ ./autogen.sh --prefix=/opt/xorg $ make $ make install
Currently, the GLX extension requires a pointer to the Mesa source tree. Checkout the Mesa git tree:
$ git-clone git://anongit.freedesktop.org/git/mesa/mesa
Libraries - X.org
These are utility libraries used by the Xserver for various tasks such as authentication, font access, etc.
- lib/libxtrans 1.0
- lib/libXau 1.0
- lib/libXdmcp 1.0
- lib/libX11 1.0
- lib/libfontenc 1.0
- lib/libXfont 1.0
- lib/libxkbfile 1.0
$ git-clone git://anongit.freedesktop.org/git/xorg/lib/libXau $ cd libXau $ ./autogen.sh --prefix=/opt/xorg $ make install
No special configure options should be required. libX11 has some configure options, notably the --with-xcb option to use XCB for low-level protocol implementation. This option requires libxcb and it is recommended to leave it enabled as it offers some advantages.
Internal libraries generally fall in one of three categories: utility, client (or protocol-binding) and toolkit. Utility libs (e.g. libXau, libXfont) are used by the Xserver to perform tasks described above, client libs (e.g. libX11, libXrender, libXcomposite) are used by X11 apps to submit requests to the Xserver over the X11 protocol and its extensions. libX11 is a client/toolkit library and normally would not be required to build Xserver. X.org developers are working towards dropping libX11 from the Xserver build dependencies and unweaving the Mesa and Xserver build processes.
Xserver
$ git-clone git://anongit.freedesktop.org/xorg/xserver $ cd xserver $ ./autogen.sh --prefix=/opt/xorg --enable-xorg --disable-dmx --disable-xvfb --disable-xnest \ --disable-xwin --disable-xprint --disable-xorgcfg --with-mesa-source=/path/to/mesa $ make $ make install $ sudo chown root /opt/xorg/bin/Xorg $ sudo chmod u+s /opt/xorg/bin/Xorg
Compile Driver
There are two classes of drivers input and video. The Xserver needs at least the keyboard and mouse input drivers and the appropriate video driver for your card.
Driver Dependencies
To compile a driver you need the driver development headers from Xserver, these headers are installed as part of the Xserver "make install". However, unless the driver requires a recent Xserver (e.g. because of a change in the Xserver/driver interface), you should be able to satisfy driver dependencies with distribution specific tools, e.g with a variation of:
$ sudo apt-get install xserver-xorg-dev
$ sudo apt-get build-dep xserver-xorg-driver-intel
$ yum install xorg-x11-server-sdk
Driver
- driver/xf86-input-keyboard
- driver/xf86-input-mouse
- driver/xf86-video-intel
$ git-clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-intel $ cd xf86-video-intel $ ./autogen.sh --prefix=/opt/xorg $ make $ make install
The above installs the drivers in "/opt/xorg/lib/xorg/modules/", in the "input" subdirectory for input drivers and in the "drivers" subdirectory for video drivers. If you also compiled the Xserver, then it will use the new drivers automatically. To use the new drivers with an existing Xserver, you must replace the drivers of the existing Xserver with the new ones. Depending on your distribution, these are usually located in "/usr/X11R6/lib/modules/" or "/usr/lib/xorg/modules/" within the "input" and "drivers" subdirectories. ATTENTION: keep a backup of your old drivers before copying the new ones, otherwise you will not be able to start the Xserver if something goes wrong.