2010-06-30 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / scripts / mono-find-provides.in
blobc9210060c26e83fd628c11705e0147b8d2c02913
1 #!/bin/bash
3 # mono-find-provides
5 # Authors:
6 # Ben Maurer (bmaurer@ximian.com)
8 # (C) 2005 Novell (http://www.novell.com)
11 IFS=$'\n'
12 filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
13 monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
15 # Only include files with /gac/ in path
16 # (Allows packages to contain private assemblies that don't conflict with other packages)
17 #monolist=($(printf "%s\n" "${monolist[@]}" | egrep "/gac/"))
18 # Disabled... see ChangeLog
20 # Set the prefix, unless it is overriden (used when building mono rpms)
21 : ${prefix=@prefix@}
23 libdir=$prefix/@reloc_libdir@
24 bindir=$prefix/bin
26 # Bail out if monodis or libmono is missing
27 if [ ! -x $bindir/monodis ] || [ ! -f $libdir/libmono-2.0.so.1 ] ; then
28 echo "monodis missing or unusable, exiting..." 1>&2
29 exit 1
33 # set LD_LIBRARY_PATH to ensure that libmono is found
34 export LD_LIBRARY_PATH=$libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
35 # and set MONO_PATH to ensure that mscorlib.dll can be found
36 export MONO_PATH=$prefix/lib/mono/2.0
38 for i in "${monolist[@]}"; do
39 ($bindir/monodis --assembly $i | awk '
40 BEGIN { LIBNAME=""; VERSION=""; }
41 /^Version:/ { VERSION=$2 }
42 /^Name:/ { LIBNAME=$2 }
43 END {
44 if (LIBNAME ~ /^policy/) {
45 cnt = split(LIBNAME, toks, ".")
46 VERSION=toks[2] "." toks[3] ".0.0"
47 LIBNAME=""
48 for (i=4; i<= cnt; i++)
49 LIBNAME = (LIBNAME toks[i] ".")
50 LIBNAME=substr(LIBNAME, 1, length(LIBNAME)-1)
52 if (VERSION && LIBNAME)
53 print "mono(" LIBNAME ") = " VERSION
55 ') 2>/dev/null
56 done