2014-04-22 17:20:58 +04:00
|
|
|
$NetBSD: README.mknative,v 1.19 2014/04/22 13:20:58 joerg Exp $
|
2003-07-27 19:00:52 +04:00
|
|
|
|
2004-02-12 21:57:08 +03:00
|
|
|
This file describes how to bootstrap the native toolchain on a new NetBSD
|
|
|
|
platform (and how to update the new toolchain files, if needed). These
|
|
|
|
files may be generated on a cross-compile host without problems.
|
2003-07-27 19:00:52 +04:00
|
|
|
|
2004-02-12 21:57:08 +03:00
|
|
|
NOTE: DO NOT RUN "mknative" BY HAND! It requires the Makefile in this
|
|
|
|
directory to set up certain environments first.
|
|
|
|
|
|
|
|
Since libc's features change over time, the config.h files can change as a
|
|
|
|
result; thus the instructions below are the same no matter whether
|
|
|
|
bootstrapping on a cross or native host. This is important: even on a
|
|
|
|
"native" host, you should bootstrap the toolchain by building from an
|
|
|
|
up-to-date source tree to a $DESTDIR using the exact same instructions.
|
|
|
|
|
|
|
|
In these notes, MACHINE is the $MACHINE of the target. These files can be
|
|
|
|
cross-generated. Though a $MACHINE_ARCH all uses the same config files, you
|
|
|
|
must pick a specific $MACHINE so that building the requisite bits below will
|
|
|
|
work.
|
|
|
|
|
2014-02-26 13:54:32 +04:00
|
|
|
0. Note that example paths like src/external/gpl3/gcc/lib/libgcc/arch will
|
|
|
|
really be src/external/gpl3/gcc.old/lib/libgcc/arch for the previous GCC.
|
|
|
|
|
2004-02-12 21:57:08 +03:00
|
|
|
1. Set MKMAINTAINERTOOLS=yes in mk.conf. (Needed so that src/tools/gettext
|
|
|
|
gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
|
|
|
|
|
|
|
|
2. Build and install a cross toolchain (via "build.sh -m MACHINE tools").
|
2012-12-26 23:11:27 +04:00
|
|
|
Note that while PR #47353 is not fixed, you can not use the -O option
|
2013-10-21 13:02:08 +04:00
|
|
|
to build.sh. Use -M instead. (The differences are in layout and pathname
|
|
|
|
prefixes in the object directory pointed to by each option.)
|
2004-02-12 21:57:08 +03:00
|
|
|
|
2013-04-18 09:20:00 +04:00
|
|
|
3. In src/tools/gcc, do "nbmake-MACHINE HAVE_GCC=45 bootstrap-libgcc".
|
2004-02-12 21:57:08 +03:00
|
|
|
|
2012-09-16 19:09:55 +04:00
|
|
|
This will create just enough glue in src/external/gpl3/gcc/lib/libgcc/arch
|
|
|
|
to make it possible to build, based on the toolchain built in
|
|
|
|
${.OBJDIR}/build.
|
2004-02-12 21:57:08 +03:00
|
|
|
Because the files generated in this step contain things like
|
2005-10-30 00:43:35 +04:00
|
|
|
-DCROSS_COMPILE, they are not suitable for committing. Step 8 below
|
2004-02-12 21:57:08 +03:00
|
|
|
will regenerate the "proper" libgcc config files.
|
|
|
|
|
|
|
|
4. At top level, do
|
2012-12-26 23:11:27 +04:00
|
|
|
"nbmake-MACHINE obj do-distrib-dirs MKGCC=no MKBINUTILS=no HAVE_GCC=45", and
|
|
|
|
"nbmake-MACHINE includes HAVE_GCC= MKGCC=no MKBINUTILS=no HAVE_GCC=45".
|
|
|
|
(Note: replace 45 [for gcc 4.5.x] with the appropriate version you are
|
|
|
|
going to mknative-for, the MKGCC=no prevents the standard makefiles from
|
|
|
|
picking up any gcc version info automatically)
|
2004-02-12 21:57:08 +03:00
|
|
|
|
2012-09-27 15:29:49 +04:00
|
|
|
5. In src/lib/csu, do
|
|
|
|
"nbmake-MACHINE dependall". and "nbmake-MACHINE install".
|
2012-09-16 19:09:55 +04:00
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
6. In src/external/gpl3/gcc/lib/libgcc, do
|
2012-09-25 10:55:10 +04:00
|
|
|
"nbmake-MACHINE obj includes dependall install".
|
2005-10-30 00:43:35 +04:00
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
7. In each of src/external/lgpl3/gmp/lib/libgmp,
|
2013-11-28 16:08:56 +04:00
|
|
|
src/external/lgpl3/mpfr/lib/libmpfr, src/external/lgpl3/mpc/lib/libmpc
|
2013-04-18 09:20:00 +04:00
|
|
|
do "nbmake-MACHINE obj dependall".
|
2012-09-25 10:55:10 +04:00
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
8. In src/lib, do
|
2012-12-26 23:11:27 +04:00
|
|
|
"nbmake-MACHINE dependall install MKGCC=no HAVE_GCC=45".
|
2004-02-12 21:57:08 +03:00
|
|
|
|
|
|
|
Optionally, all of the following may be set in the environment to reduce
|
|
|
|
the amount of code needed to build at this step. Basically, it must be
|
|
|
|
possible for static binaries to build and base system libs to exist so
|
|
|
|
that "configure" can do its job for the target--these MK* options omit
|
2012-09-25 10:55:10 +04:00
|
|
|
the rest for this stage of the build.
|
2004-02-12 21:57:08 +03:00
|
|
|
|
|
|
|
MKCRYPTO=no
|
|
|
|
MKLINT=no
|
|
|
|
MKPROFILE=no
|
|
|
|
MKSHARE=no
|
2012-12-26 23:11:27 +04:00
|
|
|
MKRUMP=no
|
2004-02-12 21:57:08 +03:00
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
9. In src/tools/gcc, do "nbmake-MACHINE native-gcc".
|
2004-02-12 21:57:08 +03:00
|
|
|
|
|
|
|
This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
|
|
|
|
cross toolchain (--build reflects the host platform, but --host and
|
|
|
|
--target are the target). The result is a tree that would build a
|
|
|
|
native-to-NetBSD compiler on a cross host, and mknative pulls glue data
|
|
|
|
from this.
|
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
10. Try out a full build using "nbmake-MACHINE"; the result should include
|
2004-02-12 21:57:08 +03:00
|
|
|
a native compiler.
|
|
|
|
|
2014-04-22 17:20:58 +04:00
|
|
|
11. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*.
|