svn commit: r213643 - head/usr.bin/ar

Erik Cederstrand erik at cederstrand.dk
Sun Oct 10 08:19:38 UTC 2010


Den 10/10/2010 kl. 00.11 skrev Bruce Evans:

> On Sat, 9 Oct 2010, Erik Cederstrand wrote:
>>> 
>>> Thanks!  Has anyone looked at the feasibility of setting AR?=ar -D in
>>> sys.mk?  I will probably try this when I get my scratch box up again.
> 
> I hope not.  The default behaviour should not be changed by default.

The reason I came up with this patch was that I wanted to do binary diffs on FreeBSD distributions to, among other reasons, record witch files are actually affected between commits. Except for a few edge-cases like recording a build timestamp, it seems wrong in my view for FreeBSD to not produce deterministic distributions on identical source code.

>> I'm looking into this now, as I needed the patch to do binary diffs on builds. One problem is that ARFLAGS is overridden a lot of places in contrib/ code:
>> 
>> contrib/cvs/lib/Makefile.in:67:ARFLAGS=cru
>> contrib/cvs/diff/Makefile.in:45:ARFLAGS=cru
>> contrib/ntp/libntp/Makefile.in:55:ARFLAGS=cru
>> contrib/ntp/libparse/Makefile.in:55:ARFLAGS=cru
>> contrib/ntp/arlib/Makefile.in:54:ARFLAGS=cru
>> contrib/ntp/ntpd/Makefile.in:61:ARFLAGS=cru
>> contrib/tcp_wrappers/Makefile:95:ARFLAGS=rv
>> contrib/tcp_wrappers/Makefile:101:ARFLAGS=rv
>> [...]
>> contrib/tcp_wrappers/Makefile:404:ARFLAGS=rv
>> contrib/bind9/configure.in:73:ARFLAGS=cruv
>> contrib/gcclibs/libcpp/Makefile.in:30:ARFLAGS=cru
>> contrib/gcclibs/libdecnumber/Makefile.in:30:ARFLAGS=cru
>> contrib/dtc/Makefile:49:ARFLAGS=rc
>> crypto/heimdal/appl/ftp/common/Makefile.in:93:ARFLAGS=cru
>> crypto/heimdal/appl/telnet/libtelnet/Makefile.in:93:ARFLAGS=cru
>> crypto/heimdal/lib/45/Makefile.in:101:ARFLAGS=cru
>> crypto/openssl/Makefile.org:66:ARFLAGS=
>> crypto/openssl/Makefile:68:ARFLAGS=
> 
> Something like this seems to be needed, since the default flags in sys.mk
> of:
> 
>> share/mk/sys.mk:36:ARFLAGS?=-rv
>> share/mk/sys.mk:38:ARFLAGS?=rl
>> usr.bin/make/PSD.doc/tutorial.ms:2968:ARFLAGS?=crl
> 
> are almost as bad as -D there.  -rv is for the %POSIX case.  The -v
> in it makes it wrong for most uses, especially when make output is
> supposed to be quieted by -s.  At least it uses the newfangled option
> syntax (starting with a '-').  rl is for the usual case.  The `l' flag
> is bogus since it was documented as accepted but not used.  Now it
> seems to be undocumented, but still accepted but not used.  The `r'
> flag is normally wanted, but most places also want 'c' and possibly
> 'u'.
> 
> Having anything in the default ARFLAGS is bad since (except in the
> %POSIX case) its contents is undocumented so it is hard to tell what
> precautions should be taken to avoid bad things in it.  There seems
> to be no way to cancel bad things in it by adding to it, so makefiles
> wanting to use the default would have to use something like
> substitutions in it.  E.g.:
> 
> %%%
> ARFLAGS:=	${ARFLAGS:S/l//}	# remove nonsense flag 'l'
> ARFLAGS:=	${ARFLAGS:S/D//}	# remove unwanted flag 'v'
> foo:
> 	echo ${ARFLAGS}
> %%%
> 
> But it is easier to blow away the garbage using ARFLAGS=cru.  There were
> few or no flags like -D that could reasonably set outside of sys.mk,
> according to user or system preferences, so that no Makefile should touch
> them.  Perhaps -v is another one -- setting this wouldn't change the
> created archives, but might be useful for debugging.
> 
> The primary user of ${AR} for FreeBSD builds, namely bsd.lib.mk, doesn't
> even use ${ARFLAGS}, so it is missing from the above list.  It uses the
> literal `cq' whenever it uses the non-literal ${AR}.  Perhaps ar is often
> spelled `ar' too.


I'm a real beginner here. As I read the manuals (GNU ar and BSD ar), the only flags that really control archive contents on archive creation is 'q' and 'r'. The 'l' is ignored, 'c' and 'v' control verbosity, and 'u' and 's' are for performance purposes that are largely irrelevant today (extracting every single *.a file and recreating it wit ar -rD takes less than 10 secs on my slow machine). Is there any negative impact at runtime from having all archives created with either -rD or -qD (ignoring verbosity at build time for now)?

Thanks,
Erik


More information about the svn-src-all mailing list