Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Apr 2014 17:06:09 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        arch@freebsd.org
Subject:   ar and ranlib -D
Message-ID:  <86eh15usv2.fsf@nine.des.no>

next in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

The attached patch adds -D to ARFLAGS and introduces RANLIBFLAGS which
defaults to -D.  This ensures that all timestamps inside static
libraries in the base system are hardcoded to 0 (aka the epoch), which
is a huge step towards fully reproducible builds.  Any objections?

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=ar-D.diff

Index: share/mk/bsd.lib.mk
===================================================================
--- share/mk/bsd.lib.mk	(revision 264317)
+++ share/mk/bsd.lib.mk	(working copy)
@@ -172,7 +172,7 @@
 .else
 	@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
 .endif
-	${RANLIB} ${.TARGET}
+	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
 .endif
 
 .if !defined(INTERNALLIB)
@@ -189,7 +189,7 @@
 .else
 	@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
 .endif
-	${RANLIB} ${.TARGET}
+	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
 .endif
 
 .if defined(SHLIB_NAME) || \
@@ -246,7 +246,7 @@
 	@${ECHO} building special pic ${LIB} library
 	@rm -f ${.TARGET}
 	@${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
-	${RANLIB} ${.TARGET}
+	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
 .endif
 
 .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
Index: share/mk/sys.mk
===================================================================
--- share/mk/sys.mk	(revision 264317)
+++ share/mk/sys.mk	(working copy)
@@ -37,11 +37,12 @@
 
 AR		?=	ar
 .if defined(%POSIX)
-ARFLAGS		?=	-rv
+ARFLAGS		?=	-rDv
 .else
-ARFLAGS		?=	cru
+ARFLAGS		?=	crD
 .endif
 RANLIB		?=	ranlib
+RANLIBFLAGS	?=	-D
 
 AS		?=	as
 AFLAGS		?=

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86eh15usv2.fsf>