3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # $Id: irix6.prov,v 1.3 1999/01/22 00:25:26 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
71 for f in `cat - | xargs /usr/bin/file | egrep 'ELF.*dynamic lib' | cut -d: -f1`
73 elfdump -L $f 2>/dev/null | awk '
80 # The character that should separate the soname from
81 # the version information. If you change this, you
82 # should also change the same variable in the IRIX
83 # find-requires script
84 soname_version_delimiter=":"
90 # Uncomment the next line for some debugging info.
91 #{ print NR , ":", $0 }
93 /[ ]+SONAME .*[ ]*$/ {
95 numfields = split($0, internal_name)
100 # Should never be here.
102 print "Really odd looking soname:", $0 | "cat 1>&2"
107 /[ ]+IVERSION .*[ ]*$/ {
108 if (found_soname == 1) {
109 numfields = split($0, iversion)
110 if (numfields == 3) {
113 # handle libraries with multiple versions, like
114 # 1.1:1.2. Since they really provide both versions,
115 # we need to generate output for each version.
117 numfields = split(version, versions, ":")
119 for (i = 1; i < numfields; i++) {
120 print soname, soname_version_delimiter, versions[i]
123 # let our END routine print out the *last* version
126 version = versions[numfields]
129 # stick a fork in us.
135 # handle libraries with comments and other junk in
136 # the version field. IRIX has a number of system libraries
137 # with whitespace and other junk in the version field!
139 # we discard the whitespace and keep the identifier after
142 version = iversion[numfields]
143 numfields = split(version, version_junk, "#")
145 version = version_junk[numfields]
151 # found an iversion without an soname. Is that possible?
153 print "Found version but no soname:", $0 | "cat 1>&2"
159 # we could probably watch for some other token (like RELSZ)
160 # that *generally* occurs later in the input than the stuff we watch
161 # for, and exit if we see it, but it is just as easy to read all
162 # the output, even after we have seen what we are looking for.
166 # Uncomment the next line for debugging info
167 #{ print "END: NR: ", NR }
168 if ( (found_soname == 1) && (found_iversion == 1) ) {
169 print soname, soname_version_delimiter, version
171 } else if (found_soname == 1) {
173 # no library version information
181 #comment out the previous line and uncomment the next line when debugging