11.1Schristos#!/bin/sh
21.3Schristos# $NetBSD: compare-lib-lists,v 1.3 2019/11/18 16:23:28 christos Exp $
31.1Schristos#
41.2Schristos# Q+D script to print the library lists for comparison between whats in the
51.3Schristos# bsd.prog.mk file and bsd.README (this matches)
61.3Schristos#
71.3Schristos# Also compare the list of LIB variables we create against the actually
81.3Schristos# installed archives (this does *not* match -- yet)
91.1Schristos
101.1Schristosprog=$(basename "$0")
111.1Schristos
121.1SchristosRD=/tmp/${prog}.rd.$$
131.1SchristosMK=/tmp/${prog}.mk.$$
141.2SchristosIN=/tmp/${prog}.in.$$
151.3SchristosLB=/tmp/${prog}.lb.$$
161.1Schristos
171.3Schristostrap "rm -f ${MK} ${RD} ${IN} ${LB}" 0 1 2 3 15
181.1Schristos
191.1Schristosmake -f - all << \EOF > ${MK}
201.1Schristos.include <bsd.prog.mk>
211.1Schristos
221.1Schristosall:
231.1Schristos.for l in ${_LIBLIST}
241.1Schristos	@echo $l
251.1Schristos.endfor
261.1Schristos.for l in crt0.o crti.o crti.o crtn.o
271.1Schristos	@echo $l
281.1Schristos.endfor
291.1Schristos.for l in ${_X11LIBLIST}
301.1Schristos	@echo $l
311.1Schristos.endfor
321.1SchristosEOF
331.1Schristos
341.1Schristosgrep '	LIB' bsd.README | \
351.1Schristos    grep DESTDIR | \
361.1Schristos    sed -e 's/.*lib\([a-zA-Z0-9_+\-]*\)\.a$/\1/' > ${RD}
371.1Schristos
381.1Schristospaste ${MK} ${RD}
391.2Schristos
401.2Schristosecho "------"
411.2Schristos
421.3Schristoscat << \EOF | make -f - xall | sort > ${IN}
431.2Schristos.include <bsd.prog.mk>
441.2Schristos
451.2Schristosxall:
461.2Schristos.for _lib in ${_LIBLIST}
471.2Schristos	@echo ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
481.2Schristos.endfor
491.2Schristos.for _lib in ${_X11LIBLIST}
501.2Schristos	@echo ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
511.2Schristos.endfor
521.2SchristosEOF
531.3Schristos
541.3Schristosls -1 /usr/lib/*.a /usr/X11R7/lib/*.a | \
551.3Schristos    egrep -v '(_p|_pic|_g)\.a' | sort > ${LB}
561.3Schristos
571.3Schristospaste ${IN} ${LB}
58