tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: final steps for reproduceable builds.



"Perry E. Metzger" <perry%piermont.com@localhost> writes:
> I'll conditionalize the ar stuff on AR_DFLAG being set to yes and set
> that in build.sh in the manner of BUILDSEED, how's that?

New patch (untested -- I'm running a build now) -- comments?

Perry

Index: bsd.README
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.README,v
retrieving revision 1.247
diff -u -r1.247 bsd.README
--- bsd.README  25 Feb 2009 20:36:45 -0000      1.247
+++ bsd.README  10 Mar 2009 00:47:47 -0000
@@ -938,6 +938,15 @@
 
 LIBDIR         Target directory for libraries.
 
+AR_DFLAG       Normally, ar(1) sets the timestamps, uid, gid and
+               permissions in files inside its archives to those of
+               the file it was fed. This leads to non-reproduceable
+               builds. If AR_DFLAG is set to "yes" (default is "no")
+               then the "D" flag is passed to ar, causing the
+               timestamp, uid and gid to be zeroed and the file
+               permissions to be set to 644. This allows .a files
+               from different builds to be bit identical.
+
 SHLIBINSTALLDIR        Target directory for shared libraries if ${USE_SHLIBDIR}
                is not "no".
 
Index: bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.295
diff -u -r1.295 bsd.lib.mk
--- bsd.lib.mk  17 Jan 2009 12:09:58 -0000      1.295
+++ bsd.lib.mk  10 Mar 2009 00:47:47 -0000
@@ -438,21 +438,30 @@
 
 realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
 
+AR_DFLAG?=no
+
+.if ${AR_DFLAG} == "yes"
+_ARFL=crsD
+_IRANLIB=""
+.else
+_ARFL=crs
+_IRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
+.endif
+
 # If you change this, please consider reflecting the change in
 # the override in sys/rump/Makefile.rump.
 .if !target(__archivebuild)
 __archivebuild: .USE
        ${_MKTARGET_BUILD}
        rm -f ${.TARGET}
-       ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
-       ${RANLIB} ${.TARGET}
+       ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
 .endif
 
 .if !target(__archiveinstall)
 __archiveinstall: .USE
        ${_MKTARGET_INSTALL}
        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-           ${empty(PRESERVE):?-a "${RANLIB} -t":} ${.ALLSRC} ${.TARGET}
+           ${_IRANLIB} ${.ALLSRC} ${.TARGET}
 .endif
 
 __archivesymlinkpic: .USE


Home | Main Index | Thread Index | Old Index