3 # Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu>
4 # $Id: irix6.req,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-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 # 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 -Dl' to find what libraries are required by
19 # an executable. `elfdump -L' does what we need too, but it gives us more
20 # than we really need.
22 # Example `elfdump -Dl' output:
24 #$elfdump -Dl /usr/bin/X11/xterm
30 # **** MIPS LIBLIST INFORMATION ****
32 #[INDEX] Timestamp Checksum Flags Name Version
33 #[1] Nov 23 15:39:02 1997 0x4da65893 ----- libXaw.so.2 sgi2.0
34 #[2] Nov 23 15:39:02 1997 0x414eece6 ----- libXmu.so sgi1.0
35 #[3] Nov 23 15:39:02 1997 0x6f314e69 ----- libXt.so sgi1.0
36 #[4] Nov 23 15:39:02 1997 0xcbe81fff ----- libXext.so sgi1.0
37 #[5] Nov 23 15:39:02 1997 0x89ae8e98 ----- libX11.so.1 sgi1.0
38 #[6] Oct 27 01:00:29 1997 0x99b27890 ----- libcurses.so sgi1.0
39 #[7] Jun 16 18:23:15 1997 0x92321a0c ----- libc.so.1 sgi1.0
43 # TVM: it might be better to re-write this so that `file' isn't used, since
44 # it can all be done with `elfdump', but this works.
47 PATH=/usr/bin:/usr/sbin
51 # TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things
52 # like `file', et. al. and expect the output to be what we see in the
53 # C/POSIX locale. Make sure it is so.
59 # TVM: switch to using `while read ...' instead of `for f in ...', because
60 # packages with a large number of files could be too big for one shell
68 # Uncomment the next line for additional debugging:
72 # Only run file once per file:
77 # Handle scripts first
79 is_shell_script=`echo "$file_output" | grep 'script text' | \
80 cut -d: -f 2 | awk '{ print $1 }'`
85 if test X"$is_shell_script" != X ; then
86 echo "$is_shell_script"
88 # use `continue' to skip back up to the top of the loop. We've
89 # already done as much as we need to, and this saves me from having
90 # to have an else, and another indent level... ;-)
96 # the `else' is implied here, since we used `continue' in the test above
100 # It might be a shared library.
102 maybe_shared_lib=`echo "$file_output" | grep -E 'executable|lib'`
103 if test X"$maybe_shared_lib" != X ; then
105 elfdump -Dl $f 2>/dev/null \
109 # Since this entire awk script is enclosed in single quotes,
110 # you need to be careful to not use single quotes, even in awk
111 # comments, if you modify this script.
115 found_column_headers = 0;
121 # uncomment the next line for debugging information
122 #{ print "Saw input:", $0 }
124 found_column_headers == 1 && $0 !~ /^$/ {
126 # get the library name (field 15) and the library version (field 16)
128 numfields = split($0,fields)
129 if (numfields == 8) {
131 } else if (numfields == 9) {
133 print fields[8], "(", fields[9], ")"
134 } else if (numfields > 9) {
136 # SGI has this annoying habit of putting comments, complete
137 # with whitespace, in their library IVERSION field. Yuck.
139 # Handle libraries like this gracefully.
141 verfields = split(fields[NF], junk, "#")
142 if (verfields == 2) {
143 print fields[8], "(", junk[2], ")"
144 } else if (verfields > 2) {
145 print fields[8], "(", junk[verfields], ")"
147 print "Cannot find version:", fields[numfields] | "cat 2>&1"
152 /^\[INDEX\].Timestamp.*Checksum.*Flags.*Name.*Version$/ {
153 # we better start paying attention now.
154 found_column_headers = 1
156 # uncomment the next line for debugging information
157 #print "found the column headers: ", $0
163 # comment out the previous line and uncomment the next when debugging