summaryrefslogtreecommitdiffstats
path: root/cygwin-find-requires.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cygwin-find-requires.sh')
-rwxr-xr-xcygwin-find-requires.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/cygwin-find-requires.sh b/cygwin-find-requires.sh
new file mode 100755
index 0000000..871c768
--- /dev/null
+++ b/cygwin-find-requires.sh
@@ -0,0 +1,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