e394c79
#!/bin/bash
e394c79
#
e394c79
# mono-find-provides
e394c79
#
e394c79
# Authors:
e394c79
#       Ben Maurer (bmaurer@ximian.com)
e394c79
#
e394c79
# (C) 2005 Novell (http://www.novell.com)
e394c79
#
e394c79
# Args: builddir buildroot libdir
e394c79
e394c79
IFS=$'\n'
e394c79
filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
e394c79
monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
e394c79
e394c79
# If monodis is in the package being installed, use that one
e394c79
# This is to support building mono
e394c79
build_bindir="$2/usr/bin"
e394c79
build_libdir="$2$3"
e394c79
e394c79
if [ -x $build_bindir/monodis ]; then
e394c79
    monodis="$build_bindir/monodis"
e394c79
    export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
e394c79
elif [ -x /usr/bin/monodis ]; then
e394c79
    monodis="/usr/bin/monodis"
e394c79
else
e394c79
    exit 0;
e394c79
fi
e394c79
e394c79
export MONO_SHARED_DIR=$1
e394c79
e394c79
for i in "${monolist[@]}"; do
e394c79
        ($monodis --assembly $i | awk '
e394c79
                BEGIN { LIBNAME=""; VERSION=""; }
e394c79
                /^Version:/ { VERSION=$2 }
e394c79
                /^Name:/    { LIBNAME=$2 }
e394c79
                END {
e394c79
                        if (VERSION && LIBNAME)
e394c79
                                print "mono(" LIBNAME ") = " VERSION
e394c79
                }
e394c79
            ') 2>/dev/null
e394c79
done