~ubuntu-branches/debian/sid/make-doc-non-dfsg/sid

« back to all changes in this revision

Viewing changes to debian/common/checklibs

  • Committer: Bazaar Package Importer
  • Author(s): Manoj Srivastava
  • Date: 2008-06-02 09:41:12 UTC
  • Revision ID: james.westby@ubuntu.com-20080602094112-t5utg7hy4l11lwqv
Tags: 3.81-4
* Record the fact that this package has moved to a new git repository.
* Move to the new, make -j friendly targets in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh 
 
2
#                               -*- Mode: Sh -*- 
 
3
# checklibs.sh --- 
 
4
# Author           : Manoj Srivastava ( srivasta@glaurung.internal.golden-gryphon.com ) 
 
5
# Created On       : Fri Sep 29 15:36:22 2006
 
6
# Created On Node  : glaurung.internal.golden-gryphon.com
 
7
# Last Modified By : Manoj Srivastava
 
8
# Last Modified On : Fri Sep 29 22:53:27 2006
 
9
# Last Machine Used: glaurung.internal.golden-gryphon.com
 
10
# Update Count     : 43
 
11
# Status           : Unknown, Use with caution!
 
12
# HISTORY          : 
 
13
# Description      : 
 
14
 
15
# arch-tag: 8ba11489-77fa-45a0-92c4-9c5b162ee119
 
16
 
17
# This program is free software; you can redistribute it and/or modify
 
18
# it under the terms of the GNU General Public License as published by
 
19
# the Free Software Foundation; either version 2 of the License, or
 
20
# (at your option) any later version.
 
21
#
 
22
# This program is distributed in the hope that it will be useful,
 
23
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
24
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
25
# GNU General Public License for more details.
 
26
#
 
27
# You should have received a copy of the GNU General Public License
 
28
# along with this program; if not, write to the Free Software
 
29
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
30
 
31
 
 
32
# Make sure we abort on error
 
33
set -e
 
34
progname="$(basename \"$0\")"
 
35
 
 
36
trap 'rm -f search_patterns.txt;' ALRM HUP INT PIPE TERM ABRT FPE BUS QUIT SEGV ILL EXIT
 
37
 
 
38
# Find all undefined symbols in all ELF objects in this tree
 
39
readelf -s -D -W $(find . -type f -print0 | xargs -0r  file | grep " ELF" | \
 
40
 awk '{print $1}' | sed -e 's/:$//') | grep UND | grep -v LOCAL |
 
41
  perl -ple 's/.*\s(\S+)\s*$/\^$1\$/g' | sort -u > search_patterns.txt;
 
42
 
 
43
# Find all the libraries needed in this tree 
 
44
objdump -T --private-headers $(find . -type f -print0  | xargs -0r file | grep " ELF" | \
 
45
  awk '{print $1}' | sed -e 's/:$//') | grep NEEDED | sort -u | awk '{print $2}' | 
 
46
    while read lib; do
 
47
        # For each library, see where it lives o the file system
 
48
        LIB=
 
49
        for library_dir in "/lib" "/usr/lib" $EXTRA_LIBRARY_PATHS; do
 
50
            if [ -e "$library_dir/$lib" ]; then
 
51
                 LIB="$library_dir/$lib";
 
52
                 break
 
53
            fi
 
54
        done
 
55
        if [ -z "$LIB" ]; then
 
56
            echo >&2 "Can't find $lib"
 
57
            continue
 
58
        fi
 
59
        # If we fond the library, find what symbols it defines, and if these symbols
 
60
        # are some that we need
 
61
        if readelf -s -D -W $LIB | grep -v UND | perl -ple 's/.*\s(\S+)\s*$/$1/g' | \
 
62
            sort -u | grep -q -f search_patterns.txt ; then
 
63
            # Library provides at least some symbols we need
 
64
            if [ -n "$DEBUG" ]; then echo "Found $LIB"; fi
 
65
        else
 
66
            # Library does not provide any symbols we need
 
67
            echo "$LIB" ;
 
68
        fi
 
69
done
 
70
 
 
71
# Get rid of the intermediate file
 
72
rm -f search_patterns.txt;
 
73
exit 0
 
74