X11, from the reference implementation to Xorg 6.9, uses its own "imake" build system. The clients, server, and libraries are in one build tree. (It is very difficult to build only one part of the tree; the entire tree must be built.) Some things, like Mesa and Freetype, are hacked to optionally be part of the tree.
Xorg 7.0 replaces this with a set of modules based around GNU autoconf build system. This creates a complex system of packages and dependencies. Problems with implementing two systems for the simultaneous Xorg 6.9rc1 and Xorg 7.0rc1 delayed release candidate 1.
In order to build Xorg with imake, you first need to download and extract the source tarball. The tarball for Xorg 6.9rc1 was called xorg-x11-126.96.36.1991.tar.bz2 and is available from here. Now that the final versions of Xorg 6.9 and 7.0 are available, you can find them using the list of mirrors here.
A rough outline of the build system:
- Create a "host.def" file (which is optional).
- Do "make World" to configure and build the tree.
- Do "make install" and "make install.man" to install everything.
You can use the "host.def" file to customize your build. If you do not create one, then you use the default settings, which should already be tuned to your operating system.
The file xc/BUILD describes the build in more detail.
Yes, you must build the entire tree to build one part. The exception is that sometimes you can do a server-only or server-less build. See our section on #Building a static server and xc/config/cf/xorgsite.def.
In the following example, root has given us the write access to /usr/local/src. We downloaded Xorg 6.9 release candidate 1 (/usr/local/src/xorg-x11-188.8.131.521.tar.bz2).
We already have Xorg 6.8.2 installed. We are running it during the build, so we have multiple xterms to type shell commands in.
Using an "xterm", extract the source to /usr/local/src, creating /usr/local/src/xc:
$ cd /usr/local/src $ bzcat xorg-x11-184.108.40.2061.tar.bz2 | pax -rv
As xc/BUILD explains, we can use lndir to create a shadow tree of symbolic links to the source. (This prevents objects from appearing in the source tree.) Because "lndir" is part of X, and we have Xorg 6.8.2 already, we can run "lndir":
$ mkdir xcbuild $ cd xcbuild $ lndir ../xc
Note that the current directory is /usr/local/src/xcbuild now. We will skip creating the config/cf/host.def and use the default configuration. It is now time to call the Makefile. We must run make World because there is no other correct way to configure and start the build. If we run Bourne shell:
$ make World > World.log 2>&1
||If we run C shell, then the above command is make World >& World.log.|
The "xterm" running "make" is now busy. To watch the log, we run "tail" in a second xterm:
$ cd /usr/local/src/xcbuild $ tail -f World.log
Eventually, the log announces that the build of Xorg is complete.
||If we need to restart the build (for example, after an error) then we do not want to clean the tree. A make World configures the tree, cleans the tree, and starts the build. We can restart a build with make Everything or make; see xc/BUILD for details.|
We install (to the default /usr/X11R6, thus overwriting most of Xorg 6.8.2):
$ sudo make install $ sudo make install.man
- If we do not have "sudo" working on our system, then we would use "su".
- One can exit from X11 before doing the install. The other option is to overwrite most of X11 while it is running. This can work, but is slightly less safe.
If necessary, exit from X and run xorgcfg to make a config file.
Building a static serverEdit
One can hack the tree to build only a static X server. This is useful if you need better hardware support from an X server in the newer version of a tree. Also, this skips over building the libraries, clients, and separate server modules. (X11 protocol is very stable, so newer servers work with older libraries and clients.)
OpenBSD provides an example host.def for that. Their example host.def is the basis of the next scenario. If you have some reason to static-build an X server, you would do something similar to the next scenario.
Scenario: We have installed Xorg 6.8.2. We need the better "ati" driver in Xorg 6.9rc0 (release candidate 0), but we need to skip most of the 6.9rc0 tree to avoid errors.
Solution: We will static-build a 6.9rc0 server.
||If you have a shadow tree made with "lndir", create files like "host.def" and "X11Conf.h" in the shadow tree, not the source tree.|
Create this file at config/cf/host.def in the tree. If you have a shadow tree, put it in the shadow tree. The file is:
#define InstallEmptyHostDef #define BuildServersOnly YES /* * you may also restrict the drivers that are built by editing and * uncommenting the line below */ #define XF86CardDrivers wsfb ati #define UsbMouseSupport NO #define DoLoadableServer NO #define XnestServer NO #define XVirtualFramebufferServer NO #define XprtServer NO #define BuildGlxExt NO #define BuildGLXLibrary NO #define BuildGLULibrary NO #define BuildRenderLibrary NO #define BuildLBX NO #define BuildType1 NO #define BuildFreeType NO #define BuildXTrueType NO #define BuildSpeedo NO #define BuildFonts NO #define BuildXFree86ConfigTools NO
The "XF86CardDrivers" line is changed to specify only "wsfb" and "ati". Our driver is "ati". We have a second driver which avoids advanced hardware features, in case "ati" fails us. The "wsfb" driver on OpenBSD uses the kernel framebuffer instead of reconfiguring the hardware. At Linux, the framebuffer driver is "fbdev". On i386 hardware, "vga" and "vesa" might be good choices. Use one of the following lines:
#define XF86CardDrivers wsfb ati #define XF86CardDrivers fbdev ati #define XF86CardDrivers vga ati #define XF86CardDrivers vesa ati
Now start the build:
$ make World > World.log 2>&1
The build eventually stops with an error because some "XlibConf.h" is missing; our host.def is skipping that step. (This is a bug; Xorg 6.8.2 did not need an "XlibConf.h" file.) That file probably would have been generated by building libX11, which we skipped. For the server, we actually do not need it. Create an empty file at xc/lib/X11/XlibConf.h:
$ touch lib/X11/XlibConf.h
Now resume the build:
$ make Everything >> World.log 2>&1
Eventually the build finishes. The server appears at xc/programs/Xserver/Xorg. Because this file is statically linked, it is the only file to install. We install at /usr/X11R6/bin/Xorg69 to complement our Xorg 6.8.2 installation at /usr/X11R6:
$ cp -p programs/Xserver/Xorg /usr/X11R6/bin/Xorg69
Now we need to test the server. First, if we are running X now, exit from X to the console. Then make our new server setuid root so it can use video hardware:
$ cd /usr/X11R6/bin $ chown root:wheel Xorg69 $ chmod a+xs Xorg69
Generate the new config file with Xorg69 -configure, then test it with xinit -- /usr/X11R6/bin/Xorg69. If it works, make Xorg69 the default server by changing the /usr/X11R6/bin/X symbolic link:
$ cd /usr/X11R6/bin $ rm X $ ln -s Xorg69 X
We might want to chmod a-x /usr/X11R6/bin/Xorg to prevent anyone from using the old "Xorg" with the new config file that relies on a "Xorg69" driver.