Good news, the gcc-2.95 source package will build cross-compilers
out of the box.
It should be able to build cross-compilers for any debian
architecture as a target, although you may find it difficult to
fulfill the dependencies for every target.
- Install the following packages (additional Build-Depends:) before
continuing:
dpkg-cross
binutils-multiarch
binutils-${target}
binutils-${target} is only in sid, and only for powerpc, m68k,
arm, and avr. If you are building for some other target, you'll
need to find a cross binutils some other way, i.e., by fixing
the binutils package.
- Download (by hand, probably) the binary packages
libc6_*_${target}.deb and libc6-dev_*_${target}.deb.
- dpkg-cross is a cool utility that mangles library and lib-dev
packages to be cross development packages. The install path
is changed (e.g.) from /usr/lib to /usr/${target}-linux/lib,
so you don't affect the native installation. Run the command
dpkg-cross -a ${target} -b libc_*_${target}.deb
dpkg-cross -a ${target} -b libc-dev_*_${target}.deb
This will create libc-${target}-cross_*_all.deb and
libc-dev-${target}-cross_*_all.deb. (Note that they are now
architecture independent.) Look at the packge contents,
in order to marvel at the coolness of dpkg-cross and/or to
verify that it worked:
dpkg-deb -C libc-${target}-cross_*_all.deb
Of course, you can do this for other development packages that
you want to install later.
- Install the cross-libc packages created in the last step. The
gcc build process needs these to build libgcc2 and libg++.
- Create the directory /usr/lib/gcc-lib/${target}-linux/2.95.4.
This is to overcome a buglet in the current build. Fix the version
number if it has changed.
- Edit the file gcc-2.95-*/debian/rules.defs where it defines
TARGETS. Change this to 'TARGETS = ${target}'.
- In order to speed up the build process, disable the regression
tests. Search for 'with_check := disabled by hand' in
gcc-2.95-*/debian/rules.defs and uncomment it.
- In order to speed up the build process, disable building of the
Pascal compiler if you don't need it. Search for 'with_pascal
:= disabled by hand' in gcc-2.95-*/debian/rules.defs and uncomment
it.
The same thing can be done for the CHILL, Fortran and Java compilers.
- Build using 'dpkg-buildpackage -rfakeroot'. This will take a _long_
time, as it builds a bootstrap native compiler first, and also
builds the native packages.
Please send any comments/corrections to this document to
David Schleef <ds@schleef.org>.