minix/tools/gcc/README.mknative
Lionel Sambuc 84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00

85 lines
3.7 KiB
Text

$NetBSD: README.mknative,v 1.17 2013/11/28 12:08:57 mrg Exp $
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.
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.
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").
Note that while PR #47353 is not fixed, you can not use the -O option
to build.sh. Use -M instead. (The differences are in layout and pathname
prefixes in the object directory pointed to by each option.)
3. In src/tools/gcc, do "nbmake-MACHINE HAVE_GCC=45 bootstrap-libgcc".
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.
Because the files generated in this step contain things like
-DCROSS_COMPILE, they are not suitable for committing. Step 8 below
will regenerate the "proper" libgcc config files.
4. At top level, do
"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)
5. In src/lib/csu, do
"nbmake-MACHINE dependall". and "nbmake-MACHINE install".
6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in
src/external/gpl3/gcc/lib/crtstuff/ do
"nbmake-MACHINE obj dependall install"
7. In src/external/gpl3/gcc/lib/libgcc, do
"nbmake-MACHINE obj includes dependall install".
8. In each of src/external/lgpl3/gmp/lib/libgmp,
src/external/lgpl3/mpfr/lib/libmpfr, src/external/lgpl3/mpc/lib/libmpc
do "nbmake-MACHINE obj dependall".
9. In src/lib, do
"nbmake-MACHINE dependall install MKGCC=no HAVE_GCC=45".
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
the rest for this stage of the build.
MKCRYPTO=no
MKLINT=no
MKPROFILE=no
MKSHARE=no
MKRUMP=no
10. In src/tools/gcc, do "nbmake-MACHINE native-gcc".
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.
11. Try out a full build using "nbmake-MACHINE"; the result should include
a native compiler.
12. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*.