Add -P for reproducible builds based on the latest cvs timestamp.
This commit is contained in:
parent
29c66ef650
commit
bb5b15d092
147
build.sh
147
build.sh
@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env sh
|
||||
# $NetBSD: build.sh,v 1.311 2016/11/13 14:47:46 ast Exp $
|
||||
# $NetBSD: build.sh,v 1.312 2016/12/18 02:20:30 christos Exp $
|
||||
#
|
||||
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@ -1003,7 +1003,7 @@ usage()
|
||||
fi
|
||||
cat <<_usage_
|
||||
|
||||
Usage: ${progname} [-EhnorUuxy] [-a arch] [-B buildid] [-C cdextras]
|
||||
Usage: ${progname} [-EhnoPRrUuxy] [-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] [-Y extsrcsrc]
|
||||
@ -1078,6 +1078,8 @@ Usage: ${progname} [-EhnorUuxy] [-a arch] [-B buildid] [-C cdextras]
|
||||
-O obj Set obj root directory to obj; sets a MAKEOBJDIR pattern.
|
||||
Unsets MAKEOBJDIRPREFIX.
|
||||
-o Set MKOBJDIRS=no; do not create objdirs at start of build.
|
||||
-P Set MKREPRO and MKREPRO_TIMESTAMP to the latest source
|
||||
CVS timestamp for reproducible builds.
|
||||
-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]
|
||||
@ -1103,7 +1105,7 @@ _usage_
|
||||
|
||||
parseoptions()
|
||||
{
|
||||
opts='a:B:C:D:Ehj:M:m:N:nO:oR:rS:T:UuV:w:X:xY:yZ:'
|
||||
opts='a:B:C:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:'
|
||||
opt_a=false
|
||||
opt_m=false
|
||||
|
||||
@ -1219,6 +1221,10 @@ parseoptions()
|
||||
MKOBJDIRS=no
|
||||
;;
|
||||
|
||||
-P)
|
||||
MKREPRO=yes
|
||||
;;
|
||||
|
||||
-R)
|
||||
eval ${optargcmd}; resolvepath OPTARG
|
||||
setmakeenv RELEASEDIR "${OPTARG}"
|
||||
@ -1435,7 +1441,62 @@ sanitycheck()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
# print_tooldir_make --
|
||||
# Try to find and print a path to an existing
|
||||
# ${TOOLDIR}/bin/${toolprefix}program
|
||||
print_tooldir_program()
|
||||
{
|
||||
local possible_TOP_OBJ
|
||||
local possible_TOOLDIR
|
||||
local possible_program
|
||||
local tooldir_program
|
||||
local program=${1}
|
||||
|
||||
if [ -n "${TOOLDIR}" ]; then
|
||||
echo "${TOOLDIR}/bin/${toolprefix}${program}"
|
||||
return
|
||||
fi
|
||||
|
||||
# Set host_ostype to something like "NetBSD-4.5.6-i386". This
|
||||
# is intended to match the HOST_OSTYPE variable in <bsd.own.mk>.
|
||||
#
|
||||
local host_ostype="${uname_s}-$(
|
||||
echo "${uname_r}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
|
||||
)-$(
|
||||
echo "${uname_p}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
|
||||
)"
|
||||
|
||||
# Look in a few potential locations for
|
||||
# ${possible_TOOLDIR}/bin/${toolprefix}${program}.
|
||||
# If we find it, then set possible_program.
|
||||
#
|
||||
# In the usual case (without interference from environment
|
||||
# variables or /etc/mk.conf), <bsd.own.mk> should set TOOLDIR to
|
||||
# "${_SRC_TOP_OBJ_}/tooldir.${host_ostype}".
|
||||
#
|
||||
# In practice it's difficult to figure out the correct value
|
||||
# for _SRC_TOP_OBJ_. In the easiest case, when the -M or -O
|
||||
# options were passed to build.sh, then ${TOP_objdir} will be
|
||||
# the correct value. We also try a few other possibilities, but
|
||||
# we do not replicate all the logic of <bsd.obj.mk>.
|
||||
#
|
||||
for possible_TOP_OBJ in \
|
||||
"${TOP_objdir}" \
|
||||
"${MAKEOBJDIRPREFIX:+${MAKEOBJDIRPREFIX}${TOP}}" \
|
||||
"${TOP}" \
|
||||
"${TOP}/obj" \
|
||||
"${TOP}/obj.${MACHINE}"
|
||||
do
|
||||
[ -n "${possible_TOP_OBJ}" ] || continue
|
||||
possible_TOOLDIR="${possible_TOP_OBJ}/tooldir.${host_ostype}"
|
||||
possible_program="${possible_TOOLDIR}/bin/${toolprefix}${program}"
|
||||
if [ -x "${possible_make}" ]; then
|
||||
echo ${possible_program}
|
||||
return;
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
}
|
||||
# print_tooldir_make --
|
||||
# Try to find and print a path to an existing
|
||||
# ${TOOLDIR}/bin/${toolprefix}make, for use by rebuildmake() before a
|
||||
@ -1459,56 +1520,11 @@ sanitycheck()
|
||||
#
|
||||
print_tooldir_make()
|
||||
{
|
||||
local possible_TOP_OBJ
|
||||
local possible_TOOLDIR
|
||||
local possible_make
|
||||
local possible_TOOLDIR
|
||||
local tooldir_make
|
||||
|
||||
if [ -n "${TOOLDIR}" ]; then
|
||||
echo "${TOOLDIR}/bin/${toolprefix}make"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Set host_ostype to something like "NetBSD-4.5.6-i386". This
|
||||
# is intended to match the HOST_OSTYPE variable in <bsd.own.mk>.
|
||||
#
|
||||
local host_ostype="${uname_s}-$(
|
||||
echo "${uname_r}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
|
||||
)-$(
|
||||
echo "${uname_p}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
|
||||
)"
|
||||
|
||||
# Look in a few potential locations for
|
||||
# ${possible_TOOLDIR}/bin/${toolprefix}make.
|
||||
# If we find it, then set possible_make.
|
||||
#
|
||||
# In the usual case (without interference from environment
|
||||
# variables or /etc/mk.conf), <bsd.own.mk> should set TOOLDIR to
|
||||
# "${_SRC_TOP_OBJ_}/tooldir.${host_ostype}".
|
||||
#
|
||||
# In practice it's difficult to figure out the correct value
|
||||
# for _SRC_TOP_OBJ_. In the easiest case, when the -M or -O
|
||||
# options were passed to build.sh, then ${TOP_objdir} will be
|
||||
# the correct value. We also try a few other possibilities, but
|
||||
# we do not replicate all the logic of <bsd.obj.mk>.
|
||||
#
|
||||
for possible_TOP_OBJ in \
|
||||
"${TOP_objdir}" \
|
||||
"${MAKEOBJDIRPREFIX:+${MAKEOBJDIRPREFIX}${TOP}}" \
|
||||
"${TOP}" \
|
||||
"${TOP}/obj" \
|
||||
"${TOP}/obj.${MACHINE}"
|
||||
do
|
||||
[ -n "${possible_TOP_OBJ}" ] || continue
|
||||
possible_TOOLDIR="${possible_TOP_OBJ}/tooldir.${host_ostype}"
|
||||
possible_make="${possible_TOOLDIR}/bin/${toolprefix}make"
|
||||
if [ -x "${possible_make}" ]; then
|
||||
break
|
||||
else
|
||||
unset possible_make
|
||||
fi
|
||||
done
|
||||
|
||||
possible_make=$(print_tooldir_program make)
|
||||
# If the above didn't work, search the PATH for a suitable
|
||||
# ${toolprefix}make, nbmake, bmake, or make.
|
||||
#
|
||||
@ -1876,7 +1892,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.311 2016/11/13 14:47:46 ast Exp $
|
||||
# Generated from: \$NetBSD: build.sh,v 1.312 2016/12/18 02:20:30 christos Exp $
|
||||
# with these arguments: ${_args}
|
||||
#
|
||||
|
||||
@ -1907,8 +1923,8 @@ EOF
|
||||
|
||||
make_in_dir()
|
||||
{
|
||||
dir="$1"
|
||||
op="$2"
|
||||
local dir="$1"
|
||||
local op="$2"
|
||||
${runcmd} cd "${dir}" ||
|
||||
bomb "Failed to cd to \"${dir}\""
|
||||
${runcmd} "${makewrapper}" ${parallel} ${op} ||
|
||||
@ -2172,6 +2188,22 @@ dorump()
|
||||
statusmsg "Rump build&link tests successful"
|
||||
}
|
||||
|
||||
setup_mkrepro()
|
||||
{
|
||||
if [ ${MKREPRO-no} != "yes" ]; then
|
||||
return
|
||||
fi
|
||||
buildtools
|
||||
local dirs=${NETBSDSRCDIR-/usr/src}
|
||||
if [ ${MKX11-no} = "yes" ]; then
|
||||
dirs="$dirs ${X11SRCDIR-/usr/xsrc}"
|
||||
fi
|
||||
local cvslatest=$(print_tooldir_program cvslatest)
|
||||
MKREPRO_TIMESTAMP=$(${cvslatest} ${dirs})
|
||||
statusmsg2 "MKREPRO_TIMESTAMP" "$(date -r ${MKREPRO_TIMESTAMP})"
|
||||
export MKREPRO MKREPRO_TIMESTAMP
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
initdefaults
|
||||
@ -2224,7 +2256,14 @@ main()
|
||||
statusmsg "Built sets to ${setdir}"
|
||||
;;
|
||||
|
||||
cleandir|obj|build|distribution|release|sourcesets|syspkgs|params)
|
||||
build|distribution|release)
|
||||
setup_mkrepro
|
||||
${runcmd} "${makewrapper}" ${parallel} ${op} ||
|
||||
bomb "Failed to make ${op}"
|
||||
statusmsg "Successful make ${op}"
|
||||
;;
|
||||
|
||||
cleandir|obj|sourcesets|syspkgs|params)
|
||||
${runcmd} "${makewrapper}" ${parallel} ${op} ||
|
||||
bomb "Failed to make ${op}"
|
||||
statusmsg "Successful make ${op}"
|
||||
|
Loading…
Reference in New Issue
Block a user