3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # $Id: osf.req,v 1.4 1999/07/07 14:28:07 jbj Exp $
6 # This file is distributed under the terms of the GNU Public License
8 # find-requires is part of RPM, the Red Hat Package Manager. find-requires
9 # reads a list of full pathnames (in a package) on stdin, and outputs all
10 # shared libraries the package requires to execute.
12 # On Digital Unix (OSF1), use `odump -Dl' to find the library dependencies
13 # for an executable. `odump -D' does most of what we need, but it doesn't
14 # give us library version information, so you must use `odump -Dl'
16 # Example `odump -Dl' output:
18 #$odump -Dl /usr/bin/X11/xterm
23 # ***LIBRARY LIST SECTION***
24 # Name Time-Stamp CheckSum Flags Version
26 # libXaw.so Dec 9 00:15:35 1997 0x285006d0 0 6.0
27 # libXmu.so Dec 9 00:13:36 1997 0x3bf3a33d 0
28 # libXt.so Dec 9 00:12:18 1997 0x10dd9a17 0
29 # libSM.so Dec 9 00:08:11 1997 0xb64c7082 0
30 # libICE.so Dec 9 00:07:52 1997 0x1199be32 0
31 # libXext.so Dec 9 00:08:51 1997 0xafcb84d5 0
32 # libX11.so Dec 9 00:06:05 1997 0xaa1bf091 0
33 # libc.so Dec 8 18:41:11 1997 0x5e955f9b 0 osf.1
35 PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin
41 # Handle shell scripts first
43 for f in `echo $filelist | xargs file | grep 'shell script' | cut -d: -f 2 \
50 # TVM: it might be better to re-write this so that `file' isn't used, since
51 # it could all be done with `odump', but this works.
54 for f in `echo $filelist | xargs file | grep executable | cut -d: -f1`
56 odump -Dl $f 2>/dev/null | awk '
59 # For you non-awk-ers, no single quotes in comments -- the shell
60 # sees them and things get hosed.
64 found_program_name = 0;
69 # what character should be used to separate the soname from any
70 # version info? Using a . is actually a bad idea, since some
71 # free/3rd party libraries may be built so that the library
72 # soname may have version info in it too. If we use . as the
73 # separator, it may not be possible to tell where the soname
74 # ends and the internal version info begins. It might be
75 # better to use a - or a : here. If you do so, be sure to
76 # change this setting in find-provides, too.
78 soname_version_delimiter=".";
81 # uncomment the next line for debugging information
82 #{ print "Saw input:", $0 }
84 found_program_name == 1 && $0 !~ /^$/ {
86 # uncomment for debugging information
87 #print "found shared library: $0"
89 # get the library name (field 1) and the library version (field 8)
91 numfields = split($0,fields)
94 } else if (numfields == 8) {
96 # Note that if a library contains a number as the last
97 # part of the soname *and* it contains version information,
98 # we have a problem because it is impossible to tell where
99 # the soname ends and the version info begins. Digital Unix
100 # shared libraries should *not* be built with any version info
101 # in the soname. That info should be in the version field
104 # If we used a separator character of a - or something else,
105 # instead of a ., we would not have this problem.
107 print fields[1], soname_version_delimiter, fields[8]
112 found_program_name = 1
114 # uncomment the next line for debugging information
115 #print "found the program name: ", $1
120 # comment out the previous line and uncomment the next when debugging