]> git.donarmstrong.com Git - debhelper.git/blob - dh_makeshlibs
r75: Initial Import
[debhelper.git] / dh_makeshlibs
1 #!/bin/sh -e
2 #
3 # Automatically generate shlibs files.
4
5 PATH=debian:$PATH:/usr/lib/debhelper
6 . dh_lib
7
8 for PACKAGE in $DH_DOPACKAGES; do
9         TMP=`tmpdir $PACKAGE`
10
11         if [ -e "$TMP/DEBIAN/shlibs" ]; then
12                 error "$TMP/DEBIAN/shlibs already exists."
13         fi
14
15         for file in `find $TMP -type f -name "*.so.*" | tr "\n" " "` ; do
16                 LIBRARY=`expr $file : ".*/\(.*\)\.so\..*"` || true
17                 LIB_VERSION=`expr $file : ".*/.*\.so\.\(.*\)"` || true
18                 if [ -z "$DH_M_PARAMS" ]; then
19                         MAJOR=`expr $LIB_VERSION : "\([0-9]*\)\."` || true
20                 else
21                         MAJOR="$DH_M_PARAMS"
22                 fi
23 #               LIBSTUB=`expr $file : "\(.*\/.*\.so\)\..*"` || true
24                 if [ ! -d "$TMP/DEBIAN" ] ; then
25                         doit "install -d $TMP/DEBIAN"
26                 fi
27                 DEPS=$PACKAGE
28                 if [ "$DH_V_FLAG_SET" ]; then
29                         if [ "$DH_V_FLAG" ]; then
30                                 DEPS="$DH_V_FLAG"
31                         else
32                                 # Call isnative becuase it sets $VERSION
33                                 # as a side effect.
34                                 isnative || true
35                                 DEPS="$PACKAGE (>= $VERSION)"
36                         fi
37                 fi
38                 if [ "$LIBRARY" -a "$MAJOR" -a "$DEPS" ]; then
39                         complex_doit "echo '$LIBRARY $MAJOR $DEPS' >>$TMP/DEBIAN/shlibs"
40                 fi
41         done
42
43         if [ -e "$TMP/DEBIAN/shlibs" ]; then
44                 doit "chmod 644 $TMP/DEBIAN/shlibs"
45                 doit "chown root.root $TMP/DEBIAN/shlibs"
46         fi
47 done