* s390x-codegen.h: Fix immediate checks.
[mono.git] / scripts / mono-find-requires.in
blob446d9fcfd2da452347b4bf3c8a7340dff66bb6e9
1 #!/bin/bash
3 # mono-find-requires
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 a=`which "$0"`
16 d=`dirname "$a"`
18 # Set the prefix, unless it is overriden (used when building mono rpms)
19 : ${prefix=$d/..}
21 exec_prefix=$d/..
22 libdir=$prefix/@reloc_libdir@
23 bindir=$d
25 [ -x $bindir/monodis ] || exit 0;
26 [ -f $libdir/libmono.so ] || exit 0;
29 # set LD_LIBRARY_PATH to ensure that libmono.so is found
30 export LD_LIBRARY_PATH=$libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
32 REQUIRES=$(
33 for i in "${monolist[@]}"; do
34 ($bindir/monodis --assemblyref $i | awk '
35 BEGIN { START=0; LIBNAME=""; VERSION=""; }
36 (START==0) && /^[0-9]+: Version=/ {
37 START=1;
38 sub(/Version=/, "", $2);
39 VERSION=$2
42 (START==1) && /^\tName=/ {
43 sub(/Name=/, "", $1);
44 LIBNAME=$1
46 print "mono(" LIBNAME ") = " VERSION
47 START=0
49 ') 2> /dev/null
50 done
53 PROVIDES=$(
54 for i in "${monolist[@]}"; do
55 ($bindir/monodis --assembly $i | awk '
56 BEGIN { LIBNAME=""; VERSION=""; }
57 /^Version:/ { VERSION=$2 }
58 /^Name:/ { LIBNAME=$2 }
59 END {
60 if (VERSION && LIBNAME)
61 print "mono(" LIBNAME ") = " VERSION
63 ') 2>/dev/null
64 done
67 # This is a little magic trick to get all REQUIRES that are not
68 # in PROVIDES. While RPM functions correctly when such deps exist,
69 # they make the metadata a bit bloated.
72 # Filter out dups from both lists
73 REQUIRES=$(echo "$REQUIRES" | sort | uniq)
74 PROVIDES=$(echo "$PROVIDES" | sort | uniq)
77 # Get a list of elements that exist in exactly one of PROVIDES or REQUIRES
79 UNIQ=$(echo "$PROVIDES
80 $REQUIRES" | sort | uniq -u)
83 # Of those, only chose the ones that are in REQUIRES
85 echo "$UNIQ
86 $REQUIRES" | sort | uniq -d