xref: /netbsd-src/share/mk/compare-lib-lists (revision 249752ac155158bd356d2beaa995dce775fa17b5)
1a3a94da6Schristos#!/bin/sh
2*249752acSchristos# $NetBSD: compare-lib-lists,v 1.3 2019/11/18 16:23:28 christos Exp $
3a3a94da6Schristos#
44d3961b8Schristos# Q+D script to print the library lists for comparison between whats in the
5*249752acSchristos# bsd.prog.mk file and bsd.README (this matches)
6*249752acSchristos#
7*249752acSchristos# Also compare the list of LIB variables we create against the actually
8*249752acSchristos# installed archives (this does *not* match -- yet)
9a3a94da6Schristos
10a3a94da6Schristosprog=$(basename "$0")
11a3a94da6Schristos
12a3a94da6SchristosRD=/tmp/${prog}.rd.$$
13a3a94da6SchristosMK=/tmp/${prog}.mk.$$
144d3961b8SchristosIN=/tmp/${prog}.in.$$
15*249752acSchristosLB=/tmp/${prog}.lb.$$
16a3a94da6Schristos
17*249752acSchristostrap "rm -f ${MK} ${RD} ${IN} ${LB}" 0 1 2 3 15
18a3a94da6Schristos
19a3a94da6Schristosmake -f - all << \EOF > ${MK}
20a3a94da6Schristos.include <bsd.prog.mk>
21a3a94da6Schristos
22a3a94da6Schristosall:
23a3a94da6Schristos.for l in ${_LIBLIST}
24a3a94da6Schristos	@echo $l
25a3a94da6Schristos.endfor
26a3a94da6Schristos.for l in crt0.o crti.o crti.o crtn.o
27a3a94da6Schristos	@echo $l
28a3a94da6Schristos.endfor
29a3a94da6Schristos.for l in ${_X11LIBLIST}
30a3a94da6Schristos	@echo $l
31a3a94da6Schristos.endfor
32a3a94da6SchristosEOF
33a3a94da6Schristos
34a3a94da6Schristosgrep '	LIB' bsd.README | \
35a3a94da6Schristos    grep DESTDIR | \
36a3a94da6Schristos    sed -e 's/.*lib\([a-zA-Z0-9_+\-]*\)\.a$/\1/' > ${RD}
37a3a94da6Schristos
38a3a94da6Schristospaste ${MK} ${RD}
394d3961b8Schristos
404d3961b8Schristosecho "------"
414d3961b8Schristos
42*249752acSchristoscat << \EOF | make -f - xall | sort > ${IN}
434d3961b8Schristos.include <bsd.prog.mk>
444d3961b8Schristos
454d3961b8Schristosxall:
464d3961b8Schristos.for _lib in ${_LIBLIST}
474d3961b8Schristos	@echo ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
484d3961b8Schristos.endfor
494d3961b8Schristos.for _lib in ${_X11LIBLIST}
504d3961b8Schristos	@echo ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
514d3961b8Schristos.endfor
524d3961b8SchristosEOF
53*249752acSchristos
54*249752acSchristosls -1 /usr/lib/*.a /usr/X11R7/lib/*.a | \
55*249752acSchristos    egrep -v '(_p|_pic|_g)\.a' | sort > ${LB}
56*249752acSchristos
57*249752acSchristospaste ${IN} ${LB}
58