ar and ranlib -D

Warner Losh imp at bsdimp.com
Thu Apr 10 15:46:04 UTC 2014


My only concern is with the %POSIX section. That change isn’t needed for reproducible
builds.

Warner


On Apr 10, 2014, at 9:06 AM, Dag-Erling Smørgrav <des at des.no> wrote:

> 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
> -- 
> Dag-Erling Smørgrav - des at des.no
> 
> 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		?=
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"



More information about the freebsd-arch mailing list