[BACK]Return to BUILDING CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src

Annotation of src/BUILDING, Revision 1.59.2.3

1.1       tv          1: BUILDING(8)             NetBSD System Manager's Manual             BUILDING(8)
                      2:
                      3: NAME
1.52      jmc         4:      BUILDING -- Procedure for building NetBSD from source code.
1.1       tv          5:
                      6: STATUS
                      7:      This document is a work-in-progress.  As such, the information described
                      8:      here may not match the reality of the build system as of this writing.
                      9:      Once this document is completely in sync with reality, this paragraph
                     10:      will be removed.
                     11:
1.44      lukem      12:      Discrepancies between this documentation and the current reality of
                     13:      implementation are noted specially, as with the note below:
1.1       tv         14:
                     15:      Note: This document applies only to platforms which use the new toolchain
1.15      lukem      16:      as indicated by the default setting of TOOLCHAIN_MISSING in <bsd.own.mk>.
1.5       tv         17:      Platforms which have not yet been switched to the new toolchain should
                     18:      continue building traditionally, using the notes specified in the file
                     19:      UPDATING.
1.1       tv         20:
                     21: REQUIREMENTS
                     22:      NetBSD is designed to be buildable on most POSIX-compliant host systems.
                     23:      The basic build procedure is the same whether compiling natively (on the
                     24:      same NetBSD architecture) or cross compiling (on another architecture or
                     25:      OS).
                     26:
                     27:      This source tree contains a special subtree, ``tools'', which uses the
                     28:      host system to create a build toolchain for the target architecture.  The
                     29:      host system must have at least C and C++ compilers in order to create the
                     30:      toolchain (make is not required); all other tools are created as part of
1.53      reed       31:      the NetBSD build process.  (See the environment variables section below
                     32:      if you need to override or manually select your compilers.)
1.1       tv         33:
                     34: FILES
                     35:    Source tree layout
1.17      wiz        36:      doc/BUILDING.mdoc
                     37:                     This document (in -mdoc troff format; the original copy).
1.1       tv         38:
1.2       wiz        39:      BUILDING       This document (in plaintext).
1.1       tv         40:
1.48      jmc        41:      tools/compat/README
                     42:                     Special notes for cross-hosting a NetBSD build on non-
                     43:                     NetBSD platforms.
                     44:
1.44      lukem      45:      Makefile       The main Makefile for NetBSD; should only be run for
                     46:                     native builds with an appropriately up-to-date version of
1.1       tv         47:                     NetBSD make(1).  (For building from out-of-date systems or
                     48:                     on a non-native host, see the build.sh shell script.)
                     49:
                     50:      UPDATING       Special notes for updating from an earlier revision of
                     51:                     NetBSD.  It is important to read this file before every
                     52:                     build of an updated source tree.
                     53:
                     54:      build.sh       Bourne-compatible shell script used for building the host
                     55:                     build tools and the NetBSD system from scratch.  Can be
                     56:                     used for both native and cross builds, and should be used
                     57:                     instead of make(1) for any source tree that is updated and
                     58:                     recompiled regularly.
                     59:
                     60:      crypto/dist/, dist/, gnu/dist/
                     61:                     Sources imported verbatim from third parties, without man-
                     62:                     gling the existing build structure.  Other source trees in
                     63:                     bin through usr.sbin use the NetBSD make(1) ``reachover''
1.44      lukem      64:                     Makefile semantics when building these programs for a
                     65:                     native host.
1.1       tv         66:
                     67:      distrib/, etc/
                     68:                     Sources for items used when making a full release snap-
1.27      lukem      69:                     shot, such as files installed in DESTDIR/etc on the desti-
                     70:                     nation system, boot media, and release notes.
1.1       tv         71:
                     72:      regress/       Regression test harness.  Can be cross-compiled, but only
                     73:                     run natively.
                     74:
                     75:      sys/           NetBSD kernel sources.
                     76:
                     77:      tools/         ``Reachover'' build structure for the host build tools.
                     78:                     This has a special method of determining out-of-date sta-
                     79:                     tus.
                     80:
                     81:      bin/ ... usr.sbin/
                     82:                     Sources to the NetBSD userland (non-kernel) programs.  If
                     83:                     any of these directories are missing, they will be skipped
                     84:                     during the build.
                     85:
1.49      lukem      86:      x11/           ``Reachover'' build structure for X11R6; the source is in
                     87:                     X11SRCDIR.
                     88:
1.1       tv         89:    Build tree layout
                     90:      The NetBSD build tree is described in hier(7), and the release layout is
                     91:      described in release(7).
                     92:
                     93: CONFIGURATION
1.8       lukem      94:    Environment variables
                     95:      Several environment variables control the behaviour of NetBSD builds.
                     96:
1.58      apb        97:      HOST_SH           Path name to a POSIX-compliant shell.  If this is not
                     98:                        set explicitly, then the default is set using heuris-
                     99:                        tics dependent on the host platform, or from the shell
                    100:                        under which build.sh is executed (if that can be deter-
                    101:                        mined), or using the first copy of sh found in PATH.
                    102:                        If the host system's /bin/sh is not POSIX-compliant, we
                    103:                        suggest that you build using commands like
                    104:
                    105:                              HOST_SH=/path/to/working/shell
                    106:                              export HOST_SH
                    107:                              ${HOST_SH} build.sh [options]
                    108:
