docs/2 - Installing crosstool-NG.txt
author Bryan Hundven <bryanhundven@gmail.com>
Sun Jun 26 03:26:54 2011 -0700 (2011-06-26)
changeset 2515 364b06df9e3a
child 2563 e17f35b05539
permissions -rw-r--r--
glibc: Refactor startfiles/headers into do_libc_backend()

Refactor the contents of 'do_libc_start_files()' and 'do_libc()' into a
parameterized 'do_libc_backend()'. 'do_libc_start_files()' and 'do_libc()'
call 'do_libc_backend()' with either 'libc_mode=startfiles' or
'libc_mode=final' (respectively) so that the startfiles/headers and
the final libc builds are configured and built with the same options.

One example of where this is needed is when building a mips toolchain.
Previously, if you were building an n32 toolchain, you wouldn't have
noticed an issue, because if '-mabi' is not in CFLAGS, n32 is the
default:

http://sourceware.org/git/?p=glibc-ports.git;a=blob;f=sysdeps/mips/preconfigure;hb=HEAD

But when trying to build an o32 or n64 toolchain the build would
have failed. This is because (e)glibc expects "-mabi={o32,n32,n64}" to be
in CFLAGS, but was not previously provided in 'do_libc_start_files()'.
The build failure would happen in the shared-core gcc when it tries to
configure an n64 or o32 gcc with an n32 libc.

A simpler solution would have been to just add TARGET_CFLAGS to configure
in 'do_libc_start_files()', but this way makes configure and make
consistent for both steps.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
yann@2076
     1
File.........: 2 - Installing crosstool-NG.txt
yann@2076
     2
Copyrigth....: (C) 2010 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
yann@2076
     3
License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5
yann@2076
     4
yann@2076
     5
yann@2076
     6
Installing crosstool-NG  /
yann@2076
     7
________________________/
yann@2076
     8
yann@2076
     9
yann@2076
    10
There are two ways you can use crosstool-NG:
yann@2076
    11
 - build and install it, then get rid of the sources like you'd do for most
yann@2076
    12
   programs,
yann@2076
    13
 - or only build it and run from the source directory.
yann@2076
    14
yann@2076
    15
The former should be used if you got crosstool-NG from a packaged tarball, see
yann@2076
    16
"Install method", below, while the latter is most useful for developpers that
yann@2076
    17
use a clone of the repository, and want to submit patches, see "The Hacker's
yann@2076
    18
way", below.
yann@2076
    19
yann@2076
    20
yann@2076
    21
Install method |
yann@2076
    22
---------------+
yann@2076
    23
yann@2076
    24
If you go for the install, then you just follow the classical, but yet easy
yann@2076
    25
./configure way:
yann@2076
    26
  ./configure --prefix=/some/place
yann@2076
    27
  make
yann@2076
    28
  make install
yann@2076
    29
  export PATH="${PATH}:/some/place/bin"
yann@2076
    30
yann@2076
    31
You can then get rid of crosstool-NG source. Next create a directory to serve
yann@2076
    32
as a working place, cd in there and run:
yann@2076
    33
  ct-ng help
yann@2076
    34
yann@2076
    35
See below for complete usage.
yann@2076
    36
yann@2076
    37
yann@2076
    38
The Hacker's way |
yann@2076
    39
-----------------+
yann@2076
    40
yann@2076
    41
If you go the hacker's way, then the usage is a bit different, although very
yann@2076
    42
simple:
yann@2076
    43
  ./configure --local
yann@2076
    44
  make
yann@2076
    45
yann@2076
    46
Now, *do not* remove crosstool-NG sources. They are needed to run crosstool-NG!
yann@2076
    47
Stay in the directory holding the sources, and run:
yann@2076
    48
  ./ct-ng help
yann@2076
    49
yann@2076
    50
See below for complete usage.
yann@2076
    51
yann@2076
    52
Now, provided you used a clone of the repository, you can send me your changes.
yann@2076
    53
See the section titled CONTRIBUTING, below, for how to submit changees.
yann@2076
    54
yann@2076
    55
yann@2076
    56
Preparing for packaging |
yann@2076
    57
------------------------+
yann@2076
    58
yann@2076
    59
If you plan on packaging crosstool-NG, you surely don't want to install it
yann@2076
    60
in your root file system. The install procedure of crosstool-NG honors the
yann@2076
    61
DESTDIR variable:
yann@2076
    62
yann@2076
    63
  ./configure --prefix=/usr
yann@2076
    64
  make
yann@2076
    65
  make DESTDIR=/packaging/place install
yann@2076
    66
yann@2076
    67
yann@2076
    68
Shell completion |
yann@2076
    69
-----------------+
yann@2076
    70
yann@2076
    71
crosstool-NG comes with a shell script fragment that defines bash-compatible
yann@2076
    72
completion. That shell fragment is currently not installed automatically, but
yann@2076
    73
this is planned.
yann@2076
    74
yann@2076
    75
To install the shell script fragment, you have two options:
yann@2076
    76
 - install system-wide, most probably by copying ct-ng.comp into
yann@2076
    77
   /etc/bash_completion.d/
yann@2076
    78
 - install for a single user, by copying ct-ng.comp into ${HOME}/ and
yann@2076
    79
   sourcing this file from your ${HOME}/.bashrc
yann@2076
    80
yann@2076
    81
yann@2076
    82
Contributed code |
yann@2076
    83
-----------------+
yann@2076
    84
yann@2076
    85
Some people contibuted code that couldn't get merged for various reasons. This
yann@2076
    86
code is available as lzma-compressed patches, in the contrib/ sub-directory.
yann@2076
    87
These patches are to be applied to the source of crosstool-NG, prior to
yann@2076
    88
installing, using something like the following:
yann@2076
    89
  lzcat contrib/foobar.patch.lzma |patch -p1
yann@2076
    90
yann@2076
    91
There is no guarantee that a particuliar contribution applies to the current
yann@2076
    92
version of crosstool-ng, or that it will work at all. Use contributions at
yann@2076
    93
your own risk.