3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # $Id: osf.req,v 1.7 1999/09/30 00:22:15 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
39 # TVM: switch to using `while read ...' instead of `for f in ...', because
40 # packages with a large number of files could be too big for one shell variable
48 # Uncomment the next line for addtional debugging:
52 # Only run file once per file:
57 # handle shell scripts first
59 is_shell_script=`echo "$file_output" | grep 'shell script' | \
60 cut -d: -f 2 | awk '{ print $1 }'`
65 if test X"$is_shell_script" != X ; then
66 echo "$is_shell_script"
68 # use `continue' to skip back up to the top of the loop.
69 # We have already done as much as we need to for this
70 # file, and this saves me from having to have an else,
71 # and another indent level... ;-)
77 # The `else' here is implied by the `continue' above...
81 # it might be a shared library.
84 maybe_shared_lib=`echo "$file_output" | grep 'executable'`
85 if test X"$maybe_shared_lib" != X ; then
87 odump -Dl $f 2>/dev/null \
91 # For you non-awk-ers, no single quotes in comments -- the shell
92 # sees them and things get hosed.
96 found_program_name = 0;
101 # what character should be used to separate the soname from any
102 # version info? Using a . is actually a bad idea, since some
103 # free/3rd party libraries may be built so that the library
104 # soname may have version info in it too. If we use . as the
105 # separator, it may not be possible to tell where the soname
106 # ends and the internal version info begins. It might be
107 # better to use a - or a : here. If you do so, be sure to
108 # change this setting in find-provides, too.
110 soname_version_delimiter=".";
113 # uncomment the next line for debugging information
114 #{ print "Saw input:", $0 }
116 found_program_name == 1 && $0 !~ /^$/ {
118 # uncomment for debugging information
119 #print "found shared library: $0"
121 # get the library name (field 1) and the library version
122 # (field 8) if present.
123 numfields = split($0,fields)
124 if (numfields == 7) {
126 } else if (numfields == 8) {
128 # Note that if a library contains a number as the last
129 # part of the soname *and* it contains version information,
130 # we have a problem because it is impossible to tell where
131 # the soname ends and the version info begins. Digital
132 # Unix shared libraries should *not* be built with any
133 # version info in the soname. That info should be in
134 # the version field only.
136 # If we used a separator character of a - or something else,
137 # instead of a ., we would not have this problem.
139 print fields[1], soname_version_delimiter, fields[8]
144 found_program_name = 1
146 # uncomment the next line for debugging information
147 #print "found the program name: ", $1
153 # comment out the previous line and uncomment the next when debugging