6 # Ben Maurer (bmaurer@ximian.com)
8 # (C) 2005 Novell (http://www.novell.com)
12 filelist
=($
(grep -Ev '/usr/doc/|/usr/share/doc/'))
13 monolist
=($
(printf "%s\n" "${filelist[@]}" |
egrep "\\.(exe|dll)\$"))
15 # parse .config files to find which native libraries to depend on
16 # (target attribute must have double quotes for this to work, ie: target="file" )
17 # Add /etc/mono/config ?
18 configlist
=($
(printf "%s\n" "${filelist[@]}" |
egrep "\\.config\$"))
20 # Set the prefix, unless it is overriden (used when building mono rpms)
23 libdir
=$prefix/@reloc_libdir@
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
32 # special case for 64bit archs
33 if test "x@reloc_libdir@" = "xlib64" ; then
39 # set LD_LIBRARY_PATH to ensure that libmono.so is found
40 export LD_LIBRARY_PATH
=$libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
43 for i
in "${monolist[@]}"; do
44 ($bindir/monodis
--assemblyref $i |
awk '
45 BEGIN { START=0; LIBNAME=""; VERSION=""; }
46 (START==0) && /^[0-9]+: Version=/ {
48 sub(/Version=/, "", $2);
52 (START==1) && /^\tName=/ {
55 # Allow rpm deps to be resolved for 1.0 profile version
56 if (VERSION=="1.0.3300.0")
60 print "mono(" LIBNAME ") " OP " " VERSION
65 # Parse the xml .config files to see what native binaries we call into
66 # TODO: also check monodis --moduleref
67 for i
in "${configlist[@]}"; do
68 awk 'match($_, /<dllmap .*target=.*/) {
73 for(tok in toks) { toks_size++ }
74 for(i=1; i <= toks_size; i++) {
75 if(toks[i] ~ /target=/) {
84 attr=substr(attr, 2, length(attr)-1)
88 split(attr, os_targets, ",")
90 for(os_target in os_targets) { os_targets_size++ }
91 for(j=1; j <= os_targets_size; j++) {
92 if(os_targets[j] == "linux") {
106 system("rpm -q --whatprovides --queryformat \"%{NAME}\n\" ""\""req"'$libext'""\"")
113 for i
in "${monolist[@]}"; do
114 ($bindir/monodis
--assembly $i |
awk '
115 BEGIN { LIBNAME=""; VERSION=""; }
116 /^Version:/ { VERSION=$2 }
117 /^Name:/ { LIBNAME=$2 }
119 if (VERSION && LIBNAME)
120 print "mono(" LIBNAME ") = " VERSION
126 # This is a little magic trick to get all REQUIRES that are not
127 # in PROVIDES. While RPM functions correctly when such deps exist,
128 # they make the metadata a bit bloated.
131 # Filter out dups from both lists
132 REQUIRES
=$
(echo "$REQUIRES" |
sort |
uniq)
133 PROVIDES
=$
(echo "$PROVIDES" |
sort |
uniq)
136 # Get a list of elements that exist in exactly one of PROVIDES or REQUIRES
138 UNIQ
=$
(echo "$PROVIDES
139 $REQUIRES" |
sort |
uniq -u)
142 # Of those, only choose the ones that are in REQUIRES
145 $REQUIRES" |
sort |
uniq -d