Date: Wed, 24 Nov 2010 10:57:59 +0100 From: Erik Cederstrand <erik@cederstrand.dk> To: =?iso-8859-1?Q?Ulrich_Sp=F6rlein?= <uqs@spoerlein.net> Cc: FreeBSD Hackers <hackers@freebsd.org> Subject: Re: Deterministic builds? Message-ID: <8BC47284-261E-40DF-9132-5325BA223492@cederstrand.dk> In-Reply-To: <20101022100134.GL19295@acme.spoerlein.net> References: <718D8E86-EA2E-4D07-BAFF-5D8D093FD296@cederstrand.dk> <20101011084733.GM2392@deviant.kiev.zoral.com.ua> <95F3B27C-42E6-4267-9965-AC3219310C35@cederstrand.dk> <20101021175748.GD19295@acme.spoerlein.net> <C297DE8F-0842-41C2-A930-A15AA0F3B3BB@cederstrand.dk> <20101022100134.GL19295@acme.spoerlein.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail-101-900350821 Content-Type: multipart/mixed; boundary=Apple-Mail-100-900350808 --Apple-Mail-100-900350808 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Den 22/10/2010 kl. 12.01 skrev Ulrich Sp=F6rlein: >=20 > Why do you make this a requirement? Of course it's usually easier to > build different releases from different source directories, but I = think > requiring the following conditions are fine: >=20 > 1. If you build a specific svn revision, > 2. sitting in /usr/src with > 3. the default make.conf (ie., no special flags, no frobbing of = OBJDIR) > 4. at different times >=20 > then you get the same binaries. >=20 > Let's start with an achievable, not-so-intrusive goal, right?=20 Attached is a patch which addresses the simple case where OBJDIR, SRCDIR = and SVN revision are constant, and DESTDIR and build time are different = across builds. It does the following: * Patches ranlib to produce generic symbol table (-D option, patch also = sent to Kai Wang) * Patches sendmail config scripts to output generic headers for config = files * Patches a swath of Makefiles in /contrib that override $ARFLAGS * Removes debugging flag from bthidd Makefile * Adds -D to ARFLAGS and RANLIB * Adds -frandom-seed to CXXflags All the above are only activated if "WITH_DETERMINISTIC=3Dtrue" is = passed to make: make WITH_DETERMINISTIC=3Dtrue buildworld/kernel If I could get sendmail config scripts to see src.conf, then it would be = possible to place the flag in src.conf. Normal "make buildworld" should be unaffected by the patch. I have = attempted to keep the diff as small as possible. Next goal is making buildworld immune to changing OBJDIRs. Erik --Apple-Mail-100-900350808 Content-Disposition: attachment; filename=deterministic.patch Content-Type: application/octet-stream; name="deterministic.patch" Content-Transfer-Encoding: 7bit Index: crypto/heimdal/appl/ftp/common/Makefile.in =================================================================== --- crypto/heimdal/appl/ftp/common/Makefile.in (revision 215680) +++ crypto/heimdal/appl/ftp/common/Makefile.in (working copy) @@ -90,7 +90,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru libcommon_a_AR = $(AR) $(ARFLAGS) libcommon_a_LIBADD = am_libcommon_a_OBJECTS = sockbuf.$(OBJEXT) buffer.$(OBJEXT) Index: crypto/heimdal/appl/telnet/libtelnet/Makefile.in =================================================================== --- crypto/heimdal/appl/telnet/libtelnet/Makefile.in (revision 215680) +++ crypto/heimdal/appl/telnet/libtelnet/Makefile.in (working copy) @@ -90,7 +90,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru libtelnet_a_AR = $(AR) $(ARFLAGS) libtelnet_a_LIBADD = am_libtelnet_a_OBJECTS = auth.$(OBJEXT) enc_des.$(OBJEXT) \ Index: crypto/heimdal/lib/45/Makefile.in =================================================================== --- crypto/heimdal/lib/45/Makefile.in (revision 215680) +++ crypto/heimdal/lib/45/Makefile.in (working copy) @@ -98,7 +98,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru lib45_a_AR = $(AR) $(ARFLAGS) lib45_a_LIBADD = am_lib45_a_OBJECTS = get_ad_tkt.$(OBJEXT) mk_req.$(OBJEXT) Index: crypto/openssl/Makefile.org =================================================================== --- crypto/openssl/Makefile.org (revision 215680) +++ crypto/openssl/Makefile.org (working copy) @@ -63,9 +63,9 @@ PEX_LIBS= EX_LIBS= EXE_EXT= -ARFLAGS= -AR=ar $(ARFLAGS) r -ARD=ar $(ARFLAGS) d +ARFLAGS ?= r +AR=ar $(ARFLAGS) +ARD=ar d RANLIB= ranlib PERL= perl TAR= tar Index: crypto/openssl/Makefile =================================================================== --- crypto/openssl/Makefile (revision 215680) +++ crypto/openssl/Makefile (working copy) @@ -65,9 +65,9 @@ PEX_LIBS= EX_LIBS= EXE_EXT= -ARFLAGS= -AR= ar $(ARFLAGS) r -ARD=ar $(ARFLAGS) d +ARFLAGS ?= r +AR= ar $(ARFLAGS) +ARD=ar d RANLIB= /usr/bin/ranlib PERL= /usr/bin/perl TAR= tar Index: crypto/openssl/crypto/ripemd/Makefile =================================================================== --- crypto/openssl/crypto/ripemd/Makefile (revision 215680) +++ crypto/openssl/crypto/ripemd/Makefile (working copy) @@ -9,7 +9,8 @@ INCLUDES= CFLAG=-g MAKEFILE= Makefile -AR= ar r +ARFLAGS?= r +AR= ar $(ARFLAGS) RIP_ASM_OBJ= Index: crypto/openssl/crypto/md4/Makefile =================================================================== --- crypto/openssl/crypto/md4/Makefile (revision 215680) +++ crypto/openssl/crypto/md4/Makefile (working copy) @@ -9,7 +9,8 @@ INCLUDES= CFLAG=-g MAKEFILE= Makefile -AR= ar r +ARFLAGS?= r +AR= ar $(ARFLAGS) CFLAGS= $(INCLUDES) $(CFLAG) Index: crypto/openssl/crypto/md5/Makefile =================================================================== --- crypto/openssl/crypto/md5/Makefile (revision 215680) +++ crypto/openssl/crypto/md5/Makefile (working copy) @@ -9,7 +9,8 @@ INCLUDES=-I.. -I$(TOP) -I../../include CFLAG=-g MAKEFILE= Makefile -AR= ar r +ARFLAGS?= r +AR= ar $(ARFLAGS) MD5_ASM_OBJ= Index: crypto/openssl/crypto/sha/Makefile =================================================================== --- crypto/openssl/crypto/sha/Makefile (revision 215680) +++ crypto/openssl/crypto/sha/Makefile (working copy) @@ -9,7 +9,8 @@ INCLUDES= CFLAG=-g MAKEFILE= Makefile -AR= ar r +ARFLAGS?= r +AR= ar $(ARFLAGS) SHA1_ASM_OBJ= Index: usr.bin/ar/ar.1 =================================================================== --- usr.bin/ar/ar.1 (revision 215680) +++ usr.bin/ar/ar.1 (working copy) @@ -92,6 +92,7 @@ .Ar archive .Op Ar files ... .Nm ranlib +.Op Fl D .Ar archive ... .Sh DESCRIPTION The Index: usr.bin/ar/ar.c =================================================================== --- usr.bin/ar/ar.c (revision 215680) +++ usr.bin/ar/ar.c (working copy) @@ -113,10 +113,13 @@ len = strlen(bsdar->progname); if (len >= strlen("ranlib") && strcmp(bsdar->progname + len - strlen("ranlib"), "ranlib") == 0) { - while ((opt = getopt_long(argc, argv, "tV", longopts, + while ((opt = getopt_long(argc, argv, "DtV", longopts, NULL)) != -1) { switch(opt) { - case 't': + case 'D': + bsdar->options |= AR_D; + break; + case 't': /* Ignored. */ break; case 'V': Index: gnu/usr.bin/cc/cc_tools/Makefile =================================================================== --- gnu/usr.bin/cc/cc_tools/Makefile (revision 215680) +++ gnu/usr.bin/cc/cc_tools/Makefile (working copy) @@ -519,9 +519,11 @@ ${CC} -c -I ${.CURDIR}/../libiberty ${CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor +ARFLAGS ?= cq + ${LIBIBERTY}: ${LIBIBERTY_OBJS} @rm -f ${.TARGET} - @${AR} cq ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q` + @${AR} ${ARFLAGS} ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q` ${RANLIB} ${.TARGET} CLEANFILES+= ${LIBIBERTY} ${LIBIBERTY_OBJS} Index: gnu/lib/libgcc/Makefile =================================================================== --- gnu/lib/libgcc/Makefile (revision 215680) +++ gnu/lib/libgcc/Makefile (working copy) @@ -337,10 +337,12 @@ # # Build additional static libgcc_eh[_p].a libraries. # + +ARFLAGS ?= cq libgcc_eh.a: ${EH_OBJS_T} @${ECHO} building static gcc_eh library @rm -f ${.TARGET} - @${AR} cq ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q` + @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q` ${RANLIB} ${.TARGET} all: libgcc_eh.a @@ -349,7 +351,7 @@ libgcc_eh_p.a: ${EH_OBJS_P} @${ECHO} building profiled gcc_eh library @rm -f ${.TARGET} - @${AR} cq ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q` + @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q` ${RANLIB} ${.TARGET} all: libgcc_eh_p.a .endif Index: contrib/ncurses/configure =================================================================== --- contrib/ncurses/configure (revision 215680) +++ contrib/ncurses/configure (working copy) @@ -4014,7 +4014,10 @@ LIBTOOL= # common library maintenance symbols that are convenient for libtool scripts: -LIB_CREATE='${AR} -cr' +if ( test -z '${ARFLAGS}') ; then + ARFLAGS='-cr' +fi +LIB_CREATE='${AR} ${ARFLAGS}' LIB_OBJECT='${OBJECTS}' LIB_SUFFIX=.a LIB_PREP="$RANLIB" Index: contrib/ncurses/aclocal.m4 =================================================================== --- contrib/ncurses/aclocal.m4 (revision 215680) +++ contrib/ncurses/aclocal.m4 (working copy) @@ -5281,7 +5281,10 @@ LIBTOOL= ]) # common library maintenance symbols that are convenient for libtool scripts: -LIB_CREATE='${AR} -cr' +if ( test -z '${ARFLAGS}') ; then + ARFLAGS='-cr' +fi +LIB_CREATE='${AR} ${ARFLAGS}' LIB_OBJECT='${OBJECTS}' LIB_SUFFIX=.a LIB_PREP="$RANLIB" Index: contrib/cvs/lib/Makefile.in =================================================================== --- contrib/cvs/lib/Makefile.in (revision 215680) +++ contrib/cvs/lib/Makefile.in (working copy) @@ -64,7 +64,7 @@ CONFIG_CLEAN_FILES = fnmatch.h LIBRARIES = $(noinst_LIBRARIES) AR = ar -ARFLAGS = cru +ARFLAGS ?= cru libcvs_a_AR = $(AR) $(ARFLAGS) libcvs_a_DEPENDENCIES = @LIBOBJS@ am_libcvs_a_OBJECTS = argmatch.$(OBJEXT) getdate.$(OBJEXT) \ Index: contrib/cvs/diff/Makefile.in =================================================================== --- contrib/cvs/diff/Makefile.in (revision 215680) +++ contrib/cvs/diff/Makefile.in (working copy) @@ -42,7 +42,7 @@ CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar -ARFLAGS = cru +ARFLAGS ?= cru libdiff_a_AR = $(AR) $(ARFLAGS) libdiff_a_LIBADD = am_libdiff_a_OBJECTS = diff.$(OBJEXT) diff3.$(OBJEXT) \ Index: contrib/ntp/libntp/Makefile.in =================================================================== --- contrib/ntp/libntp/Makefile.in (revision 215680) +++ contrib/ntp/libntp/Makefile.in (working copy) @@ -52,7 +52,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru libntp_a_AR = $(AR) $(ARFLAGS) libntp_a_LIBADD = am__objects_1 = a_md5encrypt$U.$(OBJEXT) adjtime$U.$(OBJEXT) \ Index: contrib/ntp/libparse/Makefile.in =================================================================== --- contrib/ntp/libparse/Makefile.in (revision 215680) +++ contrib/ntp/libparse/Makefile.in (working copy) @@ -52,7 +52,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru libparse_a_AR = $(AR) $(ARFLAGS) libparse_a_LIBADD = am_libparse_a_OBJECTS = parse$U.$(OBJEXT) parse_conf$U.$(OBJEXT) \ Index: contrib/ntp/arlib/Makefile.in =================================================================== --- contrib/ntp/arlib/Makefile.in (revision 215680) +++ contrib/ntp/arlib/Makefile.in (working copy) @@ -51,7 +51,7 @@ CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar -ARFLAGS = cru +ARFLAGS = ?cru libares_a_AR = $(AR) $(ARFLAGS) libares_a_LIBADD = am_libares_a_OBJECTS = arlib.$(OBJEXT) Index: contrib/ntp/ntpd/Makefile.in =================================================================== --- contrib/ntp/ntpd/Makefile.in (revision 215680) +++ contrib/ntp/ntpd/Makefile.in (working copy) @@ -58,7 +58,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru +ARFLAGS ?= cru libntpd_a_AR = $(AR) $(ARFLAGS) libntpd_a_LIBADD = am_libntpd_a_OBJECTS = ntp_control$U.$(OBJEXT) ntp_crypto$U.$(OBJEXT) \ Index: contrib/tcp_wrappers/Makefile =================================================================== --- contrib/tcp_wrappers/Makefile (revision 215680) +++ contrib/tcp_wrappers/Makefile (working copy) @@ -139,7 +139,7 @@ freebsd: @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \ - RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP=-DNETGROUP TLI= \ + RANLIB=ranlib ARFLAGS=$(ARFLAGS) AUX_OBJ= NETGROUP=-DNETGROUP TLI= \ EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DINET6 -DUSE_GETIPNODEBY" \ VSYSLOG= all @@ -401,7 +401,7 @@ RANLIB = ranlib # have ranlib (BSD-ish UNIX) #RANLIB = echo # no ranlib (SYSV-ish UNIX) -ARFLAGS = rv # most systems +ARFLAGS ?= rv # most systems #ARFLAGS= rvs # IRIX 4.0.x AR = ar Index: contrib/sendmail/cf/m4/cfhead.m4 =================================================================== --- contrib/sendmail/cf/m4/cfhead.m4 (revision 215680) +++ contrib/sendmail/cf/m4/cfhead.m4 (working copy) @@ -19,7 +19,7 @@ ##### ifdef(`__win32__', `dnl', `dnl ifdef(`TEMPFILE', `dnl', `define(`TEMPFILE', maketemp(/tmp/cfXXXXXX))dnl -syscmd(sh _CF_DIR_`'sh/makeinfo.sh _CF_DIR_ > TEMPFILE)dnl +syscmd(sh _CF_DIR_`'sh/makeinfo.sh _CF_DIR_ DETERMINISTIC > TEMPFILE)dnl include(TEMPFILE)dnl syscmd(rm -f TEMPFILE)dnl')') ##### Index: contrib/sendmail/cf/sh/makeinfo.sh =================================================================== --- contrib/sendmail/cf/sh/makeinfo.sh (revision 215680) +++ contrib/sendmail/cf/sh/makeinfo.sh (working copy) @@ -16,6 +16,14 @@ # $FreeBSD$ # +# Deterministic header with generic user / hostname and build date omitted +if [ "x$2" = "xtrue" ] +then + echo '#####' built by deterministic@localhost + echo "define(\`__HOST__', localhost)dnl" + exit +fi + usewhoami=0 usehostname=0 for p in `echo $PATH | sed 's/:/ /g'` Index: contrib/gdtoa/makefile =================================================================== --- contrib/gdtoa/makefile (revision 215680) +++ contrib/gdtoa/makefile (working copy) @@ -26,6 +26,7 @@ .SUFFIXES: .c .o CC = cc CFLAGS = -g +ARFLAGS ?= ruv .c.o: $(CC) -c $(CFLAGS) $*.c @@ -49,7 +50,7 @@ strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c strtorQ.c\ strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c sum.c ulp.c $(CC) -c $(CFLAGS) $? - x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x + x=`echo $? | sed 's/\.c/.o/g'` && ar $(ARFLAGS) gdtoa.a $$x && rm $$x ranlib gdtoa.a || true # If your system lacks ranlib, you do not need it. Index: contrib/bind9/configure.in =================================================================== --- contrib/bind9/configure.in (revision 215680) +++ contrib/bind9/configure.in (working copy) @@ -70,7 +70,7 @@ AC_CONFIG_FILES([make/rules make/includes]) AC_PATH_PROG(AR, ar) -ARFLAGS="cruv" +ARFLAGS?="cruv" AC_SUBST(AR) AC_SUBST(ARFLAGS) Index: contrib/gcclibs/libcpp/Makefile.in =================================================================== --- contrib/gcclibs/libcpp/Makefile.in (revision 215680) +++ contrib/gcclibs/libcpp/Makefile.in (working copy) @@ -27,7 +27,7 @@ VPATH = @srcdir@ INSTALL = @INSTALL@ AR = ar -ARFLAGS = cru +ARFLAGS ?= cru ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ Index: contrib/gcclibs/libdecnumber/Makefile.in =================================================================== --- contrib/gcclibs/libdecnumber/Makefile.in (revision 215680) +++ contrib/gcclibs/libdecnumber/Makefile.in (working copy) @@ -27,7 +27,7 @@ VPATH = @srcdir@ INSTALL = @INSTALL@ AR = ar -ARFLAGS = cru +ARFLAGS ?= cru ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ Index: contrib/dtc/Makefile =================================================================== --- contrib/dtc/Makefile (revision 215680) +++ contrib/dtc/Makefile (working copy) @@ -46,7 +46,7 @@ VECHO = : else VECHO = echo " " -ARFLAGS = rc +ARFLAGS ?= rc .SILENT: endif Index: share/mk/bsd.own.mk =================================================================== --- share/mk/bsd.own.mk (revision 215680) +++ share/mk/bsd.own.mk (working copy) @@ -135,6 +135,16 @@ LIBGRP?= ${BINGRP} LIBMODE?= ${NOBINMODE} +# Produce deterministic builds +.if defined(WITH_DETERMINISTIC) +# Remove timestamps, username etc. from archives +ARFLAGS += -D +RANLIB += -D +# random-seed makes sure random elements in C++ binaries are always the +# same across builds. Use relative file path as seed to ensure the seed is +# unique for every source file. +CXXFLAGS += -frandom-seed=\"${.IMPSRC:S/^${.CURDIR}\///}\" +.endif # Share files SHAREDIR?= /usr/share Index: share/mk/bsd.lib.mk =================================================================== --- share/mk/bsd.lib.mk (revision 215680) +++ share/mk/bsd.lib.mk (working copy) @@ -162,13 +162,19 @@ .if defined(LIB) && !empty(LIB) _LIBS= lib${LIB}.a +ARFLAGS= -cq +# Deterministic builds require generic symbol tables +.if defined(WITH_DETERMINISTIC) +ARFLAGS+= -D +.endif + lib${LIB}.a: ${OBJS} ${STATICOBJS} @${ECHO} building static ${LIB} library @rm -f ${.TARGET} .if !defined(NM) - @${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} + @${AR} ${ARFLAGS} ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} .else - @${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} + @${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} .endif ${RANLIB} ${.TARGET} .endif @@ -183,9 +189,9 @@ @${ECHO} building profiled ${LIB} library @rm -f ${.TARGET} .if !defined(NM) - @${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD} + @${AR} ${ARFLAGS} ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD} .else - @${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD} + @${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD} .endif ${RANLIB} ${.TARGET} .endif @@ -228,7 +234,7 @@ lib${LIB}_pic.a: ${SOBJS} @${ECHO} building special pic ${LIB} library @rm -f ${.TARGET} - @${AR} cq ${.TARGET} ${SOBJS} ${ARADD} + @${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} ${RANLIB} ${.TARGET} .endif Index: usr.sbin/bluetooth/bthidd/Makefile =================================================================== --- usr.sbin/bluetooth/bthidd/Makefile (revision 215680) +++ usr.sbin/bluetooth/bthidd/Makefile (working copy) @@ -8,7 +8,7 @@ session.c CFLAGS+= -I${.CURDIR} -DEBUG_FLAGS= -g +#DEBUG_FLAGS= -g DPADD= ${LIBBLUETOOTH} ${LIBUSBHID} LDADD= -lbluetooth -lusbhid Index: etc/sendmail/Makefile =================================================================== --- etc/sendmail/Makefile (revision 215680) +++ etc/sendmail/Makefile (working copy) @@ -15,9 +15,15 @@ .SUFFIXES: .mc .cf +.if defined(WITH_DETERMINISTIC) +DETERMINISTIC=true +.else +DETERMINISTIC=false +.endif + .mc.cf: ${M4FILES} ${RM} ${.TARGET} - ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \ + ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ -DDETERMINISTIC=${DETERMINISTIC} ${SENDMAIL_M4_FLAGS} \ ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET} ${CHMOD} ${ROMODE} ${.TARGET} Index: sys/conf/newvers_deterministic.sh =================================================================== --- sys/conf/newvers_deterministic.sh (revision 0) +++ sys/conf/newvers_deterministic.sh (revision 0) @@ -0,0 +1,104 @@ +#!/bin/sh - +# +# Copyright (c) 1984, 1986, 1990, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)newvers.sh 8.1 (Berkeley) 4/20/94 +# $FreeBSD$ + +TYPE="FreeBSD" +REVISION="9.0" +BRANCH="CURRENT" +if [ "X${BRANCH_OVERRIDE}" != "X" ]; then + BRANCH=${BRANCH_OVERRIDE} +fi +RELEASE="${REVISION}-${BRANCH}" +VERSION="${TYPE} ${RELEASE}" +SYSDIR=$(dirname $0)/.. + +if [ "X${PARAMFILE}" != "X" ]; then + RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ + ${PARAMFILE}) +else + RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ + ${SYSDIR}/sys/param.h) +fi + +b=share/examples/etc/bsd-style-copyright +year=`date '+%Y'` +# look for copyright template +for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b +do + if [ -r "$bsd_copyright" ]; then + COPYRIGHT=`sed \ + -e "s/\[year\]/1992-$year/" \ + -e 's/\[your name here\]\.* /The FreeBSD Project./' \ + -e 's/\[your name\]\.*/The FreeBSD Project./' \ + -e '/\[id for your version control system, if any\]/d' \ + $bsd_copyright` + break + fi +done + +# no copyright found, use a dummy +if [ X"$COPYRIGHT" = X ]; then + COPYRIGHT="/*- + * Copyright (c) 1992-$year The FreeBSD Project. + * All rights reserved. + * + */" +fi + +# add newline +COPYRIGHT="$COPYRIGHT +" + +LC_ALL=C; export LC_ALL +if [ ! -r version ] +then + echo 0 > version +fi + +touch version +v=`cat version` +i=`${MAKE:-make} -V KERN_IDENT` + +cat << EOF > vers.c +$COPYRIGHT +#define SCCSSTR "@(#)${VERSION} #${v}" +#define VERSTR "${VERSION} #${v}\\n deterministic@localhost:${i}\\n" +#define RELSTR "${RELEASE}" + +char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR; +char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR; +char ostype[] = "${TYPE}"; +char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR; +int osreldate = ${RELDATE}; +char kern_ident[] = "${i}"; +EOF + +echo `expr ${v} + 1` > version Index: sys/conf/kern.post.mk =================================================================== --- sys/conf/kern.post.mk (revision 215680) +++ sys/conf/kern.post.mk (working copy) @@ -250,8 +250,13 @@ config.ln env.ln hints.ln vers.ln vnode_if.ln: ${NORMAL_LINT} +.if defined(WITH_DETERMINISTIC) +vers.c: $S/conf/newvers_deterministic.sh $S/sys/param.h ${SYSTEM_DEP} + MAKE=${MAKE} sh $S/conf/newvers_deterministic.sh ${KERN_IDENT} +.else vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} +.endif vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c Index: sys/boot/common/newvers_deterministic.sh =================================================================== --- sys/boot/common/newvers_deterministic.sh (revision 0) +++ sys/boot/common/newvers_deterministic.sh (revision 0) @@ -0,0 +1,43 @@ +#!/bin/sh - +# +# $FreeBSD$ +# $NetBSD: newvers.sh,v 1.1 1997/07/26 01:50:38 thorpej Exp $ +# +# Copyright (c) 1984, 1986, 1990, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)newvers.sh 8.1 (Berkeley) 4/20/94 + +LC_ALL=C; export LC_ALL +h=${HOSTNAME-`hostname`} +#r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` +r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` + +echo "char bootprog_name[] = \"FreeBSD/${3} ${2}\";" > vers.c +echo "char bootprog_rev[] = \"${r}\";" >> vers.c +echo "char bootprog_date[] = \"[not recorded]\";" >> vers.c +echo "char bootprog_maker[] = \"deterministic@${h}\";" >> vers.c Property changes on: sys/boot/common/newvers_deterministic.sh ___________________________________________________________________ Added: svn:executable + * Index: sys/boot/i386/loader/Makefile =================================================================== --- sys/boot/i386/loader/Makefile (revision 215680) +++ sys/boot/i386/loader/Makefile (working copy) @@ -81,9 +81,15 @@ # Pick up ../Makefile.inc early. .include <bsd.init.mk> +.if defined(WITH_DETERMINISTIC) +vers.c: ${.CURDIR}/../../common/newvers_deterministic.sh ${.CURDIR}/../loader/version + sh ${.CURDIR}/../../common/newvers_deterministic.sh ${.CURDIR}/../loader/version \ + ${NEWVERSWHAT} +.else vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \ ${NEWVERSWHAT} +.endif ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ --Apple-Mail-100-900350808-- --Apple-Mail-101-900350821--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8BC47284-261E-40DF-9132-5325BA223492>