Fix building issue for tizen_base(configure: error: --with-msm given, but attr/xattr...
[platform/upstream/rpm.git] / autodeps / irix6.prov
1 #! /usr/bin/ksh
2
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 $
5 #
6 # This file is distributed under the terms of the GNU Public License
7 #
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.
11 #
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.
17 #
18 # On IRIX, use `elfdump -L' to find what libraries a package provides
19 #
20 # Example `elfdump -L' output:
21 #
22 #$elfdump -L /usr/lib/libc.so
23 #
24 #
25 #/usr/lib/libc.so:
26 #
27 #  **** DYNAMIC SECTION INFORMATION ****
28 #.dynamic :
29 #[INDEX]        Tag      Value
30 #[0]    HASH     0xfa099d0
31 #[1]    STRTAB   0xfa0027c
32 #[2]    SYMTAB   0xfa10e3c
33 #[3]    STRSZ    0x9751
34 #[4]    SYMENT   0x10
35 #[5]    INIT     0
36 #[6]    FINI     0
37 #[7]    RLDVERS  0x1
38 #[8]    FLAGS    0x1411
39 #[9]    BASEADDR 0xfa00000
40 #[10]   LOCGOTNO 0x3c
41 #[11]   PROTECT  0x3c
42 #[12]   HIDDEN   0x12
43 #[13]   CNFLCTNO 0
44 #[14]   LBLISTNO 0
45 #[15]   SYMTABNO 0xd19
46 #[16]   UNREFEXT 0x8
47 #[17]   GOTSYM   0x8b3
48 #[18]   LOCAL    0x12
49 #[19]   LOCALPG  0x1
50 #[20]   LOCALPG  0x10
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
57 #[27]   IVERSION sgi1.0
58 #[28]   REL      0xfa1dfcc
59 #[29]   RELSZ    0x1988
60 #[30]   RELENT   0x8
61 #[31]   MSYM     0xfa1f954
62 #[32]   COMPCTSIZE0xc60c
63 #No Library List Section in /usr/lib/libc.so
64 #
65
66 PATH=/usr/bin:/usr/sbin
67 export PATH
68
69 #
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.
73 #
74 LANG=C
75 export LANG
76
77 #
78 # Use `while read ...' instead of `for f in ...', because there may be too
79 # many files to stuff into one shell variable.
80 #
81 IFS=""
82 while read f
83 do
84         #
85         # If it's a shared library, run elfdump on it.
86         #
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 '
90
91                 #
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.
95                 #
96
97                 BEGIN { 
98                         FS = " ";
99                         RS = "\n";
100                         OFS = "";
101
102                         found_soname = 0;
103                         found_iversion = 0;
104                 }
105
106                 # Uncomment the next line for some debugging info.
107                 #{ print NR , ":", $0  }
108
109                 /[       ]+SONAME .*[   ]*$/ {
110                         found_soname = 1;
111                         numfields = split($0, internal_name)
112                         if (numfields == 3) {
113                                 soname = $3
114                         } else {
115                                 #
116                                 # Should never be here.
117                                 #
118                                 print "Really odd looking soname:", $0 | "cat 1>&2"
119                                 exit
120                         }
121                 }
122
123                 /[      ]+IVERSION .*[  ]*$/ {
124                         if (found_soname == 1) {
125                                 numfields = split($0, iversion)
126                                 if (numfields == 3) {
127                                         version = $3
128                                         #
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.
132                                         #
133                                         numfields = split(version, versions, ":")
134                                         if (numfields > 1) {
135                                                 for (i = 1; i < numfields; i++) {
136                                                         print soname, "(", versions[i], ")"
137                                                 }
138                                                 #
139                                                 # let our END routine print out the *last* version
140                                                 # provided
141                                                 #
142                                                 version = versions[numfields]
143                                         }
144                                         #
145                                         # stick a fork in us.
146                                         #
147                                         found_iversion = 1;
148                                         exit
149                                 } else {
150                                         #
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!
154                                         #
155                                         # we discard the whitespace and keep the identifier after
156                                         # the # sign.
157                                         #
158                                         version = iversion[numfields]
159                                         numfields = split(version, version_junk, "#")
160                                         if (numfields > 1) {
161                                                 version = version_junk[numfields]
162                                                 found_iversion = 1;
163                                         }
164                                 }
165                         } else {
166                                 #
167                                 # found an iversion without an soname.  Is that possible?
168                                 #
169                                 print "Found version but no soname:", $0 | "cat 1>&2"
170                                 exit
171                         }
172                 }
173
174                 #
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.
179                 #
180
181                 END {
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, ")"
186                                 exit
187                         } else if ( (found_soname == 1) && (found_iversion == 0) ) {
188                                 #
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.
192                                 #
193                                 print soname, "(", 0, ")"
194                         }
195                         # else do nothing
196                 }
197         ' # end of awk
198         fi # end of the 'if test X"$maybe_shared_lib != X ; then' clause
199 done | sort -u
200 #comment out the previous line and uncomment the next line when debugging
201 #done