2007-07-11 Jb Evain <jbevain@novell.com>
[mono.git] / scripts / mono-find-provides.in
blobac9d1c83aeb5528f6668f09472d0f68c05b3a43d
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.so ] ; then
28 echo "monodis missing or unusable, exiting..." 1>&2
29 exit 1
33 # set LD_LIBRARY_PATH to ensure that libmono.so is found
34 export LD_LIBRARY_PATH=$libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
36 for i in "${monolist[@]}"; do
37 ($bindir/monodis --assembly $i | awk '
38 BEGIN { LIBNAME=""; VERSION=""; }
39 /^Version:/ { VERSION=$2 }
40 /^Name:/ { LIBNAME=$2 }
41 END {
42 if (LIBNAME ~ /^policy/) {
43 cnt = split(LIBNAME, toks, ".")
44 VERSION=toks[2] "." toks[3] ".0.0"
45 LIBNAME=""
46 for (i=4; i<= cnt; i++)
47 LIBNAME = (LIBNAME toks[i] ".")
48 LIBNAME=substr(LIBNAME, 1, length(LIBNAME)-1)
50 if (VERSION && LIBNAME)
51 print "mono(" LIBNAME ") = " VERSION
53 ') 2>/dev/null
54 done