3 # Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu>
4 # $Id: irix6.prov,v 1.7 2001/09/15 13:49:11 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: IRIX libraries (even system libraries) have "version information"
13 # in both the soname and the internal version field, so it's important to
14 # be able to separate the soname and internal version fields. As has
15 # become the case on other platforms, the soname/iversion delimiters have
16 # become the `(' and `)' characters.
18 # On IRIX, use `elfdump -L' to find what libraries a package provides
20 # Example `elfdump -L' output:
22 #$elfdump -L /usr/lib/libc.so
27 # **** DYNAMIC SECTION INFORMATION ****
39 #[9] BASEADDR 0xfa00000
51 #[21] PLTGOT 0xfb483b0
52 #[22] RLDTXT_ADR0xfb6b580
53 #[23] OPTIONS 0xfa000f4
54 #[24] SONAME libc.so.1
55 #[25] TIMSTAMP Jun 16 18:23:15 1997
56 #[26] CHECKSUM 0x92321a0c
62 #[32] COMPCTSIZE0xc60c
63 #No Library List Section in /usr/lib/libc.so
66 PATH=/usr/bin:/usr/sbin
70 # TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things
71 # like `file', et. al. and expect the output to be what we see in the
72 # C/POSIX locale. Make sure it is so.
78 # Use `while read ...' instead of `for f in ...', because there may be too
79 # many files to stuff into one shell variable.
85 # If it's a shared library, run elfdump on it.
87 maybe_shared_lib=`file $f | grep -E 'ELF.*dynamic lib'`
88 if test X"$maybe_shared_lib" != X ; then
89 elfdump -L $f 2>/dev/null | awk '
92 # Since this entire awk script is enclosed in single quotes,
93 # you need to be careful to not use single quotes, even in awk
94 # comments, if you modify this script.
106 # Uncomment the next line for some debugging info.
107 #{ print NR , ":", $0 }
109 /[ ]+SONAME .*[ ]*$/ {
111 numfields = split($0, internal_name)
112 if (numfields == 3) {
116 # Should never be here.
118 print "Really odd looking soname:", $0 | "cat 1>&2"
123 /[ ]+IVERSION .*[ ]*$/ {
124 if (found_soname == 1) {
125 numfields = split($0, iversion)
126 if (numfields == 3) {
129 # handle libraries with multiple versions, like
130 # 1.1:1.2. Since they really provide both versions,
131 # we need to generate output for each version.
133 numfields = split(version, versions, ":")
135 for (i = 1; i < numfields; i++) {
136 print soname, "(", versions[i], ")"
139 # let our END routine print out the *last* version
142 version = versions[numfields]
145 # stick a fork in us.
151 # handle libraries with comments and other junk in
152 # the version field. IRIX has a number of system libraries
153 # with whitespace and other junk in the version field!
155 # we discard the whitespace and keep the identifier after
158 version = iversion[numfields]
159 numfields = split(version, version_junk, "#")
161 version = version_junk[numfields]
167 # found an iversion without an soname. Is that possible?
169 print "Found version but no soname:", $0 | "cat 1>&2"
175 # we could probably watch for some other token (like RELSZ)
176 # that *generally* occurs later in the input than the stuff we watch
177 # for, and exit if we see it, but it is just as easy to read all
178 # the output, even after we have seen what we are looking for.
182 # Uncomment the next line for debugging info
183 #{ print "END: NR: ", NR }
184 if ( (found_soname == 1) && (found_iversion == 1) ) {
185 print soname, "(", version, ")"
187 } else if ( (found_soname == 1) && (found_iversion == 0) ) {
189 # no library version information *BUT* any programs linked
190 # against this library will pick up a dependency on version 0
191 # of this library, so we output that.
193 print soname, "(", 0, ")"
198 fi # end of the 'if test X"$maybe_shared_lib != X ; then' clause
200 #comment out the previous line and uncomment the next line when debugging