mono-find-provides 1.7 KB

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