How do I compile and package the X Server code?

Peter Hutterer peter.hutterer at
Wed Feb 13 02:14:09 UTC 2019

On Tue, Feb 12, 2019 at 01:19:51PM -0500, Adam Jackson wrote:
> On Tue, 2019-02-12 at 17:22 +0100, Kevin Brace wrote:
> > I am able to compile X Server, although I do not know at this point
> > how to install it to my preferred location (I will like to install it
> > to /opt for testing purposes).
> You will probably also want to override PKG_CONFIG_PATH in the
> environment when building drivers against that server. Refer to the
> pkgconfig documentation for details, but it's probably something like:
> $ export PKG_CONFIG_PATH=/opt/xorg/share/pkgconfig:/opt/xorg/lib64/pkgconfig:$PKG_CONFIG_PATH
> That said... in my experience, one of the pleasant features of using a
> distribution is that you can reinstall packages. If I ever really do
> want to test a new buld of Xorg (the only server where the install path
> really matters) I just clobber the existing one, and when I'm done, dnf
> reinstall xorg-x11-server-*.
> > How do I install it to my preferred location and run the compiled
> > version rather than the existing version?
> If you're invoking the X server by hand, just do:
> # /opt/xorg/bin/Xorg
> Convincing your desktop environment's display manager to invoke that
> one instead of the one in /usr/bin depends on the particular display
> manager. (Not wanting to remember how to do this is part of the reason
> I don't use prefixes...)

ftr, I've been installing into /opt/xorg for years, my gdm solution is:
$ mv /usr/bin/Xorg /usr/bin/Xorg_old
$ ln -s /opt/xorg/bin/Xorg /usr/bin/Xorg 

That works but if you use SELinux it may require relabelling and other

As for the environment, I have this as $HOME/.exportrc.xorg:

export PKG_CONFIG_PATH=/opt/xorg/lib/pkgconfig:/opt/xorg/lib64/pkgconfig:/opt/xorg/share/pkgconfig
export LD_LIBRARY_PATH=/opt/xorg/lib/:/opt/xorg/lib64
export PATH=/opt/xorg/bin:$PATH
export ACLOCAL_PATH="/opt/xorg/share/aclocal"
export ACLOCAL="aclocal -I $ACLOCAL_PATH"
export MANPATH=/opt/xorg/share/man/:/usr/share/man

set up an alias to source that file on command and run it before you
you run autotools/meson. The trickiest bit is remembering when --libdir is
needed and when not :)


More information about the xorg-devel mailing list