1 | #!/bin/sh
|
---|
2 |
|
---|
3 | #
|
---|
4 | # abi_checks.sh - check for possible abi changes
|
---|
5 | #
|
---|
6 | # Copyright (C) 2009 Michael Adam <obnox@samba.org>
|
---|
7 | #
|
---|
8 | # This program is free software; you can redistribute it and/or modify it
|
---|
9 | # under the terms of the GNU General Public License as published by the Free
|
---|
10 | # Software Foundation; either version 3 of the License, or (at your option)
|
---|
11 | # any later version.
|
---|
12 | #
|
---|
13 | # This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
16 | # more details.
|
---|
17 | #
|
---|
18 | # You should have received a copy of the GNU General Public License along with
|
---|
19 | # this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
20 | #
|
---|
21 |
|
---|
22 | #
|
---|
23 | # USAGE: abi_checks.sh LIBNAME header1 [header2 ...]
|
---|
24 | #
|
---|
25 | # This script creates symbol and signature lists from the provided header
|
---|
26 | # files with the aid of the mksyms.sh and mksigs.pl scripts (saved as
|
---|
27 | # $LIBNAME.exports.check and $LIBNAME.sigatures.check). It then compares
|
---|
28 | # the resulting files with the files $LIBNAME.exports and $LIBNME.signatures
|
---|
29 | # which it expects to find in the current directory.
|
---|
30 | #
|
---|
31 |
|
---|
32 | LANG=C; export LANG
|
---|
33 | LC_ALL=C; export LC_ALL
|
---|
34 | LC_COLLATE=C; export LC_COLLATE
|
---|
35 |
|
---|
36 | script=$0
|
---|
37 | dir_name=$(dirname ${script})
|
---|
38 |
|
---|
39 | if test x"$1" = "x" ; then
|
---|
40 | echo "USAGE: ${script} libname header [header ...]"
|
---|
41 | exit 1
|
---|
42 | fi
|
---|
43 |
|
---|
44 | libname="$1"
|
---|
45 | shift
|
---|
46 |
|
---|
47 | if test x"$1" = "x" ; then
|
---|
48 | echo "USAGE: ${script} libname header [header ...]"
|
---|
49 | exit 1
|
---|
50 | fi
|
---|
51 |
|
---|
52 | headers="$*"
|
---|
53 |
|
---|
54 | exports_file=${libname}.exports
|
---|
55 | exports_file_check=${exports_file}.check
|
---|
56 | signatures_file=${libname}.signatures
|
---|
57 | signatures_file_check=${signatures_file}.check
|
---|
58 |
|
---|
59 |
|
---|
60 | ${dir_name}/mksyms.sh awk ${exports_file_check} ${headers} 2>&1 > /dev/null
|
---|
61 |
|
---|
62 | cat ${headers} | ${dir_name}/mksigs.pl > ${signatures_file_check} 2> /dev/null
|
---|
63 |
|
---|
64 | normalize_exports_file() {
|
---|
65 | filename=$1
|
---|
66 | cat ${filename} \
|
---|
67 | | sed -e 's/^[ \t]*//g' \
|
---|
68 | | sed -e 's/^$//g' \
|
---|
69 | | sed -e 's/^#.*$//g' \
|
---|
70 | | sort | uniq > ${filename}.sort
|
---|
71 | }
|
---|
72 |
|
---|
73 | normalize_exports_file ${exports_file}
|
---|
74 | normalize_exports_file ${exports_file_check}
|
---|
75 |
|
---|
76 | normalize_exports_file ${signatures_file}
|
---|
77 | normalize_exports_file ${signatures_file_check}
|
---|
78 |
|
---|
79 | diff -u ${exports_file}.sort ${exports_file_check}.sort
|
---|
80 | if test "x$?" != "x0" ; then
|
---|
81 | echo "WARNING: possible ABI change detected in exports!"
|
---|
82 | else
|
---|
83 | echo "exports check: OK"
|
---|
84 | fi
|
---|
85 |
|
---|
86 | diff -u ${signatures_file}.sort ${signatures_file_check}.sort
|
---|
87 | if test "x$?" != "x0" ; then
|
---|
88 | echo "WARNING: possible ABI change detected in signatures!"
|
---|
89 | else
|
---|
90 | echo "signatures check: OK"
|
---|
91 | fi
|
---|