summaryrefslogtreecommitdiff
path: root/Building.mdwn
diff options
context:
space:
mode:
authorsarah <sarah@web>2015-08-25 14:35:53 -0700
committerdri <iki-dri@freedesktop.org>2015-08-25 14:35:53 -0700
commit6590244a55b5ac246be03ee2e5e133ebc5d89547 (patch)
tree4080512e60c227a245399f676c12c2112e15b9d5 /Building.mdwn
parenta940691d9d95b06884e40068f85f7f355c58a298 (diff)
Add Damien and Ville's directions for installing to a non-default prefix
Diffstat (limited to 'Building.mdwn')
-rw-r--r--Building.mdwn105
1 files changed, 104 insertions, 1 deletions
diff --git a/Building.mdwn b/Building.mdwn
index 5260f50..75f01ed 100644
--- a/Building.mdwn
+++ b/Building.mdwn
@@ -70,4 +70,107 @@ Run as root, to install:
export LIBGL_DRIVERS_PATH=<path to Mesa>/lib
export LD_PRELOAD=<path to Mesa>/lib/libGL.so.1
-To make these settings persistent, you'll have to add them to `.bashrc` or a similar login script.
+To make these settings persistent, you'll have to add them to `.bashrc` or a similar login script.
+
+## Installing to a non-default prefix
+
+Working with "a separate prefix" is working with libraries and binaries (well, anything produced by 'make install' in an autotooled project really) installed in a different directory than the system-wide ones (/usr or even /usr/local that can become quite messy). lt is the preferred way to hack on a full stack, not pollute your base distribution and has several advantages:
+
+* You can hack on the whole stack without the fear of not being able to run your desktop environment you're working with if something goes wrong.
+* More often than not, one needs a relatively recent library that your distribution doesn't ship with (say a recent libdrm). When working with the dependencies in a prefix, it's just a matter of recompiling it.
+
+Let's take an example to make the discussion easier:
+
+* we want to copile libdrm and intel-gpu-tools (because intel-gpu-needs needs a more recent libdrm than the one coming with your distribution).
+* we want to use the ~/gfx directory for our work
+* git trees with be cloned in ~/gfx/sources
+* ~/gfx/install is chosen as the prefix.
+
+First, let's clone the needed git repositories:
+
+ $ mkdir -p ~/gfx/sources ~/gfx/install
+ $ git clone git://anongit.freedesktop.org/mesa/drm ~/gfx/sources/libdrm
+ $ git clone git://anongit.freedesktop.org/xorg/app/intel-gpu-tools ~/gfx/sources/intel-gpu-tools
+
+Then you need to source a script that will set-up your environment with a few variables to tell the system to use the prefix (both at run-time and compile-time). A minimal version of that script for our example is (I store my per-project setup scripts to source at the root of the project, in our case ~/gfx):
+
+ $ cat ~/gfx/setup-env
+ PROJECT=~/gfx
+ export PATH=$PROJECT/install/bin:$PATH
+ export LD_LIBRARY_PATH=$PROJECT/install/lib:$LD_LIBRARY_PATH
+ export PKG_CONFIG_PATH=$PROJECT/install/lib/pkgconfig:$PKG_CONFIG_PATH
+ export ACLOCAL_FLAGS="-I $PROJECT/install/share/aclocal $ACLOCAL_FLAG"
+
+ $ source ~/gfx/setup-env
+
+Then it's time to compile libdrm, telling the <code>configure</code> script that we want to install it in in our prefix:
+
+ $ cd ~/gfx/sources/libdrm
+ $ ./autogen.sh --prefix=/home/damien/gfx/install
+ $ make
+ $ make install
+
+Note that you don't need to run "sudo make install" since we'll be installing in our prefix directory that is writeable by the current user.
+
+Now it's time to compile i-g-t:
+ $ cd ~/gfx/sources/intel-gpu-tools
+ $ ./autogen.sh --prefix=/home/damien/gfx/install
+ $ make
+ $ make install
+
+The configure script may complain about dependencies (eg. cairo, SWIG,...). Different ways to solve those:
+
+* For dependencies not directly linked with the graphics stack (like SWIG), it's recommended to use the development package provided by the distribution
+* For old enough dependencies that don't change very often (like cairo) you can use the distribution development package or compile them in your prefix
+* For dependencies more recent than your distribution ones, you need to install them in the chosen prefix.
+
+### Damien's minimal environment script
+
+ PROJECT=~/gfx
+ export PATH=$PROJECT/install/bin:$PATH
+ export LD_LIBRARY_PATH=$PROJECT/install/lib:$LD_LIBRARY_PATH
+ export PKG_CONFIG_PATH=$PROJECT/install/lib/pkgconfig:$PKG_CONFIG_PATH
+ export ACLOCAL_FLAGS="-I $PROJECT/install/share/aclocal $ACLOCAL_FLAG"
+
+### Ville's environment script
+
+
+ #!/bin/sh
+
+ prepend_env ()
+ {
+ eval ${1}="${2}\${${1}:+:}\$${1}"
+ }
+
+ append_env ()
+ {
+ eval ${1}="\$${1}\${${1}:+:}${2}"
+ }
+
+ PS1="[`basename $PWD`]$PS1"
+ PREFIX=$PWD
+ LINGUAS="en fi"
+
+ prepend_env PATH $PREFIX/bin
+ prepend_env MANPATH $PREFIX/man
+ prepend_env MANPATH $PREFIX/share/man
+ if [ -n "$MANPATH" ]; then
+ MANPATH=$MANPATH:
+ fi
+ prepend_env LD_LIBRARY_PATH $PREFIX/lib
+ prepend_env PKG_CONFIG_PATH $PREFIX/lib/pkgconfig
+ prepend_env PERL5LIB $PREFIX/lib/perl
+ prepend_env PYTHONDIR $PREFIX/lib/python
+ prepend_env GST_PLUGIN_PATH $PREFIX/lib/gstreamer-0.10
+ prepend_env LIBGL_DRIVERS_PATH $PREFIX/lib/dri
+
+ export PREFIX
+ export LINGUAS
+ export PATH
+ export MANPATH
+ export LD_LIBRARY_PATH
+ export PKG_CONFIG_PATH
+ export PERL5LIBDIR
+ export PYTHONDIR
+ export GST_PLUGIN_PATH
+ export LIBGL_DRIVERS_PATH