Home | History | Annotate | Line # | Download | only in gcc
README.mknative revision 1.9.8.2
      1  1.9.8.2     tls $NetBSD: README.mknative,v 1.9.8.2 2013/02/25 00:30:30 tls Exp $
      2      1.1     mrg 
      3      1.2   skrll This file describes how to bootstrap the native toolchain on a new NetBSD
      4      1.2   skrll platform (and how to update the new toolchain files, if needed).  These
      5      1.2   skrll files may be generated on a cross-compile host without problems.
      6      1.1     mrg 
      7      1.2   skrll NOTE:  DO NOT RUN "mknative" BY HAND!  It requires the Makefile in this
      8      1.2   skrll directory to set up certain environments first.
      9      1.2   skrll 
     10      1.2   skrll Since libc's features change over time, the config.h files can change as a
     11      1.2   skrll result; thus the instructions below are the same no matter whether
     12      1.2   skrll bootstrapping on a cross or native host.  This is important: even on a
     13      1.2   skrll "native" host, you should bootstrap the toolchain by building from an
     14      1.2   skrll up-to-date source tree to a $DESTDIR using the exact same instructions.
     15      1.2   skrll 
     16      1.2   skrll In these notes, MACHINE is the $MACHINE of the target.  These files can be
     17      1.2   skrll cross-generated.  Though a $MACHINE_ARCH all uses the same config files, you
     18      1.2   skrll must pick a specific $MACHINE so that building the requisite bits below will
     19      1.2   skrll work.
     20      1.2   skrll 
     21      1.2   skrll 1. Set MKMAINTAINERTOOLS=yes in mk.conf.  (Needed so that src/tools/gettext
     22      1.2   skrll    gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
     23      1.2   skrll 
     24      1.2   skrll 2. Build and install a cross toolchain (via "build.sh -m MACHINE tools").
     25  1.9.8.2     tls    Note that while PR #47353 is not fixed, you can not use the -O option
     26  1.9.8.2     tls    to build.sh. Use -M instead. (The difference is only a minor layout/
     27  1.9.8.2     tls    pathname prefixe in the object directory pointed to bei either option.)
     28      1.2   skrll 
     29      1.2   skrll 3. In src/tools/gcc, do "nbmake-MACHINE bootstrap-libgcc".
     30      1.2   skrll 
     31  1.9.8.1     tls    This will create just enough glue in src/external/gpl3/gcc/lib/libgcc/arch
     32  1.9.8.1     tls    to make it possible to build, based on the toolchain built in
     33  1.9.8.1     tls    ${.OBJDIR}/build.
     34      1.2   skrll    Because the files generated in this step contain things like
     35      1.4  martin    -DCROSS_COMPILE, they are not suitable for committing.  Step 8 below
     36      1.2   skrll    will regenerate the "proper" libgcc config files.
     37      1.2   skrll 
     38      1.2   skrll 4. At top level, do
     39  1.9.8.2     tls    "nbmake-MACHINE obj do-distrib-dirs MKGCC=no MKBINUTILS=no HAVE_GCC=45", and
     40  1.9.8.2     tls    "nbmake-MACHINE includes HAVE_GCC= MKGCC=no MKBINUTILS=no HAVE_GCC=45".
     41  1.9.8.2     tls    (Note: replace 45 [for gcc 4.5.x] with the appropriate version you are
     42  1.9.8.2     tls    going to mknative-for, the MKGCC=no prevents the standard makefiles from
     43  1.9.8.2     tls    picking up any gcc version info automatically)
     44  1.9.8.1     tls 
     45  1.9.8.1     tls 5. In src/lib/csu, do
     46  1.9.8.1     tls    "nbmake-MACHINE dependall". and "nbmake-MACHINE install".
     47  1.9.8.1     tls 
     48  1.9.8.1     tls 6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in
     49  1.9.8.1     tls    src/external/gpl3/gcc/lib/crtstuff/ do
     50  1.9.8.1     tls    "nbmake-MACHINE obj dependall install"
     51  1.9.8.1     tls 
     52  1.9.8.1     tls 7. In src/external/gpl3/gcc/lib/libgcc, do
     53  1.9.8.1     tls    "nbmake-MACHINE obj includes dependall install".
     54      1.2   skrll 
     55  1.9.8.1     tls 8. In each of src/external/lgpl3/gmp/lib/libgmp,
     56  1.9.8.1     tls    src/external/lgpl3/mpfr/lib/libmpfr, src/external/lgpl2/mpc/lib/libmpc
     57  1.9.8.1     tls    do "nbmake-MACHINE obj includes LIBISPRIVATE=no", and
     58  1.9.8.1     tls    "nbmake-MACHINE dependall install".
     59      1.2   skrll 
     60  1.9.8.1     tls    It is important to have LIBISPRIVATE=no while doing includes as this
     61  1.9.8.1     tls    installs a header file that is not part of standard build.
     62      1.4  martin 
     63  1.9.8.1     tls 9. In src/lib, do
     64  1.9.8.2     tls    "nbmake-MACHINE dependall install MKGCC=no HAVE_GCC=45".
     65      1.2   skrll 
     66      1.2   skrll    Optionally, all of the following may be set in the environment to reduce
     67      1.2   skrll    the amount of code needed to build at this step.  Basically, it must be
     68      1.2   skrll    possible for static binaries to build and base system libs to exist so
     69      1.2   skrll    that "configure" can do its job for the target--these MK* options omit
     70  1.9.8.1     tls    the rest for this stage of the build. 
     71      1.2   skrll 
     72      1.2   skrll    MKCRYPTO=no
     73      1.2   skrll    MKLINT=no
     74      1.2   skrll    MKPROFILE=no
     75      1.2   skrll    MKSHARE=no
     76  1.9.8.2     tls    MKRUMP=no
     77      1.2   skrll 
     78  1.9.8.1     tls 10. In src/tools/gcc, do "nbmake-MACHINE native-gcc".
     79      1.2   skrll 
     80      1.2   skrll    This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
     81      1.2   skrll    cross toolchain (--build reflects the host platform, but --host and
     82      1.2   skrll    --target are the target).  The result is a tree that would build a
     83      1.2   skrll    native-to-NetBSD compiler on a cross host, and mknative pulls glue data
     84      1.2   skrll    from this.
     85      1.2   skrll 
     86  1.9.8.1     tls 11. Try out a full build using "nbmake-MACHINE"; the result should include
     87      1.2   skrll    a native compiler.
     88      1.2   skrll 
     89  1.9.8.1     tls 12. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*.
     90