1#!/bin/sh -e 2# 3# $FreeBSD$ 4 5SHLIB_COMPAT=$(dirname $0)/shlib-compat.py 6 7if [ $# -lt 3 ]; then 8 echo "Usage: $0 orig-dir new-dir output-dir" 9 exit 1 10fi 11 12orig=$1 13new=$2 14out=$3 15shift 3 16 17remove_empty() { 18 local i 19 for i in $*; do 20 [ -s $i ] || rm -f $i 21 done 22} 23 24test_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 34rorig=`realpath $orig` 35rnew=`realpath $new` 36list=`(cd $rorig; ls; cd $rnew; ls) | sort -u` 37for 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 48done 49