*** empty log message ***
[platform/upstream/rpm.git] / autodeps / osf.req
1 #! /usr/bin/ksh
2
3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # This file is distributed under the terms of the GNU Public License
5 #
6 # find-requires is part of RPM, the RedHat Package Manager.  find-requires
7 # reads a list of full pathnames (in a package) on stdin, and outputs all
8 # shared libraries the package requires to execute.
9 #
10 # On Digital Unix (OSF1), use `odump -Dl' to find the library dependencies
11 # for an executable.  `odump -D' does most of what we need, but it doesn't
12 # give us library version information, so you must use `odump -Dl'
13 #
14 # Example `odump -Dl' output:
15 #
16 #$odump -Dl /usr/bin/X11/xterm
17
18 #
19 #
20 #
21 #                       ***LIBRARY LIST SECTION***
22 #       Name             Time-Stamp        CheckSum   Flags Version
23 #/usr/bin/X11/xterm:
24 #       libXaw.so    Dec  9 00:15:35 1997 0x285006d0     0 6.0
25 #       libXmu.so    Dec  9 00:13:36 1997 0x3bf3a33d     0 
26 #       libXt.so     Dec  9 00:12:18 1997 0x10dd9a17     0 
27 #       libSM.so     Dec  9 00:08:11 1997 0xb64c7082     0 
28 #       libICE.so    Dec  9 00:07:52 1997 0x1199be32     0 
29 #       libXext.so   Dec  9 00:08:51 1997 0xafcb84d5     0 
30 #       libX11.so    Dec  9 00:06:05 1997 0xaa1bf091     0 
31 #       libc.so      Dec  8 18:41:11 1997 0x5e955f9b     0 osf.1
32
33
34 # TVM: it might be better to re-write this so that `file' isn't used, since
35 # it can all be done with `odump',  but this works.
36 #
37 filelist=`sed "s/['\"]/\\\&/g" | xargs file | grep executable | cut -d: -f1`
38
39 for f in $filelist
40 do
41         odump -Dl $f 2>/dev/null | awk '
42
43                 #
44                 # For you non-awk-ers, no single quotes in comments -- the shell
45                 # sees them and things get hosed.
46                 #
47
48                 BEGIN { 
49                         seen_program_name = 0;
50                         FS = " ";
51                         RS = "\n";
52                         OFS=""
53                 }
54
55                 # uncomment the next line for debugging information
56                 #{ print "Got input:", $0 }
57
58                 seen_program_name == 1 && $0 !~ /^$/ {
59
60                         # uncomment for debugging information
61                         #print "found shared library: $0"
62                 
63                         # get the library name (field 1) and the library version (field 8)
64                         # if present.
65                         numfields = split($0,fields)
66                         if (numfields == 7) {
67                                 print fields[1]
68                         } else if (numfields == 8) {
69                                 #
70                                 # Note that if a library contains a number as the last
71                                 # part of the soname *and* it contains version information,
72                                 # we have a problem because it is impossible to tell where
73                                 # the soname ends and the version info begins.  Digital Unix
74                                 # shared libraries should *not* be built with any version info
75                                 # in the soname.  That info should be in the version field
76                                 # only.
77                                 # If we used a separator character of a - or something else,
78                                 # instead of a ., we would not have this problem.
79                                 #
80                                 print fields[1], ".", fields[8]
81                         }
82                 }
83
84                 /^.*: *$/ {
85                         seen_program_name = 1
86                         #
87                         # uncomment the next line for debugging information
88                         #print "found the program name: $1"
89                 }
90
91         ' # end of awk
92 done | sort -u