]> git.saurik.com Git - wxWidgets.git/blame - lib/abicheck.sh
Correct printf() format specifiers for long variables in life demo.
[wxWidgets.git] / lib / abicheck.sh
CommitLineData
d075fb7a
FM
1#!/bin/bash
2
3# Script originally based on GTK+'s own abicheck.sh; it should be run anytime
4# there is a change in the stable branch of wxWidgets which could lead to an
5# ABI breakage and thus result in a binary-incompatible change (see tech docs).
6#
7# $Id$
8
9
10expected_abi_file="expected_abi"
11actual_abi_file="actual_abi"
12
13if [[ "$1" == "--generate" ]]; then
14
15 # IMPORTANT: we need a shared build of wxWidgets to proceed
16 if [[ $(echo *.so) == "*.so" ]]; then
17 echo "No shared objects (*.so) were found... aborting"
18 exit 1
19 fi
20
21 # generated the "expected ABI" for later comparison
22 rm -f $expected_abi_file
23 for library in *.so; do
24 # NOTE: don't use -C option as otherwise cut won't work correctly
25 nm -D -g --defined-only $library | cut -d ' ' -f 3 | sort >>$expected_abi_file
26 done
27
28 echo "Expected wxWidgets ABI generated in \"$expected_abi_file\"..."
29
30elif [[ -z "$1" ]]; then
31
32 if [[ ! -f "$expected_abi_file" ]]; then
33 echo "The file containing the expected wxWidgets ABI '$expected_abi_file' does not exist!"
34 echo "Please generate it first using the '--generate' option"
35 exit 1
36 fi
37
38 echo "Comparing actual ABI with the expected ABI (loading it from \"$expected_abi_file\")..."
39
40 # IMPORTANT: we need a shared build of wxWidgets to do the check
41 if [[ $(echo *.so) == "*.so" ]]; then
42 echo "No shared objects (*.so) were found... aborting"
43 exit 1
44 fi
45
46 rm -f $actual_abi_file
47 for library in *.so; do
48 # NOTE: don't use -C option as otherwise cut won't work correctly
49 nm -D -g --defined-only $library | cut -d ' ' -f 3 | sort >>$actual_abi_file
50 done
51
52 result=`diff -u $expected_abi_file $actual_abi_file`
53
54 if [[ -z "$result" ]]; then
55 echo "No binary (in)compatible changes were found."
56 else
57 echo "========================================================="
58 echo "WARNING: Possible binary-incompatible changes were found:"
59 echo "========================================================="
60 echo
61 echo "$result"
62
63 # this doesn't necessarly indicate that binary compatibility was surely
64 # broken; e.g. adding non-virtual methods will generate a new line in the
65 # $actual_abi_file but that's a compatible change.
66 fi
67
68else
69
70 echo "Usage: $0 [--generate]"
71 echo "When running without options, compares the wxWidgets ABI saved in '$expected_abi_file'"
72 echo "with the current ABI of the .so files of the working directory."
73 echo "When --generate is given, saves in '$expected_abi_file' the ABI of the .so files"
74 echo "(for later comparisons)."
75
76fi
77