summaryrefslogtreecommitdiff
path: root/microkernel/mach/mig/gnu_mig/building.mdwn
blob: e14c8fb00478efdc6c27a0a8594f9b8cde1dff34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
[[!meta copyright="Copyright © 2006, 2007, 2008, 2011, 2013 Free Software
Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

# <a name="Building_the_Mach_Interface_Gene"> Building the Mach Interface Generator from Source </a>

If you want to build the Mach Interface Generator yourself instead of just
using a pre-built package, follow these instructions.

## <a name="Getting_the_Source_Code"> Getting the Source Code </a>

You can chose between getting the [sources from the developers'
RCS](https://git.savannah.gnu.org/git/hurd/):

    $ git clone https://git.savannah.gnu.org/git/hurd/mig.git/

... or (if you are working on a Debian system) get the sources that are used for the
[current Debian mig package](http://packages.debian.net/source/unstable/mig):

    $ apt source mig

The unpacked source tree is around 1 MiB, and the build tree also is around 1 MiB.

## <a name="_on_Debian_systems"> On Debian Systems: </a>

### <a name="Preparing_for_the_Build"> Preparing for the Build </a>

Building MIG requires the *build-essential* and *fakeroot* packages,
and some additional dependencies specified by the mig source package:

    # apt install build-essential fakeroot
    # apt build-dep mig

### <a name="Building_and_Installing"> Building and Installing </a> <a name="_a_deb_file"> ... a _.deb_ file </a>

Change into the directory with the downloaded / unpacked MIG sources:

    $ cd mig-X.X.X.XX

Start the build process:

    $ dpkg-buildpackage -us -uc -b -rfakeroot

Note: if you are building on a non-32bit system, you need to also pass e.g.
`--target-arch=i386` to build the 32bit version.

This will create a _.deb_ package in the parent directory,
which you can then install on your system.

## <a name="_on_non_Debian_systems"> On non-Debian Systems: </a>

### <a name="Preparing_for_the_Build"> Preparing for the Build </a>

Building the Mach Interface Generator requires a C compiler, a standard 32 bit
C library (with corresponding header files), your favourite flavor of awk
(gawk), yacc (bison), lex (flex) and make.

Additionally, you need to have GNU Mach's header files installed.  See
[[building GNU Mach|mach/gnumach/building]] about how to do that, then come back here.

### <a name="Building_and_Installing"> Building and Installing </a>

First, generate the configuration files:

    $ cd mig
    $ autoreconf --install

The Mach Interface Generator has to be built in a separate build directory:

    $ mkdir build
    $ cd build

Find the base directory where you installed GNU Mach's header files and where
you now intend to install the Mach Interface Generator (e.g. _~/gnu_), and run
configure:

    $ GNU=~/gnu
    $ TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU"

If you are building on a 64 bit machine, you need to add a --host option:

    $ GNU=~/gnu
    $ TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU" --host=i686-unknown-linux-gnu 

Build and install the Mach Interface Generator into _$GNU_ (i.e. _~/gnu/_ in our example):

    $ make all install

To make your _mig_ binary easily available, you should append something like
the following to e.g. your _~/.bash\_profile_:

    PATH=~/gnu/bin:$PATH
    export PATH

If you already have e.g. _~/bin_ in your _$PATH_, you could also create a symbolic link:

    $ ln -s ~/gnu/bin/mig ~/bin/