1.53      reed      109:      HOST_CC           Path name to C compiler used to create the toolchain.
                    110:
                    111:      HOST_CXX          Path name to C++ compiler used to create the toolchain.
                    112:
1.8       lukem     113:      MACHINE           Machine type.
                    114:
                    115:      MACHINE_ARCH      Machine architecture.
                    116:
                    117:      MAKE              Path name to invoke make(1) as.
                    118:
                    119:      MAKEFLAGS         Flags to invoke make(1) with.
                    120:
                    121:      MAKEOBJDIR        Directory to use as the .OBJDIR for the current direc-
1.59      apb       122:                        tory.  The value is subjected to variable expansion by
                    123:                        make(1).  Used only if MAKEOBJDIRPREFIX is not defined.
1.36      lukem     124:                        MAKEOBJDIR can only be provided in the environment or
1.41      lukem     125:                        via the -O flag of build.sh.
1.8       lukem     126:
                    127:      MAKEOBJDIRPREFIX  Top level directory of the object directory tree.  If
1.59      apb       128:                        specified, must be an absolute path.  If this is
                    129:                        defined, ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the
                    130:                        .OBJDIR for the current directory.  The current direc-
                    131:                        tory may be read only.  MAKEOBJDIRPREFIX can only be
                    132:                        provided in the environment or via the -M flag of
1.36      lukem     133:                        build.sh.
1.8       lukem     134:
1.1       tv        135:    "make" variables
                    136:      Several variables control the behavior of NetBSD builds.  Unless other-
                    137:      wise specified, these variables may be set in either the process environ-
                    138:      ment or the make(1) configuration file specified by MAKECONF.
                    139:
1.9       thorpej   140:      BUILDID     Identifier for the build.  The identifier will be appended to
                    141:                  object directory names, and can be consulted in the make(1)
                    142:                  configuration file in order to set additional build parame-
                    143:                  ters, such as compiler flags.
                    144:
1.1       tv        145:      DESTDIR     Directory to contain the built NetBSD system.  If set, spe-
                    146:                  cial options are passed to the compilation tools to prevent
                    147:                  their default use of the host system's /usr/include,
1.59      apb       148:                  /usr/lib, and so forth.  This pathname must be an absolute
                    149:                  path, and should not end with a slash (/) character.  (For
                    150:                  installation into the system's root directory, set DESTDIR to
                    151:                  an empty string, not to ``/'').  The directory must reside on
                    152:                  a file system which supports long file names and hard links.
1.1       tv        153:
                    154:                  Default: Empty string if USETOOLS is ``yes''; unset other-
                    155:                  wise.
                    156:
1.30      lukem     157:                  Note: build.sh will provide a default of destdir.MACHINE (in
                    158:                  the top-level .OBJDIR) unless run in `expert' mode
                    159:
1.1       tv        160:      MAKECONF    The name of the make(1) configuration file.  Only settable in
                    161:                  the process environment.
                    162:
                    163:                  Default: ``/etc/mk.conf''
                    164:
1.45      lukem     165:      MAKEVERBOSE
                    166:                  Level of verbosity of status messages.  Supported values:
                    167:
                    168:                  0    No descriptive messages are shown.
                    169:
                    170:                  1    Descriptive messages are shown.
                    171:
                    172:                  2    Descriptive messages (prefixed with a `#') and command
                    173:                       output is not suppressed.
                    174:
                    175:                  Default: 2
                    176:
1.1       tv        177:      MKCATPAGES  Can be set to ``yes'' or ``no''.  Indicates whether prefor-
                    178:                  matted plaintext manual pages will be created during a build.
                    179:
                    180:                  Default: ``yes''
                    181:
                    182:      MKCRYPTO    Can be set to ``yes'' or ``no''.  Indicates whether crypto-
                    183:                  graphic code will be included in a build; provided for the
                    184:                  benefit of countries that do not allow strong cryptography.
1.44      lukem     185:                  Will not affect use of the standard low-security password
                    186:                  encryption system, crypt(3).
1.1       tv        187:
                    188:                  Default: ``yes''
                    189:
                    190:      MKDOC       Can be set to ``yes'' or ``no''.  Indicates whether system
1.44      lukem     191:                  documentation destined for DESTDIR/usr/share/doc will be
                    192:                  installed during a build.
1.1       tv        193:
                    194:                  Default: ``yes''
                    195:
1.4       tv        196:      MKHOSTOBJ   Can be set to ``yes'' or ``no''.  If set to ``yes'', then for
                    197:                  programs intended to be run on the compile host, the name,
                    198:                  release, and architecture of the host operating system will
                    199:                  be suffixed to the name of the object directory created by
                    200:                  ``make obj''.  (This allows multiple host systems to compile
                    201:                  NetBSD for a single target.)  If set to ``no'', then programs
                    202:                  built to be run on the compile host will use the same object
                    203:                  directory names as programs built to be run on the target.
                    204:
                    205:                  Default: ``no''
                    206:
1.1       tv        207:      MKINFO      Can be set to ``yes'' or ``no''.  Indicates whether GNU Info
                    208:                  files, used for the documentation for most of the compilation
                    209:                  tools, will be created and installed during a build.
                    210:
                    211:                  Default: ``yes''
                    212:
                    213:      MKLINT      Can be set to ``yes'' or ``no''.  Indicates whether lint(1)
                    214:                  will be run against portions of the NetBSD source code during
                    215:                  the build, and whether lint libraries will be installed into
