This file is indexed.

/usr/bin/d-devlibdeps is in d-shlibs 0.49.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
#   d-devlibdeps -- get list of build-time dependencies
#   Copyright (C) 2002-2005 Junichi Uekawa
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# 2002 May 3. Created.
#   automatic depends line generator.

set -e
set -o pipefail

function getname () {
    local SONAMELIBNAME
    local SONAMEVERSION
    local SONAME
    SONAME="$1"
    SONAMELIBNAME=$(echo $SONAME | sed 's/\.so\..*$//')
    SONAMEVERSION=$(echo $SONAME | sed 's/^.*\.so\.//')
    case "$SONAMELIBNAME" in
	*[0-9])
	    RETURN="$SONAMELIBNAME-$SONAMEVERSION"
	    ;;
	*)
	    RETURN="$SONAMELIBNAME$SONAMEVERSION"
	    ;;
    esac
}

function overridedevlibdeps () {
    # overrides necessary until the scheme is adopted.
    sed \
	"${OVERRIDE[@]/#/-e}" \
	-e 's/ld1-dev//' \
	-e 's/ld-linux[23]-dev//' \
	-e 's/libatk-1\.0-0-dev/libatk1.0-dev/' \
	-e 's/libavahi-client.-dev/libavahi-client-dev/' \
	-e 's/libavahi-common.-dev/libavahi-common-dev/' \
	-e 's/libavahi-glib.-dev/libavahi-glib-dev/' \
	-e 's/libav\([a-z]\+\)[0-9]\+-dev/libav\1-dev/' \
	-e 's/libc6-dev//' \
	-e 's/libcelt0-0-dev/libcelt-dev/' \
	-e 's/libcomerr2//' \
	-e 's/libcom_err2-dev/comerr-dev/' \
	-e 's/libcrack2-dev/cracklib2-dev/' \
	-e 's/libcrypt1\.1-dev//' \
	-e 's/libcrypt1-dev//' \
        -e 's/libcrypto.*-dev/libssl-dev/' \
	-e 's/libdbus-1-3-dev/libdbus-1-dev/' \
	-e 's/libdl2\.1-dev//' \
	-e 's/libdl2-dev//' \
	-e 's/libffado2-dev/libffado-dev/' \
	-e 's/libGL1-dev/xlibmesa-gl-dev/' \
	-e 's/libGLU1-dev/xlibmesa-glu-dev/' \
	-e 's/libgcc_s.*-dev//' \
	-e 's/libgd2-dev/libgd-dev/' \
	-e 's/libgdk-1\.2-0-dev/libgtk1.2-dev/' \
	-e 's/libgdk_pixbuf-2\.0-0-dev/libgtk2.0-dev/' \
	-e 's/libgdk-x11-2\.0-0-dev/libgtk2.0-dev/' \
	-e 's/libgio-2\.0-0-dev/libglib2.0-dev/' \
	-e 's/libglib-1\.2-0-dev/libglib1.2-dev/' \
	-e 's/libglib-2\.0-0-dev/libglib2.0-dev/' \
	-e 's/libgmodule-1\.2-0-dev/libglib1.2-dev/' \
	-e 's/libgmodule-2\.0-0-dev/libglib2.0-dev/' \
	-e 's/libgnutls26/libgnutls/' \
	-e 's/libgobject-2\.0-0-dev/libglib2.0-dev/' \
	-e 's/libgssapi_krb5-2-dev/libkrb5-dev/' \
	-e 's/libgthread-1\.2-0-dev/libglib1.2-dev/' \
	-e 's/libgthread-2\.0-0-dev/libglib2.0-dev/' \
	-e 's/libgtk-1\.2-0-dev/libgtk1.2-dev/' \
	-e 's/libgtk-x11-2\.0-0-dev/libgtk2.0-dev/' \
	-e 's/libICE6-dev/libice-dev/' \
	-e 's/libijs.*-dev/libijs-dev/' \
	-e 's/libjackserver0-dev//' \
	-e 's/libjasper1/libjasper/' \
	-e 's/libjpeg[0-9.]\+-dev/libjpeg-dev/' \
	-e 's/libk5crypto3-dev/libkrb5-dev/' \
	-e 's/libkrb1-dev/kerberos4kth-dev/' \
	-e 's/libkrb5-3-dev/libkrb5-dev/' \
	-e 's/liblcms2-2-dev/liblcms2-dev/' \
	-e 's/libm1-dev//' \
	-e 's/libm6\.1-dev//' \
	-e 's/libm6-dev//' \
	-e 's/libnsl1\.1-dev//' \
	-e 's/libnsl1-dev//' \
	-e 's/libogg0-dev/libogg-dev/' \
	-e 's/libpam0-dev/libpam0g-dev/' \
	-e 's/libpango-1\.0-0-dev/libpango1.0-dev/' \
	-e 's/libpangocairo-1\.0-0-dev/libpango1.0-dev/' \
	-e 's/libpangoft2-1\.0-0-dev/libpango1.0-dev/' \
	-e 's/libpangox-1\.0-0-dev/libpango1.0-dev/' \
	-e 's/libpangoxft-1\.0-0-dev/libpango1.0-dev/' \
	-e 's/libpaper1/libpaper/' \
	-e 's/libparted-1\.6-0-dev/libparted1.6-dev/' \
	-e 's/libpthread0\.3-dev//' \
	-e 's/libpthread0-dev//' \
	-e 's/libpthread-stubs0-dev//' \
	-e 's/libpthread.*-dev/libpthread-dev/' \
	-e 's/libraw1394-8-dev/libraw1394-dev/' \
	-e 's/libresolv2-dev//' \
	-e 's/librt1-dev//' \
	-e 's/libSDL-1\.2-0-dev/libsdl1.2-dev/' \
	-e 's/libSM6-dev/libsm-dev/' \
	-e 's/libspeex1-dev/libspeex-dev/' \
        -e 's/libssl.*-dev/libssl-dev/' \
	-e 's/libstdc++6.*-dev//' \
	-e 's/libtheora0-dev/libtheora-dev/' \
	-e 's/libtinfo5-dev/libtinfo-dev/' \
	-e 's/libucommon5-dev/libucommon-dev/' \
	-e 's/libusecure5-dev/libucommon-dev/' \
	-e 's/libuuid1-dev/uuid-dev/' \
	-e 's/libvorbis0-dev/libvorbis-dev/' \
	-e 's/libvorbisenc2-dev/libvorbis-dev/' \
	-e 's/libX11-6-dev/libx11-dev/' \
	-e 's/libX\([a-z]\+\)[0-9]-dev/libx\1-dev/' \
	-e 's/libxml2-2-dev/libxml2-dev/' \
	-e 's/libz1-dev/zlib1g-dev/' \
	"${OVERRIDE[@]/#/-e}" \


# the blank line above this line is intentionally left blank
}


