[4.0] Use strip (instead of eu-strip) to support --strip-debug of *.so at build time
[platform/upstream/rpm.git] / autodeps / osf.req
index dab9304..39d00c3 100644 (file)
@@ -1,7 +1,7 @@
 #! /usr/bin/ksh
 
-# Original Author: Tim Mooney (mooney@plains.nodak.edu)
-# $Id: osf.req,v 1.2 1998/05/26 13:28:48 ewt Exp $
+# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu>
+# $Id: osf.req,v 1.9 2001/09/15 13:49:11 jbj Exp $
 #
 # This file is distributed under the terms of the GNU Public License
 #
@@ -9,9 +9,11 @@
 # reads a list of full pathnames (in a package) on stdin, and outputs all
 # shared libraries the package requires to execute.
 #
-# On Digital Unix (OSF1), use `odump -Dl' to find the library dependencies
-# for an executable.  `odump -D' does most of what we need, but it doesn't
-# give us library version information, so you must use `odump -Dl'
+# On Digital/Tru64 Unix (OSF1), use `odump -Dl' to find the library
+# dependencies for an executable.  `odump -D' does most of what we need,
+# but it doesn't give us library version information, so you must use
+# `odump -Dl'.  Note that Tru64 5.x and on have `ldd', but this works just
+# as well, and works on older versions of the OS.
 #
 # Example `odump -Dl' output:
 #
 PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin
 export PATH
 
-filelist=`cat -`
-
 #
-# Handle shell scripts first
+# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things
+# like `file', et. al. and expect the output to be what we see in the
+# C/POSIX locale.  Make sure it is so.
 #
-for f in `echo $filelist | xargs file | grep 'shell script' | cut -d: -f 2 \
-       | awk '{ print $1 }'`
-do
-    print $f
-done | sort -u
+LANG=C
+export LANG
 
 #
-# TVM: it might be better to re-write this so that `file' isn't used, since
-# it could all be done with `odump', but this works.
+# TVM: switch to using `while read ...' instead of `for f in ...', because
+# packages with a large number of files could be too big for one shell variable
+# to hold.
 #
-
-for f in `echo $filelist | xargs file | grep executable | cut -d: -f1`
+IFS=""
+while read f
 do
-       odump -Dl $f 2>/dev/null | awk '
 
+       #
+       # Uncomment the next line for addtional debugging:
+       # echo "read ->$f<-"
+
+       #
+       # Only run file once per file:
+       #
+       file_output=`file $f`
+
+       #
+       # handle shell scripts first
+       #
+       is_shell_script=`echo "$file_output" | grep 'shell script' | \
+               cut -d: -f 2 | awk '{ print $1 }'`
+
+       #
+       # If it's a script...
+       #
+       if test X"$is_shell_script" != X ; then
+               echo "$is_shell_script"
                #
-               # For you non-awk-ers, no single quotes in comments -- the shell
-               # sees them and things get hosed.
+               # use `continue' to skip back up to the top of the loop.
+               # We have already done as much as we need to for this
+               # file, and this saves me from having to have an else,
+               # and another indent level... ;-)
                #
+               continue
+       fi
+
+       #
+       # The `else' here is implied by the `continue' above...
+       #
+
+       #
+       # it might be a shared library.
+       #
+
+       maybe_shared_lib=`echo "$file_output" | grep 'executable'`
+       if test X"$maybe_shared_lib" != X ; then
+
+               odump -Dl $f 2>/dev/null \
+               | awk '
 
-               BEGIN { 
-                       found_program_name = 0;
-                       FS = " ";
-                       RS = "\n";
-                       OFS="";
                        #
-                       # what character should be used to separate the soname from any
-                       # version info?  Using a . is actually a bad idea, since some
-                       # free/3rd party libraries may be built so that the library
-                       # soname may have version info in it too.  If we use . as the
-                       # separator, it may not be possible to tell where the soname
-                       # ends and the internal version info begins.  It might be
-                       # better to use a - or a : here.  If you do so, be sure to
-                       # change this setting in find-provides, too.
+                       # Since this entire awk script is enclosed in single quotes,
+                       # you need to be careful to not use single quotes, even in awk
+                       # comments, if you modify this script.
                        #
-                       soname_version_delimiter=".";
-               }
-
-               # uncomment the next line for debugging information
-               #{ print "Saw input:", $0 }
-
-               found_program_name == 1 && $0 !~ /^$/ {
-
-                       # uncomment for debugging information
-                       #print "found shared library: $0"
-               
-                       # get the library name (field 1) and the library version (field 8)
-                       # if present.
-                       numfields = split($0,fields)
-                       if (numfields == 7) {
-                               print fields[1]
-                       } else if (numfields == 8) {
-                               #
-                               # Note that if a library contains a number as the last
-                               # part of the soname *and* it contains version information,
-                               # we have a problem because it is impossible to tell where
-                               # the soname ends and the version info begins.  Digital Unix
-                               # shared libraries should *not* be built with any version info
-                               # in the soname.  That info should be in the version field
-                               # only.
-                               #
-                               # If we used a separator character of a - or something else,
-                               # instead of a ., we would not have this problem.
-                               #
-                               print fields[1], soname_version_delimiter, fields[8]
+
+                       BEGIN { 
+                               found_program_name = 0;
+                               FS = " ";
+                               RS = "\n";
+                               OFS="";
                        }
-               }
 
-               /^.*: *$/ {
-                       found_program_name = 1
-                       #
                        # uncomment the next line for debugging information
-                       #print "found the program name: ", $1
-               }
+                       #{ print "Saw input:", $0 }
+
+                       found_program_name == 1 && $0 !~ /^$/ {
+
+                               # uncomment for debugging information
+                               #print "found shared library: $0"
+
+                               # get the library name (field 1) and the library version
+                               # (field 8) if present.
+                               numfields = split($0,fields)
+                               if (numfields == 7) {
+                                       print fields[1]
+                               } else if (numfields == 8) {
+                                       print fields[1], "(", fields[8], ")"
+                               }
+                       }
+
+                       /^.*: *$/ {
+                               found_program_name = 1
+                               #
+                               # uncomment the next line for debugging information
+                               #print "found the program name: ", $1
+                       }
 
-       ' # end of awk
+               ' # end of awk
+       fi
 done | sort -u
 # comment out the previous line and uncomment the next when debugging
 # done