Builds now use "BUILDSEED" so that c++ binaries are reproduceable.

By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.
This commit is contained in:
perry 2008-08-05 19:43:33 +00:00
parent 5e89a5a8f1
commit b1d7b7c21a
3 changed files with 46 additions and 7 deletions

View File

@ -130,6 +130,14 @@ CONFIGURATION
configuration file in order to set additional build parame-
ters, such as compiler flags.
BUILDSEED GCC uses random numbers when compiling C++ code. This vari-
able seeds the gcc random number generator using the -fran-
dom-seed flag with this value. By default, it is set to
NetBSD-(majorversion). Using a fixed value causes C++ bina-
ries to be the same when built from the same sources. Addi-
tional information is available in the GCC documentation of
-frandom-seed.
DESTDIR Directory to contain the built NetBSD system. If set, spe-
cial options are passed to the compilation tools to prevent
their default use of the host system's /usr/include,
@ -752,6 +760,9 @@ BUILDING
(provides a clean starting point). This will skip deleting
DESTDIR if building on a native system to the root directory.
-S seed Change the value of BUILDSEED to seed. This should rarely be
necessary.
-T tools Set the value of TOOLDIR to tools. If a relative path is spec-
ified, it will be converted to an absolute path before being
used. If set, the bootstrap ``make'' will only be rebuilt if

View File

@ -1,5 +1,5 @@
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.189 2008/06/27 21:38:36 dyoung Exp $
# $NetBSD: build.sh,v 1.190 2008/08/05 19:43:33 perry Exp $
#
# Copyright (c) 2001-2005 The NetBSD Foundation, Inc.
# All rights reserved.
@ -241,6 +241,10 @@ initdefaults()
#
DISTRIBVER="$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh)"
# Set the BUILDSEED to NetBSD-"N"
#
setmakeenv BUILDSEED "NetBSD-$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh -m)"
# Set various environment variables to known defaults,
# to minimize (cross-)build problems observed "in the field".
#
@ -509,9 +513,10 @@ usage()
fi
cat <<_usage_
Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras] [-D dest]
[-j njob] [-M obj] [-m mach] [-N noisy] [-O obj] [-R release]
[-T tools] [-V var=[value]] [-w wrapper] [-X x11src] [-Z var]
Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras]
[-D dest] [-j njob] [-M obj] [-m mach] [-N noisy]
[-O obj] [-R release] [-S seed] [-T tools]
[-V var=[value]] [-w wrapper] [-X x11src] [-Z var]
operation [...]
Build operations (all imply "obj" and "tools"):
@ -562,6 +567,7 @@ Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras] [-D dest]
-o Set MKOBJDIRS=no; do not create objdirs at start of build.
-R release Set RELEASEDIR to release. [Default: releasedir]
-r Remove contents of TOOLDIR and DESTDIR before building.
-S seed Set BUILDSEED to seed. [Default: NetBSD-majorversion]
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, ${toolprefix}make will be (re)built unconditionally.
-U Set MKUNPRIVED=yes; build without requiring root privileges,
@ -581,7 +587,7 @@ _usage_
parseoptions()
{
opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:oR:rT:tUuV:w:xX:Z:'
opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:oR:rS:T:tUuV:w:xX:Z:'
opt_a=no
if type getopts >/dev/null 2>&1; then
@ -707,6 +713,11 @@ parseoptions()
do_rebuildmake=true
;;
-S)
eval ${optargcmd}
setmakeenv BUILDSEED "${OPTARG}"
;;
-T)
eval ${optargcmd}; resolvepath
TOOLDIR="${OPTARG}"
@ -1141,7 +1152,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.189 2008/06/27 21:38:36 dyoung Exp $
# Generated from: \$NetBSD: build.sh,v 1.190 2008/08/05 19:43:33 perry Exp $
# with these arguments: ${_args}
#

View File

@ -1,4 +1,4 @@
.\" $NetBSD: BUILDING.mdoc,v 1.59 2008/04/30 13:10:49 martin Exp $
.\" $NetBSD: BUILDING.mdoc,v 1.60 2008/08/05 19:43:33 perry Exp $
.\"
.\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -289,6 +289,16 @@ object directory names, and can be consulted in the
configuration file in order to set additional build parameters,
such as compiler flags.
.
.It Sy BUILDSEED
GCC uses random numbers when compiling C++ code.
This variable seeds the gcc random number generator using
the -frandom-seed flag with this value.
By default, it is set to NetBSD-(majorversion).
Using a fixed value causes C++ binaries to be the same when
built from the same sources.
Additional information is available in the GCC
documentation of -frandom-seed.
.
.It Sy DESTDIR
Directory to contain the built
.Nx
@ -1438,6 +1448,13 @@ This will skip deleting
.Sy DESTDIR
if building on a native system to the root directory.
.
.It Fl S Ar seed
Change the value of
.Sy BUILDSEED
to
.Ar seed .
This should rarely be necessary.
.
.It Fl T Ar tools
Set the value of
.Sy TOOLDIR