summaryrefslogtreecommitdiff
path: root/dh_makeshlibs
blob: d595c3b5417556cd9565265c06eaca5caf013b04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh -e
#
# Automatically generate shlibs files.

PATH=debian:$PATH:/usr/lib/debhelper
. dh_lib

for PACKAGE in $DH_DOPACKAGES; do
	TMP=`tmpdir $PACKAGE`

	if [ -e "$TMP/DEBIAN/shlibs" ]; then
		error "$TMP/DEBIAN/shlibs already exists."
	fi

	for file in `find $TMP -type f -name "*.so*" | tr "\n" " "` ; do
		LIBRARY=`expr $file : ".*/\(.*\)\.so\..*"` || true
		LIB_VERSION=`expr $file : ".*/.*\.so\.\(.*\)"` || true
		if [ -z "$DH_M_PARAMS" ]; then
			MAJOR=`expr $LIB_VERSION : "\([0-9]*\)\."` || true
		else
			MAJOR="$DH_M_PARAMS"
		fi
#		LIBSTUB=`expr $file : "\(.*\/.*\.so\)\..*"` || true
		if [ ! -d "$TMP/DEBIAN" ] ; then
			doit "install -d $TMP/DEBIAN"
		fi
		if [ "$DH_V_FLAG_SET" ]; then
			if [ "$DH_V_FLAG" ]; then
				PACKAGE="$DH_V_FLAG"
			else
				# Call isnative becuase it sets $VERSION
				# as a side effect.
				isnative
				PACKAGE="$PACKAGE (>= $VERSION)"
			fi
		fi
		complex_doit "echo '$LIBRARY $MAJOR $PACKAGE' >>$TMP/DEBIAN/shlibs"
	done

	if [ -e "$TMP/DEBIAN/shlibs" ]; then
		doit "chown root.root $TMP/DEBIAN/shlibs"
	fi
done