mingw-filesystem/SOURCES/mingw.req

54 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2022-05-17 09:47:43 +00:00
#!/bin/bash
# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.
[ -z "$OBJDUMP" ] && OBJDUMP=mingw-objdump
targets=$@
if [ -z "$targets" ] ; then
2022-11-15 06:34:24 +00:00
echo "Usage: $0 [ mingw32 ] [ mingw64 ] [ ucrt64 ]"
2022-05-17 09:47:43 +00:00
exit 1
fi
# Get the list of files.
filelist=`sed "s/['\"]/\\\&/g"`
2022-11-15 06:34:24 +00:00
dlls=$(echo $filelist | tr '[:blank:]' '\n' | grep -Ei '\.(dll|exe|pyd)$')
2022-05-17 09:47:43 +00:00
pkgconfig_files=$(echo $filelist | tr '[:blank:]' '\n' | grep -Ei '\.(pc)$')
for target in $targets; do
dll_found=false
host_triplet=`rpm --eval "%{${target}_target}"`
2022-11-15 06:34:24 +00:00
libdir=`rpm --eval "%{${target}_libdir}"`
2022-05-17 09:47:43 +00:00
for f in $dlls; do
if [[ $f =~ .*$host_triplet.* ]]; then
$OBJDUMP -p $f | grep 'DLL Name' | grep -Eio '[-._\+[:alnum:]]+\.dll' |
2022-11-15 06:34:24 +00:00
tr '[:upper:]' '[:lower:]' |
2022-05-17 09:47:43 +00:00
sed "s/\(.*\)/$target(\1)/"
dll_found=true
fi
done
# Add a dependency on filesystem and crt if necessary
if [ $dll_found = true ]; then
echo "${target}-filesystem >= 95"
echo "${target}-crt"
fi
2022-11-15 06:34:24 +00:00
# Add a dependency on $target-pkg-config if necessary
2022-05-17 09:47:43 +00:00
pkgconfig_files_found=false
for f in $pkgconfig_files; do
if [[ $f =~ .*$host_triplet.* ]]; then
pkgconfig_files_found=true
2022-11-15 06:34:24 +00:00
break
2022-05-17 09:47:43 +00:00
fi
done
if [ $pkgconfig_files_found = true ]; then
echo "${target}-pkg-config"
fi
2022-11-15 06:34:24 +00:00
2022-05-17 09:47:43 +00:00
done | sort -u