This mini-howto is based on CRUX 2.2 with nvidia graphics hardware. I don't have any ATI hardware capable of running Xgl so anyone who can get it working is welcome to send me comments and I'll add them to this wiki entry if needed.
That said, the installation process isn't difficult, just time-consuming:
gl-select, nvidia, x11
Details of the X11R7 installation process aren't included here, check InstallingX11R7.
Once installed, you may need to add xorg-libxscrnsaver, xterm, xorg-xdpyinfo, and xorg-xrdb. Likely none of these are required but they will make life easier.
You'll need subversion installed for this step, and to get future updates. Check out the crux-xgl repository via svn using the following command:
svn co https://secure.morpheus.net/svn/crux-xgl
In this repository you'll find nvidia-x11r7 and gl-select-x11r7, which, as their names would indicate, are versions of the nvidia and gl-select ports modified for x11r7. At this point you should be able to set up a working x11r7 config without Xgl, to make sure things are working after the x11 switch.
This step's optional but highly recommended. Use the revdep script to find any packages that need to be rebuilt, or any packages you need to install additional xorg lib ports for, since the upgrade. Once your system's reverse dependency situation is under control, it's easier to install the new Xgl stuff.
In order to have a fully working Xgl setup, you'll need a few things from the gnome repository, as well. :( These are librsvg, gconf-editor (currently the only configuration interface for compiz), and control-center (for gnome-window-decorator - no window decorations without it). Use prt-get depinst librsvg gconf-editor control-center to get those and their dependencies installed.
From the crux-xgl repository, install in this order: glitz, cairo, libsvg, libsvg-cairo.
Once that's done, rebuild pango and gtk against the new libraries previously installed.
Once those are installed, all that remains is to build the xgl and compiz ports. Please note that you'll have to force the installation of xgl, it overwrites some files owned by xorg-server. Also, compiz has a post-install script that needs to be run for its configuration interface to work correctly.
At this point all the necessary items are installed. There's a script included with the ports called startxgl (installed into /usr/bin) that will start up a default-ish gnome session with compiz and Xgl. It expects the DISPLAY number as an argument, '0' is a good place to start if you're not already running an X session. Despite its professed ability to run on other X displays, I recommend not running Xgl in conjunction with an already running X. To use startxgl, simply invoke it with the display number, like so:
startxgl 0
If you don't have the rest of the gnome tree installed, modify startxgl to your needs or create your own. A small setup without gnome might look like this:
Xgl :0 -ac -accel xv -accel glx:pbuffer & sleep 3 DISPLAY=:0 LD_PRELOAD=/usr/lib/compiz/libGL.so.1.mesa compiz --replace gconf & sleep 3 DISPLAY=:0 gnome-window-decorator &
That's all, really. Enjoy! :)
References:
http://www.novell.com/linux/xglrelease/ http://www.freedesktop.org/wiki/Software/Xgl http://en.wikipedia.org/wiki/Xgl http://en.opensuse.org/Xgl http://gentoo-wiki.com/HOWTO_XGL
Some gratuitous screenshots (thumbnails):
For the full-size images, see the gallery.