1.27      lukem     216:                  DESTDIR/usr/libdata/lint.
1.1       tv        217:
                    218:                  Default: ``yes''
                    219:
                    220:      MKMAN       Can be set to ``yes'' or ``no''.  Indicates whether manual
                    221:                  pages will be installed during a build.
                    222:
                    223:                  Default: ``yes''
                    224:
                    225:      MKNLS       Can be set to ``yes'' or ``no''.  Indicates whether Native
1.44      lukem     226:                  Language System locale zone files will be compiled and
                    227:                  installed during a build.
1.1       tv        228:
                    229:                  Default: ``yes''
                    230:
                    231:      MKOBJ       Can be set to ``yes'' or ``no''.  Indicates whether object
                    232:                  directories will be created when running ``make obj''.  If
                    233:                  set to ``no'', then all built files will be located inside
                    234:                  the regular source tree.
                    235:
                    236:                  Default: ``yes''
                    237:
                    238:      MKPIC       Can be set to ``yes'' or ``no''.  Indicates whether shared
                    239:                  objects and libraries will be created and installed during a
                    240:                  build.  If set to ``no'', the entire built system will be
                    241:                  statically linked.
                    242:
                    243:                  Default: Platform dependent.  As of this writing, all plat-
                    244:                  forms except sh3 default to ``yes''.
                    245:
                    246:      MKPICINSTALL
                    247:                  Can be set to ``yes'' or ``no''.  Indicates whether the ar(1)
1.44      lukem     248:                  format libraries (lib*_pic.a), used to generate shared
                    249:                  libraries, are installed during a build.
1.1       tv        250:
                    251:                  Default: ``yes''
                    252:
                    253:      MKPROFILE   Can be set to ``yes'' or ``no''.  Indicates whether profiled
                    254:                  libraries (lib*_p.a) will be built and installed during a
                    255:                  build.
                    256:
                    257:                  Default: ``yes''; however, some platforms turn off MKPROFILE
                    258:                  by default at times due to toolchain problems with profiled
                    259:                  code.
                    260:
                    261:      MKSHARE     Can be set to ``yes'' or ``no''.  Indicates whether files
1.44      lukem     262:                  destined to reside in DESTDIR/usr/share will be built and
                    263:                  installed during a build.  If set to ``no'', then all of
1.27      lukem     264:                  MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to
                    265:                  ``no'' unconditionally.
1.1       tv        266:
                    267:                  Default: ``yes''
                    268:
1.50      wiz       269:      MKTTINTERP  Can be set to ``yes'' or ``no''.  For X builds, decides if
                    270:                  the TrueType bytecode interpreter is turned on.  See
                    271:                  http://www.freetype.org/patents.html for details.
                    272:
                    273:                  Default: ``no''
                    274:
1.44      lukem     275:      MKUNPRIVED  Can be set to ``yes'' or ``no''.  Indicates whether an
                    276:                  unprivileged install will occur.  The user, group, permis-
1.52      jmc       277:                  sions, and file flags, will not be set on the installed
                    278:                  items; instead the information will be appended to a file
                    279:                  called METALOG in DESTDIR.  The contents of METALOG are used
                    280:                  during the generation of the distribution tar files to ensure
                    281:                  that the appropriate file ownership is stored.
1.38      lukem     282:
                    283:                  Default: ``no''
                    284:
1.44      lukem     285:      MKUPDATE    Can be set to ``yes'' or ``no''.  Indicates whether all
                    286:                  install operations intended to write to DESTDIR will compare
1.38      lukem     287:                  file timestamps before installing, and skip the install phase
1.44      lukem     288:                  if the destination files are up-to-date.  This also has
                    289:                  implications on full builds (see next subsection).
1.38      lukem     290:
                    291:                  Default: ``no''
                    292:
1.49      lukem     293:      MKX11       Can be set to ``yes'' or ``no''.  Indicates whether X11R6 is
                    294:                  built from X11SRCDIR.
                    295:
                    296:                  Default: ``no''
                    297:
1.59      apb       298:      TOOLDIR     Directory to hold the host tools, once built.  If specified,
                    299:                  must be an absolute path.  This directory should be unique to
                    300:                  a given host system and NetBSD source tree.  (However, multi-
                    301:                  ple targets may share the same TOOLDIR; the target-dependent
                    302:                  files have unique names.)  If unset, a default based on the
                    303:                  uname(1) information of the host platform will be created in
                    304:                  the .OBJDIR of src.
1.1       tv        305:
                    306:                  Default: Unset.
                    307:
                    308:      USETOOLS    Indicates whether the tools specified by TOOLDIR should be
                    309:                  used as part of a build in progress.  Must be set to ``yes''
                    310:                  if cross-compiling.
                    311:
                    312:                  yes    Use the tools from TOOLDIR.
                    313:
                    314:                  no     Do not use the tools from TOOLDIR, but refuse to build
                    315:                         native compilation tool components that are version-
                    316:                         specific for that tool.
                    317:
                    318:                  never  Do not use the tools from TOOLDIR, even when building
                    319:                         native tool components.  This is similar to the tradi-
                    320:                         tional NetBSD build method, but does not verify that
                    321:                         the compilation tools in use are up-to-date enough in
                    322:                         order to build the tree successfully.  This may cause
                    323:                         build or runtime problems when building the whole
                    324:                         NetBSD source tree.
                    325:
                    326:                  Default: ``yes'' if building all or part of a whole NetBSD
                    327:                  source tree (detected automatically); ``no'' otherwise (to
1.44      lukem     328:                  preserve traditional semantics of the <bsd.*.mk> make(1)
                    329:                  include files).