function validate_package () {
# validate if package foo exists, this relies on apt.
    if [ -z "$1" ]; then 
	# ignore empty.
	return;
    fi
    if grep "^Package: $1\$" debian/control > /dev/null 2> /dev/null ; then
	# ignore package that is going to be created.
	echo " --> $1 package from same source package." >&2 
	return
    fi
    case $(echo $(apt-cache --no-generate show $1 2> /dev/null| wc -l ) ) in
	0)
	    case $(echo $(apt-cache --no-generate showpkg $1 2> /dev/null | awk ' /^Reverse Provides: $/,/^$/ {if ($0 !~ /:/) {print $0}}' | wc -l) ) in
		0) 
		    echo "devlibs error: There is no package matching [$1] and noone provides it, please report bug to d-shlibs maintainer" >&2
		    return 1;;
		*) echo " --> $1 is provided by a package." >&2 ;;
	    esac;;
	*) echo " --> $1 package exists." >&2 ;;
    esac
    return 0;
}

while true; do
    case $1 in
	--override=*)
	    OVERRIDE[${#OVERRIDE[@]}]="${1/--override=/}"
	    shift; 
	    ;;
	--override)
	    OVERRIDE[${#OVERRIDE[@]}]="$2"
	    shift; shift;
	    ;;
	--*)
	    #error
	    ;;
	--|*)
	    break;
	    ;;
    esac
done

if [ -z "$2" ]; then
    echo "$0: Please read manpage for help, not enough options given"
    exit 1
fi

OUTPUTFILE="$1"
shift;

DEPENDS=""
for A in $*; do
    # let shell do the delimiting of objdump output./
    DEPENDS="$DEPENDS $(set -o pipefail; objdump -p ${A} |sed -n 's/^.*NEEDED *//p')"
done

outputtmp=$(tempfile)
(
    set -e
    if [ -f "$OUTPUTFILE" ] ; then
	if grep -v "^devlibs:Depends=" "$OUTPUTFILE"; then
	    :
	fi
    fi
    printf "devlibs:Depends="
    for A in $DEPENDS; do #DEPENDS is a space-delimited thing.
	getname "$A"
	echo $RETURN-dev | overridedevlibdeps
    done | \
	sort | \
	uniq | \
	while read B; do
	    # abuse that only first part of multi-entry overrides is considered
	    if validate_package $B ; then
		printf "%s " $B ;
	    else
		echo "ERROR_DEVLIB "
	    fi
    done | sed -e 's/\([a-z0-9)]\) \+\([a-z]\)/\1, \2/g' -e 's/ \+/ /g' -e 's/^ //' -e 's/ $//'
    printf "\n"
) > "${outputtmp}"

if grep "ERROR_DEVLIB" "$outputtmp" > /dev/null; then
    exit 1
fi

mv "${outputtmp}" $OUTPUTFILE