2
#---------------------------------------------------------------------
3
# Script to run abi-compliance-checker to ensure ABI not broken.
4
#---------------------------------------------------------------------
5
# Copyright (C) 2013 Canonical Ltd.
7
# Author: James Hunt <james.hunt@canonical.com>
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, version 3 of the License.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#---------------------------------------------------------------------
26
echo "ERROR: $msg" >&2
30
build_dir="@abs_builddir@"
31
source_dir="@abs_srcdir@"
32
acc="@abi_compliance_checker@"
33
acc_descriptor="@abi_build_XML@"
34
libupstart_libtool="@libupstart@"
35
lib_prefix="${libupstart_libtool%.la}"
36
libupstart_lt_version="@libupstart_version@"
37
old_abi="@abi_official@"
39
# convert libtool(1) version to dotted form
40
dotted_version=$(echo "$libupstart_lt_version"|tr ':' '.')
42
libupstart_path="$build_dir/$libupstart_libtool"
44
echo "Checking ABI for $lib_prefix"
47
for file in "$libupstart_path" "$old_abi"
49
[ -f "$file" ] || die "file $file not found"
52
# Install the library to a temporary location since we need the
53
# full path to the shared library to pass to abi-compliance-checker.
54
install_dir=$(mktemp -d --tmpdir="$build_dir")
55
[ -z "$install_dir" ] && \
56
die "failed to create temporary install directory"
58
libtool --mode=install install \
59
"$libupstart_libtool" "$install_dir" >/dev/null 2>&1
61
abi_dump_dir=$(mktemp -d --tmpdir="$build_dir")
62
[ -z "$abi_dump_dir" ] && \
63
die "failed to create temporary dump directory"
65
abi_dump_path="$abi_dump_dir/${lib_prefix}_${dotted_version}.abi.tar.gz"
67
installed_so="$install_dir/$(echo "$lib_prefix"|cut -d\. -f1).so"
69
[ -f "$installed_so" ] || die "cannot find $installed_so"
71
# generate a descriptor for the newly-built library version
72
"$acc" -library "$lib_prefix" -dump "$acc_descriptor" -dump-path "$abi_dump_path"
74
new_abi="$abi_dump_dir/${lib_prefix}_${dotted_version}.abi.tar.gz"
75
[ -f "$new_abi" ] || die "cannot find $new_abi"
78
"$acc" -library "$lib_prefix" -old "$old_abi" -new "$new_abi"
81
libtool --mode=uninstall \
82
rm "$install_dir/$libupstart_libtool" >/dev/null 2>&1
84
rm -rf "$abi_dump_dir" "$build_dir/logs" "$install_dir"
86
# HTML report generated by $acc
87
rm -rf compat_reports/