1.1       tv        330:
1.59      apb       331:      X11SRCDIR   Directory containing the X11R6 source.  If specified, must be
                    332:                  an absolute path.  The main X11R6 source is found in
                    333:                  X11SRCDIR/xfree/xc.
1.49      lukem     334:
                    335:                  Default: ``/usr/xsrc''
                    336:
1.1       tv        337:    "make" variables for full builds
1.7       lukem     338:      These variables only affect the top level ``Makefile'' and do not affect
                    339:      manually building subtrees of the NetBSD source code.
1.1       tv        340:
1.20      lukem     341:      INSTALLWORLDDIR  Location for the ``make installworld'' target to install
1.59      apb       342:                       to.  If specified, must be an absolute path.
1.1       tv        343:
1.20      lukem     344:                       Default: ``/''
1.1       tv        345:
1.44      lukem     346:      MKOBJDIRS        Can be set to ``yes'' or ``no''.  Indicates whether
                    347:                       object directories will be created automatically (via a
1.20      lukem     348:                       ``make obj'' pass) at the start of a build.
1.1       tv        349:
1.34      lukem     350:                       Default: ``no''
1.1       tv        351:
1.38      lukem     352:      MKUPDATE         Can be set to ``yes'' or ``no''.  If set, then in addi-
                    353:                       tion to the effects described for MKUPDATE=yes above,
                    354:                       this implies the effects of NOCLEANDIR (i.e., ``make
                    355:                       cleandir'' is avoided).
                    356:
                    357:                       Default: ``no''
                    358:
1.20      lukem     359:      NBUILDJOBS       Now obsolete.  Use the make(1) option -j, instead (see
                    360:                       below)
1.1       tv        361:
1.20      lukem     362:                       Default: Unset.
1.1       tv        363:
1.20      lukem     364:      NOCLEANDIR       If set, avoids the ``make cleandir'' phase of a full
                    365:                       build.  This has the effect of allowing only changed
                    366:                       files in a source tree to be recompiled.  This can speed
                    367:                       up builds when updating only a few files in the tree.
1.1       tv        368:
1.20      lukem     369:                       Default: Unset.
1.1       tv        370:
1.20      lukem     371:      NODISTRIBDIRS    If set, avoids the ``make distrib-dirs'' phase of a full
                    372:                       build.  This skips running mtree(8) on DESTDIR, useful
                    373:                       on systems where building as an unprivileged user, or
                    374:                       where it is known that the system-wide mtree files have
                    375:                       not changed.
1.1       tv        376:
1.20      lukem     377:                       Default: Unset.
1.1       tv        378:
1.20      lukem     379:      NOINCLUDES       If set, avoids the ``make includes'' phase of a full
                    380:                       build.  This has the effect of preventing make(1) from
1.44      lukem     381:                       thinking that some programs are out-of-date simply
                    382:                       because the system include files have changed.  However,
1.20      lukem     383:                       this option should not be used when updating the entire
                    384:                       NetBSD source tree arbitrarily; it is suggested to use
1.38      lukem     385:                       MKUPDATE=yes in that case.
1.1       tv        386:
1.20      lukem     387:                       Default: Unset.
1.1       tv        388:
1.20      lukem     389:      RELEASEDIR       If set, specifies the directory to which a release(7)
                    390:                       layout will be written at the end of a ``make release''.
1.59      apb       391:                       If specified, must be an absolute path.
1.20      lukem     392:
                    393:                       Default: Unset.
                    394:
