summaryrefslogtreecommitdiffstats
path: root/cygwin-find-requires.sh
blob: 871c76827e7ec7832da79df05e9a9d2e12715247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.

if [ "$1" ]
then
   package_name="$1"
fi

[ -z "$OBJDUMP" ] && OBJDUMP=i686-pc-cygwin-objdump

# Get the list of files.

filelist=`sed "s/['\"]/\\\&/g"`

# Everything requires cygwin-filesystem of at least the current version
# and cygwin.
echo 'cygwin-filesystem >= @VERSION@'

dlls=$(echo $filelist | tr [:blank:] '\n' | grep -Ei '\.(dll|exe)$')

for f in $dlls; do
    $OBJDUMP -p $f | grep 'DLL Name' | grep -Eo '[-._\+[:alnum:]]+\.dll' |
        tr [:upper:] [:lower:] |
        sed 's/\(.*\)/cygwin(\1)/'
done | sort -u