$NetBSD: README.mknative,v 1.23 2019/09/30 08:40:20 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. 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. 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=8 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=8", and "nbmake-MACHINE includes HAVE_GCC= MKGCC=no MKBINUTILS=no HAVE_GCC=8". (Note: replace 8 [for GCC 8.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. In src/external/gpl3/gcc/lib/libgcc, do "nbmake-MACHINE obj includes dependall install". 7. 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". 8. In src/lib, do "nbmake-MACHINE dependall install MKGCC=no HAVE_GCC=8". 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. MKLINT=no MKPROFILE=no MKSHARE=no MKRUMP=no 9. 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. 10. Try out a full build using "nbmake-MACHINE"; the result should include a native compiler. 11. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*. 90f19c3e4ece1a2087b4978c8'>Remove documentation for -h as well.joerg 2007-03-08Nuke -X option for pkg_create. Filtering the PLIST thrown at tar is notjoerg 2007-03-02Links to pkgsrc(7) instead of packages(7). Bump date.wiz 2004-04-23s/the the/the/ (only in sources that aren't regularly imported fromsimonb 2003-09-08Sort options; use Fl x instead of Ar -x; use Pq/Sq.wiz 2003-09-08Bump date for previous.wiz 2003-09-02Merge src/usr.sbin/pkg_install on the pkgviews branch into the HEAD byjlam 2003-06-26Quote % characters in macro lines.wiz 2003-01-10Introduce the notion of "preserving" an installed package.agc 2002-09-26Ispell. Begin new sentences on a new line.wiz 2002-09-24Sprinkle .Xrs to packages(7).uebayasi 2002-03-05Add a new packing list directive, @blddep, which notes the exactagc 2002-02-02Drop superfluous .Pp.wiz 2001-06-05Uppercase Dt argument.wiz 2001-05-21Add -I argument to pkg_create so that the real prefix can be specifiedagc 2001-05-18Add -U argument to pkg_create - by default, all files are added to theagc 2001-04-09Whitespace fixes.wiz 2001-03-05Add -V option to all pkgtools, which reports the version of the pkgtools.wiz 2001-01-07Alphabetize options.hubertf 2000-07-05remove extra period in SEE ALL sectionmsaitoh 2000-03-13Fix doubled 'the's.soren 2000-01-19FTP wildcard depends code, initial commit.hubertf 1999-12-20Put back former -s switch to pkg_create as -L now.hubertf 1999-11-29Put support for @src back in.hubertf 1999-11-29Add code to include the size of a package into both thehubertf 1999-07-28Message files in binary packages are not displayed with more(1).tron 1999-05-15@srcdir was renamed to @src long ago, reflect this in documentation;hubertf 1999-03-22More and more .Os cleanups. .Os is defined in the tmac.doc-common file,garbled 1999-03-22Replace static array of packages given to pkg_perform() with linearhubertf 1999-03-07Clean up SYNOPSIS formatting.mycroft 1999-01-19Add code for pkgdb.hubertf 1998-10-26Modify pkg_create to recognise Build Information and Version files, whenagc 1998-10-12+ Remove obsolete and unused string functions.agc 1998-10-09Fix a bug in pkg_info -f with @pkgcfl entries.agc 1998-10-09Garbage collect unused variable..agc 1998-06-05Add support for CONFLICTS entry, implement -C switch for pkg_createfrueauf 1998-02-06macroize BSD, NetBSD, FreeBSD and misc cleanupperry 1997-10-16Second part of intrgration of FreeBSD pkg_install as of 971013.hubertf 1997-10-16First cut on importing pkg_install as of FreeBSD 971013:hubertf 1997-10-10Fix typo: hte -> thehubertf 1997-06-09Use malloc and free in extract.c, not alloca.agc 1997-06-05Add NetBSD Idsagc 1997-06-05Initial import of FreeBSD packaging tool.agc