Convert the quick setup chapter to AsciiDoc and start converting its
[metze/wireshark/wip.git] / tools / compare-abis.sh
1 #!/bin/bash
2 #
3 # Compare ABIs of two Wireshark working copies
4 #
5 # Copyright 2013 Balint Reczey <balint at balintreczey.hu>
6 #
7 # $Id$
8 #
9 # Wireshark - Network traffic analyzer
10 # By Gerald Combs <gerald@wireshark.org>
11 # Copyright 1998 Gerald Combs
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26
27 # Tested with abi-compliance-checker 1.96.1
28
29 function acc () {
30         LIBNAME=$1
31         DIR=$2
32         # compare only dumped ABI descriptions first, then fall back to full comparison
33         # if no difference is found
34         if abi-compliance-checker -l $LIBNAME \
35                 -d1 $V1_PATH/$DIR/$REL_DUMP_PATH/$LIBNAME.abi.tar.gz \
36                 -d2 $V2_PATH/$DIR/$REL_DUMP_PATH/$LIBNAME.abi.tar.gz ; then
37                 abi-compliance-checker -l $LIBNAME \
38                         -d1 $V1_PATH/$DIR/abi-descriptor.xml -relpath1 $V1_PATH/$DIR \
39                         -v1 `ls  $V1_PATH/$DIR/$REL_LIB_PATH/$LIBNAME.so.?.*.*|sed 's/.*\.so\.//'` \
40                         -d2 $V2_PATH/$DIR/abi-descriptor.xml -relpath2 $V2_PATH/$DIR \
41                         -v2 `ls  $V2_PATH/$DIR/$REL_LIB_PATH/$LIBNAME.so.?.*.*|sed 's/.*\.so\.//'` \
42                         -check-implementation
43         fi
44 }
45
46 V1_PATH=$1
47 V2_PATH=$2
48
49 # both working copies have to be built first with autotools or with cmake
50 # make -C $V1_PATH all dumpabi
51 # make -C $V2_PATH all dumpabi
52
53 if test -d $V1_PATH/lib; then
54         REL_LIB_PATH=../lib
55         REL_DUMP_PATH=.
56 else
57         REL_LIB_PATH=.libs
58         REL_DUMP_PATH=.libs
59 fi
60
61 acc libwiretap wiretap $V1_PATH $V2_PATH
62 RET=$?
63 acc libwsutil wsutil $V1_PATH $V2_PATH
64 RET=$(($RET + $?))
65 acc libwireshark epan $V1_PATH $V2_PATH
66 exit $(($RET + $?))
67