1.30      lukem     395:                       Note: build.sh will provide a default of releasedir (in
                    396:                       the top-level .OBJDIR) unless run in `expert' mode
                    397:
1.1       tv        398: BUILDING
                    399:    "make" command line options
1.52      jmc       400:      This is not a summary of all the options available to make(1); only the
                    401:      options used most frequently with NetBSD builds are listed here.
1.1       tv        402:
1.10      sommerfe  403:      -j njob    Run up to njob make(1) subjobs in parallel.  Makefiles should
1.52      jmc       404:                 use .WAIT or have explicit dependencies as necessary to
1.44      lukem     405:                 enforce build ordering.  If you see build failures with -j,
1.10      sommerfe  406:                 please save complete build logs so the failures can be ana-
                    407:                 lyzed.
                    408:
1.1       tv        409:      -m dir     Specify the default directory for searching for system Make-
                    410:                 file segments, mainly the <bsd.*.mk> files.  When building any
                    411:                 full NetBSD source tree, this should be set to the
                    412:                 ``share/mk'' directory in the source tree.  (This is set auto-
                    413:                 matically when building from the top level.)
                    414:
                    415:      -n         Display the commands that would have been executed, but do not
                    416:                 actually execute them.  This will still cause recursion to
                    417:                 take place.
                    418:
1.47      zuntum    419:      -V var     Print make(1)'s idea of the value of var.  Does not build any
1.1       tv        420:                 targets.
                    421:
                    422:      var=value  Set the variable var to value, overriding any setting speci-
                    423:                 fied by the process environment, the MAKECONF configuration
                    424:                 file, or the system Makefile segments.
                    425:
                    426:    "make" targets
                    427:      These default targets may be built by running make(1) in any subtree of
                    428:      the NetBSD source code.  It is recommended that none of these be used
                    429:      from the top level Makefile; as a specific exception, ``make obj'' and
                    430:      ``make cleandir'' are useful in that context.
                    431:
                    432:      all        Build programs, libraries, and preformatted documentation.
                    433:
                    434:      clean      Remove program and library object code files.
                    435:
1.44      lukem     436:      cleandir   Same as clean, but also remove preformatted documentation,
                    437:                 dependency files generated by ``make depend'', and any other
1.49      lukem     438:                 files known to be created at build time.
1.1       tv        439:
1.44      lukem     440:      depend     Create dependency files (.depend) containing more detailed
                    441:                 information about the dependencies of source code on header
1.1       tv        442:                 files.  Allows programs to be recompiled automatically when a
                    443:                 dependency changes.
                    444:
                    445:      dependall  Does a ``make depend'' immediately followed by a ``make all''.
1.10      sommerfe  446:                 This improves cache locality of the build since both passes
                    447:                 read the source files in their entirety.
1.1       tv        448:
1.49      lukem     449:      distclean  Synonym for cleandir.
                    450:
1.44      lukem     451:      includes   Build and install system header files.  Typically needed
                    452:                 before any system libraries or programs can be built.
1.1       tv        453:
                    454:      install    Install programs, libraries, and documentation into DESTDIR.
1.27      lukem     455:                 Few files will be installed to DESTDIR/dev, DESTDIR/etc,
                    456:                 DESTDIR/root or DESTDIR/var in order to prevent user supplied
                    457:                 configuration data from being overwritten.
1.1       tv        458:
                    459:      lint       Run lint(1) against the C source code, where appropriate, and
                    460:                 generate system-installed lint libraries.
                    461:
                    462:      obj        Create object directories to be used for built files, instead
                    463:                 of building directly in the source tree.
                    464:
                    465:      tags       Create ctags(1) searchable function lists usable by the ex(1)
                    466:                 and vi(1) text editors.
                    467:
                    468:    "make" targets for the top level
                    469:      Additional make(1) targets are usable specifically from the top source
                    470:      level to facilitate building the entire NetBSD source tree.
                    471:
1.20      lukem     472:      build         Build the entire NetBSD system.  This orders portions of
                    473:                    the source tree such that prerequisites will be built in
                    474:                    the proper order.
                    475:
                    476:      distribution  Do a ``make build'', and then install a full distribution
1.27      lukem     477:                    into DESTDIR, including files in DESTDIR/dev, DESTDIR/etc,
                    478:                    DESTDIR/root and DESTDIR/var.
1.20      lukem     479:
                    480:      buildworld    As per ``make distribution'', except that it ensures that
                    481:                    DESTDIR is not the root directory.
                    482:
                    483:      installworld  Install the distribution from DESTDIR to INSTALLWORLDDIR
                    484:                    (which defaults to the root directory).  Ensures that
1.52      jmc       485:                    INSTALLWORLDDIR is not the root directory if cross compil-
1.20      lukem     486:                    ing.
                    487:
1.59.2.1  bouyer    488:                    The INSTALLSETS environment variable may be set to a list
                    489:                    of distribution sets to be installed.  By default, all sets
                    490:                    except ``etc'' and ``xetc'' are installed (so most files in
                    491:                    INSTALLWORLDDIR/etc will not be installed or modified).
                    492:
                    493:                    Note: Before performing this operation with
                    494:                    INSTALLWORLDDIR=/, it is highly recommended that you
                    495:                    upgrade your kernel and reboot.  After performing this
                    496:                    operation, it is recommended that you use etcupdate(8) to
                    497:                    update files in INSTALLWORLDDIR/etc and that you use
                    498:                    postinstall(8) to check for inconsistencies (and possibly
                    499:                    to fix them).
1.20      lukem     500:
1.25      lukem     501:      sets          Create distribution sets from DESTDIR into
                    502:                    RELEASEDIR/MACHINE/binary/sets.  Should be run after ``make
                    503:                    distribution'' (as ``make build'' does not install all of
                    504:                    the required files).
                    505:
1.31      lukem     506:      sourcesets    Create source sets of the source tree into
                    507:                    RELEASEDIR/source/sets.
                    508:
1.54      apb       509:      syspkgs       Create syspkgs from DESTDIR into
                    510:                    RELEASEDIR/MACHINE/binary/syspkgs.  Should be run after
                    511:                    ``make distribution'' (as ``make build'' does not install
                    512:                    all of the required files).
                    513:
1.44      lukem     514:      release       Do a ``make distribution'', build kernels, distribution
                    515:                    media, and install sets (this as per ``make sets''), and
                    516:                    then package the system into a standard release layout as
                    517:                    described by release(7).  This requires that RELEASEDIR be
1.25      lukem     518:                    set (see above).
1.1       tv        519:
1.59.2.2  bouyer    520:      iso-image     Create a NetBSD installation CD-ROM image in the
                    521:                    RELEASEDIR/iso directory.  The CD-ROM file system will have
                    522:                    a layout as described in release(7).
                    523:
                    524:                    For most machine types, the CD-ROM will be bootable, and
                    525:                    will automatically run the sysinst(8) menu-based installa-
                    526:                    tion program, which can be used to install or upgrade a
                    527:                    NetBSD system.  Bootable CD-ROMs also contain tools that
                    528:                    may be useful in repairing a damaged NetBSD installation.
                    529:
                    530:                    Before ``make iso-image'' is attempted, RELEASEDIR must be
                    531:                    populated by ``make release'' or equivalent.
                    532:
                    533:                    Note that other, smaller, CD-ROM images may be created in
                    534:                    the RELEASEDIR/MACHINE/installation/cdrom directory by
                    535:                    ``make release''.  These smaller images usually contain the
                    536:                    same tools as the larger images in RELEASEDIR/iso, but do
                    537:                    not contain additional content such as the distribution
                    538:                    sets.
                    539:
                    540:                    Note that the mac68k port still uses an older method of
                    541:                    creating CD-ROM images.  This requires the mkisofs(1) util-
                    542:                    ity, which is not part of NetBSD, but which can be
                    543:                    installed from pkgsrc/sysutils/cdrtools.
1.56      apb       544:
1.59.2.3! xtraeme   545:      iso-image-source
        !           546:                    Create a NetBSD installation CD-ROM image in the
        !           547:                    RELEASEDIR/iso directory.  The CD-ROM file system will have
        !           548:                    a layout as described in release(7).  It will have top
        !           549:                    level directories for the machine type and source.
        !           550:
        !           551:                    For most machine types, the CD-ROM will be bootable, and
        !           552:                    will automatically run the sysinst(8) menu-based installa-
        !           553:                    tion program, which can be used to install or upgrade a
        !           554:                    NetBSD system.  Bootable CD-ROMs also contain tools that
        !           555:                    may be useful in repairing a damaged NetBSD installation.
        !           556:
        !           557:                    Before ``make iso-image-source'' is attempted, RELEASEDIR
        !           558:                    must be populated by ``make sourcesets release'' or equiva-
        !           559:                    lent.
        !           560:
        !           561:                    Note that other, smaller, CD-ROM images may be created in
        !           562:                    the RELEASEDIR/MACHINE/installation/cdrom directory by
        !           563:                    ``make release''.  These smaller images usually contain the
        !           564:                    same tools as the larger images in RELEASEDIR/iso, but do
        !           565:                    not contain additional content such as the distribution
        !           566:                    sets.
        !           567:
        !           568:                    Note that the mac68k port still uses an older method of
        !           569:                    creating CD-ROM images.  This requires the mkisofs(1) util-
        !           570:                    ity, which is not part of NetBSD, but which can be
        !           571:                    installed from pkgsrc/sysutils/cdrtools.
        !           572:
1.1       tv        573:      regression-tests
1.20      lukem     574:                    Can only be run after building the regression tests in the
                    575:                    directory ``regress''.  Runs the compiled regression tests
                    576:                    on the local host.
1.1       tv        577:
                    578:    The "build.sh" script
                    579:      This script file is a Bourne shell script designed to build the entire
                    580:      NetBSD system on any host with a Bourne shell in /bin/sh, including many
                    581:      that are not POSIX compliant.  Note that if a host system's /bin/sh is
                    582:      unusually old and broken, the Korn Shell (/bin/ksh), if available, may be
                    583:      a usable alternative.
                    584:
                    585:      All cross-compile builds, and most native builds, of the entire system
                    586:      should make use of build.sh rather than just running ``make''.  This way,
                    587:      the make(1) program will be bootstrapped properly, in case the host sys-
                    588:      tem has an older or incompatible ``make'' program.
                    589:
                    590:      When compiling the entire system via build.sh, many make(1) variables are
                    591:      set for you in order to help encapsulate the build process.  In the list
                    592:      of options below, variables that are automatically set by build.sh are
                    593:      noted where applicable.
                    594:
1.22      lukem     595:      The following operations are supported by build.sh:
                    596:
1.44      lukem     597:      build         Build the system as per ``make build''.  This option
                    598:                    implies the obj and tools operations.
1.22      lukem     599:
                    600:      distribution  Build a full distribution as per ``make distribution''.
                    601:                    This option implies the build operation.
                    602:
                    603:      release       Build a full release as per ``make release''.  This option
                    604:                    implies the distribution operation.
                    605:
1.23      lukem     606:      makewrapper   Create the nbmake-MACHINE wrapper.  This operation is auto-
                    607:                    matically performed for any of the other operations.
                    608:
1.22      lukem     609:      obj           Perform ``make obj''.
                    610:
                    611:      tools         Build and install the host tools from src/tools.
                    612:
1.35      lukem     613:      install=idir  Install the contents of DESTDIR to idir, using ``make
1.59.2.1  bouyer    614:                    installworld''.  Note that files that are part of the
                    615:                    ``etc'' or ``xetc'' sets will not be installed.
1.35      lukem     616:
1.22      lukem     617:      kernel=kconf  Build a new kernel.  The kconf argument is the name of a
1.54      apb       618:                    configuration file suitable for use by config(1).  If kconf
1.22      lukem     619:                    does not contain any `/' characters, the configuration file
                    620:                    is expected to be found in the KERNCONFDIR directory, which
                    621:                    is typically sys/arch/MACHINE/conf.  The new kernel will be
                    622:                    built in a subdirectory of KERNOBJDIR, which is typically
                    623:                    sys/arch/MACHINE/compile or an associated object directory.
                    624:                    In order to ensure that the kernel is built using up-to-
                    625:                    date tools, it is strongly recommended that the tools be
                    626:                    rebuilt (using the tools operation).
                    627:
