~alan-griffiths/mir/knee-jerk-mir_surface_state_automatic

482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
1
Building the source for a PC {#building_source_for_pc}
2
============================
3
835.2.1 by Robert Ancell
Correctly capitalize Mir
4
Getting Mir
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
5
-----------
6
7
Mir is a project on Launchpad (https://launchpad.net/mir). To grab a copy use
8
the command:
9
10
    $ bzr branch lp:mir
11
3220.2.2 by Alexandros Frantzis
doc: Further documentation improvements
12
The command above will download the latest development version of Mir into
13
the 'mir' directory (called the 'project directory' from now on).
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
14
15
Getting dependencies
16
--------------------
17
18
To succesfully build Mir there are a few packages required. The easiest way
19
to get them is to use the packaging build dependencies:
20
737.1.1 by Daniel van Vugt
Minor correction to documentation building_source_for_pc so that the
21
    $ sudo apt-get install devscripts equivs cmake
3220.2.2 by Alexandros Frantzis
doc: Further documentation improvements
22
23
Then, in the project directory:
24
737.1.1 by Daniel van Vugt
Minor correction to documentation building_source_for_pc so that the
25
    $ sudo mk-build-deps --install --tool "apt-get -y" --build-dep debian/control
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
26
27
835.2.1 by Robert Ancell
Correctly capitalize Mir
28
Building Mir
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
29
------------
30
835.2.2 by Robert Ancell
Correctly capitalize CMake
31
Mir is built using CMake. You first need to create the build directory and
3220.2.2 by Alexandros Frantzis
doc: Further documentation improvements
32
configure the build. In the project directory do:
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
33
34
    $ mkdir build
35
    $ cd build
835.2.2 by Robert Ancell
Correctly capitalize CMake
36
    $ cmake .. (possibly passing configuration options to CMake)
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
37
835.2.1 by Robert Ancell
Correctly capitalize Mir
38
There are many configuration options for the Mir project. The default options
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
39
will work fine, but you may want to customize the build depending on your
40
needs. The best way to get an overview and set them is to use the cmake-gui
41
tool:
42
43
    $ cmake-gui ..
44
45
The next step is to build the source and run the tests:
46
47
    $ make (-j8)
48
    $ ctest
49
3207.2.1 by Alan Griffiths
Update section on installing a local build of Mir
50
51
Running Mir
52
-----------
53
3220.2.2 by Alexandros Frantzis
doc: Further documentation improvements
54
The binaries created in the bin subdirectory of the project directory can be
55
used directly. For example,
3207.2.1 by Alan Griffiths
Update section on installing a local build of Mir
56
57
    $ bin/mir_demo_server --launch_client bin/mir_demo_client_multiwin
58
59
Other examples described elsewhere in this documentation assume you're using the
60
installed version and simply need "bin/" adding to specify the local build.  
61
62
63
Install Mir
64
-----------
65
66
*It should not be necessary to install Mir for experimental purposes (see 
67
"Running Mir" above).* Further, if you are using an Ubuntu derived disto then
68
there's likely to be existing Mir binaries elsewhere that may interact badly 
69
with a second install.
70
835.2.1 by Robert Ancell
Correctly capitalize Mir
71
To install Mir just use the normal make install command:
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
72
3207.2.1 by Alan Griffiths
Update section on installing a local build of Mir
73
    $ sudo make install
482.1.1 by Alexandros Frantzis
doc: Add more documentation about getting, building and using mir
74
835.2.1 by Robert Ancell
Correctly capitalize Mir
75
This will install the Mir libraries, executable, example clients and header
3207.2.1 by Alan Griffiths
Update section on installing a local build of Mir
76
files to the configured installation location (/usr/local by default).
77
78
NB You may need "sudo ldconfig" to refresh the cache before the installed
79
programs work.
80
81
If you install to a non-standard location, keep in mind that you will probably 
82
need to properly set the PKG_CONFIG_PATH environment variable to allow other
835.2.1 by Robert Ancell
Correctly capitalize Mir
83
applications to build against Mir, and LD_LIBRARY_PATH to allow applications to
84
find the Mir libraries at runtime.
835.2.3 by Robert Ancell
Add instructions on how to compile Mesa and X.Org with Mir support
85
3207.2.1 by Alan Griffiths
Update section on installing a local build of Mir
86
835.2.3 by Robert Ancell
Add instructions on how to compile Mesa and X.Org with Mir support
87
Building Mesa
88
-------------
89
3220.2.1 by Alexandros Frantzis
doc: Improve to building instructions for PC
90
*The Mesa packages shipped with Ubuntu are already built with the relevant Mir patches
91
and should work out of the box with Mir.*
92
835.2.3 by Robert Ancell
Add instructions on how to compile Mesa and X.Org with Mir support
93
For GL accelerated clients to use Mir they need to use a patched version of Mesa
94
that supports Mir.
95
96
The patch is hosted on GitHub:
97
98
    $ git clone https://github.com/RAOF/mesa.git
99
835.2.6 by Robert Ancell
Mesa needs to build both the mir and drm platform support
100
Compile as per normal instructions and pass --with-egl-platforms="mir,drm" to
101
the configure options. You will need libmirclient installed as shown above.