aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/validate_map.sh
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-05-28 15:55:39 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-05-28 15:55:39 +0300
commitbd35d903a04c4d388adb4065b0fa271302380895 (patch)
tree4d0d508f4abcfde4bf20afabf9823a3c82a427cd /src/liblzma/validate_map.sh
parentTranslations: Update the Italian translation. (diff)
downloadxz-bd35d903a04c4d388adb4065b0fa271302380895.tar.xz
liblzma: Use symbol versioning.
Symbol versioning is enabled by default on GNU/Linux, other GNU-based systems, and FreeBSD. I'm not sure how stable this is, so it may need backward-incompatible changes before the next release. The idea is that alpha and beta symbols are considered unstable and require recompiling the applications that use those symbols. Once a symbol is stable, it may get extended with new features in ways that don't break compatibility with older ABI & API. The mydist target runs validate_map.sh which should catch some probable problems in liblzma.map. Otherwise I would forget to update the map file for new releases.
Diffstat (limited to '')
-rw-r--r--src/liblzma/validate_map.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/liblzma/validate_map.sh b/src/liblzma/validate_map.sh
new file mode 100644
index 00000000..3aee4668
--- /dev/null
+++ b/src/liblzma/validate_map.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+###############################################################################
+#
+# Check liblzma.map for certain types of errors
+#
+# Author: Lasse Collin
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+###############################################################################
+
+LC_ALL=C
+export LC_ALL
+
+STATUS=0
+
+cd "$(dirname "$0")"
+
+# Get the list of symbols that aren't defined in liblzma.map.
+SYMS=$(sed -n 's/^extern LZMA_API([^)]*) \([a-z0-9_]*\)(.*$/\1;/p' \
+ api/lzma/*.h \
+ | sort \
+ | grep -Fve "$(sed '/[{}:*]/d;/^$/d;s/^ //' liblzma.map)")
+
+# Check that there are no old alpha or beta versions listed.
+VER=$(cd ../.. && sh build-aux/version.sh)
+NAMES=
+case $VER in
+ *alpha | *beta)
+ NAMES=$(sed -n 's/^.*XZ_\([^ ]*\)\(alpha\|beta\) .*$/\1\2/p' \
+ liblzma.map | grep -Fv "$VER")
+ ;;
+esac
+
+# Check for duplicate lines. It can catch missing dependencies.
+DUPS=$(sort liblzma.map | sed '/^$/d;/^global:$/d' | uniq -d)
+
+# Print error messages if needed.
+if test -n "$SYMS$NAMES$DUPS"; then
+ echo
+ echo 'validate_map.sh found problems from liblzma.map:'
+ echo
+
+ if test -n "$SYMS"; then
+ echo 'liblzma.map lacks the following symbols:'
+ echo "$SYMS"
+ echo
+ fi
+
+ if test -n "$NAMES"; then
+ echo 'Obsolete alpha or beta version names:'
+ echo "$NAMES"
+ echo
+ fi
+
+ if test -n "$DUPS"; then
+ echo 'Duplicate lines:'
+ echo "$DUPS"
+ echo
+ fi
+
+ STATUS=1
+fi
+
+# Exit status is 1 if problems were found, 0 otherwise.
+exit "$STATUS"