1.35      lukem     628:      releasekernel=kconf
                    629:                    Install a gzip(1)ed copy of the kernel built by
                    630:                    kernel=kconf into RELEASEDIR/MACHINE/binary/kernel, usually
1.44      lukem     631:                    as netbsd-kconf.gz, although the ``netbsd'' prefix is
                    632:                    determined from the ``config'' directives in kconf.
1.24      lukem     633:
                    634:      sets          Perform ``make sets''.
1.31      lukem     635:
                    636:      sourcesets    Perform ``make sourcesets''.
1.22      lukem     637:
1.54      apb       638:      syspkgs       Perform ``make syspkgs''.
                    639:
1.56      apb       640:      iso-image     Perform ``make iso-image''.
                    641:
1.59.2.3! xtraeme   642:      iso-image-source
        !           643:                    Perform ``make iso-image-source''.
        !           644:
1.51      wiz       645:      The following command line options alter the behaviour of the build.sh
                    646:      operations described above:
1.1       tv        647:
                    648:      -a arch   Set the value of MACHINE_ARCH to arch.
1.9       thorpej   649:
                    650:      -B buildid
                    651:                Set the value of BUILDID to buildid.  This will also append the
                    652:                build idenfitier to the name of the ``make'' wrapper script so
1.37      lukem     653:                that the resulting name is of the form
                    654:                ``nbmake-MACHINE-BUILDID''.
