Modify eu-strip option to perform strip in post script of rpm package & add option...
[platform/upstream/rpm.git] / autodeps / aix4.req
1 #! /usr/bin/ksh
2 #
3 # Current Maintainer: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu>
4 # Original Author: Ralph Goers(rgoer@Candle.Com)
5 #
6 # This file is distributed under the terms of the GNU Public License
7 #
8 # find-requires is part of RPM, the RedHat 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 run correctly.
11 #
12 # On AIX, use `dump -H' to find the library dependencies for an executable
13 #
14 # Example dump output:
15 #
16 #$dump -H /usr/bin/dump
17 #
18 #/usr/bin/dump:
19 #
20 #                        ***Loader Section***
21 #                      Loader Header Information
22 #VERSION#         #SYMtableENT     #RELOCent        LENidSTR
23 #0x00000001       0x00000021       0x0000006c       0x0000002f
24 #
25 ##IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
26 #0x00000002       0x00000848       0x00000049       0x00000877
27 #
28 #
29 #                        ***Import File Strings***
30 #INDEX  PATH                          BASE                MEMBER
31 #0      /usr/lib:/lib:/usr/lpp/xlC/lib
32 #1                                    libc.a              shr.o
33 #
34 #
35
36 PATH=/usr/bin:/usr/ccs/bin
37 export PATH
38
39 #
40 # TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things
41 # like `file', et. al. and expect the output to be what we see in the
42 # C/POSIX locale.  Make sure it is so.
43 #
44 LANG=C
45 export LANG
46
47 filelist=`sed "s/['\"]/\\\&/g" | xargs file \
48         | grep -E '^.*:.*(executable |archive )' | cut -d: -f1`
49
50 for f in $filelist
51 do
52     dump -H $f 2>/dev/null | awk '
53
54                 #
55                 # Since this entire awk script is enclosed in single quotes,
56                 # you need to be careful to not use single quotes, even in awk
57                 # comments, if you modify this script.
58                 #
59
60         BEGIN {
61             in_shlib_list = 0;
62             in_file_strings = 0;
63             FS = " ";
64             RS = "\n";
65         }
66
67         in_shlib_list == 1 && /^$/ {
68             in_shlib_list = 0;
69             in_file_strings = 0;
70         }
71
72         in_shlib_list == 1 {
73             pos = index($2, "/")
74             numfields = split($0, fields, " ")
75
76             if (pos == 0)  {
77               namevar = 2
78             }
79             else {
80               namevar = 3
81             }
82             if (namevar < numfields) {
83               printf("%s(%s)\n", fields[namevar], fields[namevar+1])
84             }
85             else {
86               print fields[namevar]
87             }
88         }
89
90         in_file_strings == 1 && $1 == "0" {
91             in_shlib_list = 1
92         }
93
94         /\*Import File Strings\*/ {
95             in_file_strings = 1
96         }
97
98     ' # end of awk
99 done | sort -u