]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - tools/tools/shlib-compat/shlib-compat-dirs.sh
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / tools / tools / shlib-compat / shlib-compat-dirs.sh
1 #!/bin/sh -e
2 #
3 # $FreeBSD$
4
5 SHLIB_COMPAT=$(dirname $0)/shlib-compat.py
6
7 if [ $# -lt 3 ]; then
8         echo "Usage: $0 orig-dir new-dir output-dir"
9         exit 1
10 fi
11
12 orig=$1
13 new=$2
14 out=$3
15 shift 3
16
17 remove_empty() {
18         local i
19         for i in $*; do
20                 [ -s $i ] || rm -f $i
21         done
22 }
23
24 test_file() {
25         local i
26         for i in $*; do
27                 if [ \! -f $1 ]; then
28                         echo "file not found: $1"
29                         return 1
30                 fi
31         done
32 }
33
34 rorig=`realpath $orig`
35 rnew=`realpath $new`
36 list=`(cd $rorig; ls; cd $rnew; ls) | sort -u`
37 for i in $list; do
38         echo $i
39         test_file $orig/$i $new/$i || continue
40         $SHLIB_COMPAT --out-orig $out/$i.orig.c --out-new $out/$i.new.c -v "$@" \
41                 $orig/$i $new/$i > $out/$i.cmp 2> $out/$i.err || true
42         remove_empty $out/$i.orig.c $out/$i.new.c $out/$i.cmp $out/$i.err
43         if [ -f $out/$i.orig.c -a -f $out/$i.new.c ]; then
44                 astyle --quiet --style=bsd -k3 $out/$i.orig.c $out/$i.new.c
45                 rm -f $out/$i.orig.c.orig $out/$i.new.c.orig
46                 diff -u $out/$i.orig.c $out/$i.new.c > $out/$i.diff || true
47         fi
48 done