1.1       tv        655:
1.59.2.3! xtraeme   656:      -C cddir  Set the value of CDEXTRA to cddir.  If a relative path is spec-
        !           657:                ified, it will be converted to an absolute path before being
        !           658:                used.  When combined with ``iso-image'' or
        !           659:                ``iso-image-source'', it will cause the contents of cddir to be
        !           660:                added to the CD-ROM image.
        !           661:
1.59      apb       662:      -D dest   Set the value of DESTDIR to dest.  If a relative path is speci-
                    663:                fied, it will be converted to an absolute path before being
                    664:                used.
1.18      lukem     665:
1.23      lukem     666:      -E        Set `expert' mode.  This overrides various sanity checks, and
                    667:                allows: DESTDIR does not have to be set to a non-root path for
1.38      lukem     668:                builds, and MKUNPRIVED=yes does not have to be set when build-
                    669:                ing as a non-root user.
1.23      lukem     670:
                    671:                Note: It is highly recommended that you know what you are doing
                    672:                when you use this option.
1.19      lukem     673:
1.51      wiz       674:      -h        Print a help message.
                    675:
1.10      sommerfe  676:      -j njob   Passed through to make(1).  Makefiles should use .WAIT or have
                    677:                explicit dependancies as necessary to enforce build ordering.
                    678:                If you see build failures with -j, please save complete build
                    679:                logs so the failures can be analyzed.
1.1       tv        680:
1.59      apb       681:      -M obj    Set MAKEOBJDIRPREFIX to obj.  If a relative path is specified,
                    682:                it will be converted to an absolute path before being used.
                    683:                Unsets MAKEOBJDIR.
1.18      lukem     684:
1.1       tv        685:      -m mach   Set the value of MACHINE to mach.  This will also override any
                    686:                value of MACHINE_ARCH in the process environment with a value
1.33      lukem     687:                deduced from mach, unless -a is specified, or mach is a special
                    688:                case listed below.  All cross builds require -m, but if unset
                    689:                on a NetBSD host, the host's value of MACHINE will be detected
                    690:                and used automatically.
                    691:
                    692:                Some machines support multiple values for MACHINE_ARCH.  For a
                    693:                given value of mach, the following MACHINE and MACHINE_ARCH
                    694:                values will result:
                    695:
                    696:                      mach          MACHINE    MACHINE_ARCH
                    697:                      evbmips       evbmips    (not set)
                    698:                      evbmips-eb    evbmips    mipseb
                    699:                      evbmips-el    evbmips    mipsel
                    700:                      evbsh3        evbsh3     (not set)
                    701:                      evbsh3-eb     evbsh3     sh3eb
                    702:                      evbsh3-el     evbsh3     sh3el
                    703:                      sbmips        sbmips     (not set)
                    704:                      sbmips-eb     sbmips     mipseb
                    705:                      sbmips-el     sbmips     mipsel
1.1       tv        706:
1.45      lukem     707:      -N noiselevel
1.46      lukem     708:                Set the ``noisyness'' level of the build, by setting
                    709:                MAKEVERBOSE to noiselevel.
1.45      lukem     710:
1.1       tv        711:      -n        Show the commands that would be executed by build.sh, but do
                    712:                not make any changes.  This is similar in concept to ``make
                    713:                -n''.
                    714:
1.18      lukem     715:      -O obj    Create an appropriate transform macro for MAKEOBJDIR that will
1.59      apb       716:                place the built object files under obj.  If a relative path is
                    717:                specified, it will be converted to an absolute path before
                    718:                being used.  For instance, a setting of /usr/obj will place
                    719:                build-time files under /usr/obj/bin, /usr/obj/lib,
                    720:                /usr/obj/usr.bin, and so forth.  Unsets MAKEOBJDIRPREFIX.
1.18      lukem     721:
1.34      lukem     722:      -o        Set the value of MKOBJDIRS to ``no''.  Otherwise, it will be
                    723:                automatically set to ``yes'' (which is opposite to the default
                    724:                behaviour).
1.1       tv        725:
1.59      apb       726:      -R rel    Set the value of RELEASEDIR to rel.  If a relative path is
                    727:                specified, it will be converted to an absolute path before
                    728:                being used.
1.18      lukem     729:
1.1       tv        730:      -r        Remove the contents of DESTDIR and TOOLDIR before building
                    731:                (provides a clean starting point).  This will skip deleting
                    732:                DESTDIR if building on a native system to the root directory.
                    733:
1.59      apb       734:      -T tools  Set the value of TOOLDIR to tools.  If a relative path is spec-
                    735:                ified, it will be converted to an absolute path before being
                    736:                used.  If set, the bootstrap ``make'' will only be rebuilt as
                    737:                needed (when the source files for make(1) change).
1.18      lukem     738:
1.38      lukem     739:      -U        Set MKUNPRIVED=yes.
1.18      lukem     740:
1.38      lukem     741:      -u        Set MKUPDATE=yes.
1.1       tv        742:
1.21      lukem     743:      -V var=[value]
1.40      lukem     744:                Set the environment variable var to an optional value.  This is
                    745:                propagated to the nbmake wrapper.
1.21      lukem     746:
1.1       tv        747:      -w wrapper
                    748:                Create the nbmake wrapper script (see below) in a custom loca-
                    749:                tion, specified by wrapper.  This allows, for instance, to
                    750:                place the wrapper in PATH automatically.  Note that wrapper is
1.59      apb       751:                the full name of the file, not just a directory name.  If a
                    752:                relative path is specified, it will be converted to an absolute
                    753:                path before being used.
1.1       tv        754:
1.49      lukem     755:      -X x11src
1.59      apb       756:                Set the value of X11SRCDIR to x11src.  If a relative path is
                    757:                specified, it will be converted to an absolute path before
                    758:                being used.
1.49      lukem     759:
                    760:      -x        Set MKX11=yes.
                    761:
1.40      lukem     762:      -Z var    Unset ("zap") the environment variable var.  This is propagated
                    763:                to the nbmake wrapper.
                    764:
1.1       tv        765:    The "nbmake-MACHINE" wrapper script
                    766:      If using the build.sh script to build NetBSD, a nbmake-MACHINE script
                    767:      will be created in TOOLDIR/bin upon the first build to assist in building
                    768:      subtrees on a cross-compile host.
                    769:
                    770:      nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
                    771:      the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
                    772:      eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
1.40      lukem     773:      build.sh will also set variables specified with -V, and unset variables
                    774:      specified with -Z.
                    775:
1.1       tv        776:      This script can be symlinked into a directory listed in PATH, or called
                    777:      with an absolute path.
                    778:
1.16      lukem     779: EXAMPLES
1.44      lukem     780:      1.   % ./build.sh tools kernel=GENERIC
1.28      lukem     781:
                    782:           Build a new toolchain, and use the new toolchain to configure and
                    783:           build a new GENERIC kernel.
                    784:
1.44      lukem     785:      2.   % ./build.sh -U distribution
1.28      lukem     786:
1.30      lukem     787:           Using unprivileged mode, build a complete distribution to a DESTDIR
                    788:           directory that build.sh selects (and will display).
1.28      lukem     789:
1.43      martti    790:      3.   # ./build.sh -U install=/
1.28      lukem     791:
1.29      lukem     792:           As root, install to / the distribution that was built by example 2.
                    793:           Even though this is run as root, -U is required so that the permis-
1.30      lukem     794:           sions stored in DESTDIR/METALOG are correctly applied to the files
                    795:           as they're copied to /.
1.28      lukem     796:
1.44      lukem     797:      4.   % ./build.sh -U -u release
1.28      lukem     798:
1.30      lukem     799:           Using unprivileged mode, build a complete release to DESTDIR and
                    800:           RELEASEDIR directories that build.sh selects (and will display).
1.38      lukem     801:           MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that
                    802:           if this is run after example 2, it doesn't need to redo that portion
                    803:           of the release build.
1.16      lukem     804:
1.10      sommerfe  805: OBSOLETE VARIABLES
1.15      lukem     806:      NBUILDJOBS  Use the make(1) option -j, instead.
                    807:
                    808:      USE_NEW_TOOLCHAIN
                    809:                  The new toolchain is now the default.  To disable, use
                    810:                  TOOLCHAIN_MISSING=yes.
1.10      sommerfe  811:
1.1       tv        812: SEE ALSO
1.59.2.2  bouyer    813:      make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8),
1.59.2.1  bouyer    814:      pkgsrc/sysutils/cdrtools
1.1       tv        815:
                    816: HISTORY
1.15      lukem     817:      The build.sh based build scheme was introduced for NetBSD 1.6 as
                    818:      USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
1.1       tv        819:
                    820: BUGS
1.15      lukem     821:      A few platforms are not yet using this build system.
1.1       tv        822:
1.59.2.3! xtraeme   823: NetBSD                         September 1, 2007                        NetBSD

CVSweb <webmaster@jp.NetBSD.org>