3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # $Id: irix6.prov,v 1.5 1999/09/30 00:22:15 jbj Exp $
6 # This file is distributed under the terms of the GNU Public License
8 # find-provides is part of RPM, the Red Hat Package Manager. find-provides
9 # reads a list of full pathnames (in a package) on stdin, and outputs all
10 # shared libraries provided by (contained in) the package.
12 # NOTE: I use `:' as the delimiter (by default) between the library soname
13 # and any library version info. This is because IRIX libraries (even
14 # system libraries) have "version information" in both the soname and the
15 # internal version field, so it's important to be able to separate those
16 # fields. If we just used `.', we wouldn't know where the soname ends and
17 # the version infromation begins.
20 # On IRIX, use `elfdump -L' to find what libraries a package provides
22 # Example `elfdump -L' output:
24 #$elfdump -L /usr/lib/libc.so
29 # **** DYNAMIC SECTION INFORMATION ****
41 #[9] BASEADDR 0xfa00000
53 #[21] PLTGOT 0xfb483b0
54 #[22] RLDTXT_ADR0xfb6b580
55 #[23] OPTIONS 0xfa000f4
56 #[24] SONAME libc.so.1
57 #[25] TIMSTAMP Jun 16 18:23:15 1997
58 #[26] CHECKSUM 0x92321a0c
64 #[32] COMPCTSIZE0xc60c
65 #No Library List Section in /usr/lib/libc.so
68 PATH=/usr/bin:/usr/sbin
72 # Use `while read ...' instead of `for f in ...', because there may be too
73 # many files to stuff into one shell variable.
79 # If it's a shared library, run elfdump on it.
81 maybe_shared_lib=`file $f | egrep 'ELF.*dynamic lib'`
82 if test X"$maybe_shared_lib" != X ; then
83 elfdump -L $f 2>/dev/null | awk '
90 # The character that should separate the soname from
91 # the version information. If you change this, you
92 # should also change the same variable in the IRIX
93 # find-requires script
94 soname_version_delimiter=":"
100 # Uncomment the next line for some debugging info.
101 #{ print NR , ":", $0 }
103 /[ ]+SONAME .*[ ]*$/ {
105 numfields = split($0, internal_name)
106 if (numfields == 3) {
110 # Should never be here.
112 print "Really odd looking soname:", $0 | "cat 1>&2"
117 /[ ]+IVERSION .*[ ]*$/ {
118 if (found_soname == 1) {
119 numfields = split($0, iversion)
120 if (numfields == 3) {
123 # handle libraries with multiple versions, like
124 # 1.1:1.2. Since they really provide both versions,
125 # we need to generate output for each version.
127 numfields = split(version, versions, ":")
129 for (i = 1; i < numfields; i++) {
130 print soname, soname_version_delimiter, versions[i]
133 # let our END routine print out the *last* version
136 version = versions[numfields]
139 # stick a fork in us.
145 # handle libraries with comments and other junk in
146 # the version field. IRIX has a number of system libraries
147 # with whitespace and other junk in the version field!
149 # we discard the whitespace and keep the identifier after
152 version = iversion[numfields]
153 numfields = split(version, version_junk, "#")
155 version = version_junk[numfields]
161 # found an iversion without an soname. Is that possible?
163 print "Found version but no soname:", $0 | "cat 1>&2"
169 # we could probably watch for some other token (like RELSZ)
170 # that *generally* occurs later in the input than the stuff we watch
171 # for, and exit if we see it, but it is just as easy to read all
172 # the output, even after we have seen what we are looking for.
176 # Uncomment the next line for debugging info
177 #{ print "END: NR: ", NR }
178 if ( (found_soname == 1) && (found_iversion == 1) ) {
179 print soname, soname_version_delimiter, version
181 } else if ( (found_soname == 1) && (found_iversion == 0) ) {
183 # no library version information *BUT* any programs linked
184 # against this library will pick up a dependency on version 0
185 # of this library, so we output that.
187 print soname, soname_version_delimiter, 0
192 fi # end of the 'if test X"$maybe_shared_lib != X ; then' clause
194 #comment out the previous line and uncomment the next line when debugging