# Building modular X.org with ''jhbuild'' ## Introduction This page provides brief instructions on using _[[jhbuild|http://live.gnome.org/Jhbuild]]_, a Python-based build tool, to build modular X.Org. jhbuild was written to build GNOME from source, but has been adapted to many other projects. ## Prerequisites * Ubuntu 9.10: * jhbuild: `sudo apt-get install git-core gnome-common libglib2.0-dev docbook-xsl subversion automake1.4 automake1.7 automake1.9 automake1.10 guile-1.8 waf` * Xorg: `sudo apt-get install groff zlib1g-dev libfreetype6-dev libxml2-dev docbook gperf flex bison libssl-dev` * Debian 5.0 (lenny): * jhbuild: `sudo apt-get install git-core gnome-common gnome-doc-utils make automake1.4 automake1.7 automake1.9 docbook-xsl cvs subversion guile-1.8` * Xorg: `sudo apt-get install groff zlib1g-devlib freetype6-dev g++ bison flex` ... * Fedora 12: * jhbuild: `sudo yum install @gnome-devel @development-tools gnome-common glib2-devel gnome-doc-utils docbook-style-xsl waf` * Xorg: `sudo yum install zlib-devel freetype-devel libxml2-devel expat-devel gperf libgcrypt-devel` * Cygwin: * jhbuild: Devel/git, GNOME/gnome-common, Devel/subversion * Xorg: X11/libfreetype-devel, Devel/gperf ... * FreeBSD 8.0: * jhbuild: ports `devel/git`, `devel/gnome-common`, `devel/autoconf262`, `devel/automake14`, `devel/automake17`, `devel/automake18`, `devel/automake19`, `devel/automake110`, `devel/glib20`, `devel/subversion` (don't use Apache 2.0 APR!), `textproc/gnome-doc-utils` (select all options for docbook-1.4!), `textproc/intltool`, `lang/guile` * Xorg: ports `print/freetype2` ... ## Building jhbuild [[!format txt """ git clone git://git.gnome.org/jhbuild cd jhbuild ./autogen.sh make make install cp sample.jhbuildrc ~/.jhbuildrc """]] (On FreeBSD, do `gmake && gmake install` .) * Note: You may get an error message `msgfmt isn't installed` - it's in the GNU gettext package * Note: You may get a message saying you need to run `make -f Makefile.plain install` - All this omits is building the documentation, which is also at [[http://library.gnome.org/devel/jhbuild/|http://library.gnome.org/devel/jhbuild/]] The `jhbuild` executable is installed to ~/.local/bin/jhbuild. You will need to either symlink to it, use the full path or add it to your `$PATH`. ## Module Set and jhbuild Config File The [[moduleset|http://cgit.freedesktop.org/xorg/util/modular/tree/xorg.modules]] for jhbuilding xorg and [[an example jhbuildrc|http://cgit.freedesktop.org/xorg/util/modular/tree/jhbuildrc]] are stored in git in the xorg/util/modular repository. ## Building the Server, and Everything It Depends On To build everything, you can do: [[!format txt """ mkdir -p $HOME/xorg/util git clone git://anongit.freedesktop.org/git/xorg/util/modular/ $HOME/xorg/util/modular jhbuild -f $HOME/xorg/util/modular/jhbuildrc """]] But often you would just want to build the X server and key drivers to enable support of your latest shiny hardware, without replacing all of your X libraries and utilities. In this case, you can build specific targets rather than everything. You will need a minimal number of drivers as well as the server; rather than executing separate jhbuild commands, you can issue a single one listing all the targets you want to build. The input drivers for PS/2 keyboards and mice are: _xf86-input-keyboard _and_ xf86-input-mouse_. To build the server and dependencies, along with these drivers, you would type: [[!format txt """ jhbuild -f $HOME/xorg/util/modular/jhbuildrc build xserver xf86-video-intel xf86-input-keyboard xf86-input-mouse """]] Other interesting targets include _xorg-drivers_ which builds all maintained X.org drivers. Note: rather than building the target xorg-fonts, which will build you an entire additional set of fonts, you may want to make a link in your _$prefix_ area to link to your existing fonts. Unless you have built your X server with `--enable-builtin-fonts `it will need to access some fonts to start, even though few applications need legacy bitmap fonts anymore. [[!format txt """ cd $prefix/lib/X11; ln -s /usr/share/fonts/X11 fonts """]] Other drivers you may need include the synaptics driver and/or wacom drivers, currently maintained elsewhere (fixme...). ## DRM and Kernel Modules The X server is finally using a device driver on many systems (e.g. Linux, BSD); this is called DRM. It consists of two parts, the generic DRM module and a driver specific to your hardware. Currently, the kernel modules are not built automatically by jhbuild; you can find them in _drm/linux-core_ or _drm/bsd-core_. To build the drm driver, [[!format txt """ make -C linux-core """]] You may want to install these where you will be able to use them from your _/etc/modules_ file. ## Building Other Modules Other buildable modules include the applications (e.g. `xbiff`) and the libraries (e.g. `libXfixes`), plus there a couple of meta modules; `xorg-libs` will build all libs and `xorg-apps` will build all apps. ## Running The Results Now that your development environment is set up, you can try running it (as root). [[!format txt """ rmmod i915 # assuming you're using Intel rmmod drm insmod /linux-core/drm.ko insmod /linux-core/i915.ko export LD_LIBRARY_PATH=$prefix/lib startx -- $prefix/bin/Xorg -verbose # make sure you have a ~/.xinitrc with what you want to run """]] And there you have it, a fresh stack ready for tracking & doing upstream development. Enjoy! This page and the modules file for the build were originally written by Kristian Høgsberg, and modified by [[EricAnholt|EricAnholt]]. Wikified by [[JimGettys|JimGettys]]. ## Hiccups * Some drivers don't or shouldn't build (_e.g._ [[geode on 64-bit|https://bugs.freedesktop.org/show_bug.cgi?id=26341]], [[impact not on MIPS|https://bugs.freedesktop.org/show_bug.cgi?id=26342]], [[sunbw2|https://bugs.freedesktop.org/show_bug.cgi?id=26343]]). Abandon module, file bug if you can work out what's wrong. * There's no facility in jhbuild to mark these modules as only appropriate to some targets, so to permanently avoid building these modules, add the module to the **skip** configuration variable in your jhbuildrc configuration file. e.g. skip = [ 'xf86-video-impact', 'xf86-video-sunbw2' ] * nouveau won't build unless you already have libdrm_nouveau built. One way to do so is setting temporarily autogenargs = '--enable-nouveau-experimental-api' in jhbuildrc, and use the `buildone libdrm` jhbuild command.