#!/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. # ############################################################################### setglobal LC_ALL = 'C' export LC_ALL setglobal STATUS = '0' cd $[dirname $0] # Get the list of symbols that aren't defined in liblzma.map. setglobal 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. setglobal VER = $[cd ../.. && sh build-aux/version.sh] setglobal NAMES = '' match $VER { with *alpha | *beta setglobal NAMES = $[sed -n 's/^.*XZ_\([^ ]*\)\(alpha\|beta\) .*$/\1\2/p' \ liblzma.map | grep -Fv $VER] } # Check for duplicate lines. It can catch missing dependencies. setglobal DUPS = $[sort liblzma.map | sed '/^$/d;/^global:$/d' | uniq -d] # Print error messages if needed. if test -n "$SYMS$NAMES$DUPS" { echo echo 'validate_map.sh found problems from liblzma.map:' echo if test -n $SYMS { echo 'liblzma.map lacks the following symbols:' echo $SYMS echo } if test -n $NAMES { echo 'Obsolete alpha or beta version names:' echo $NAMES echo } if test -n $DUPS { echo 'Duplicate lines:' echo $DUPS echo } setglobal STATUS = '1' } # Exit status is 1 if problems were found, 0 otherwise. exit "$STATUS"