Store filelist in temporary file, do quoting all over the place, and use the build tuple (simplifies comparison between 32 and 64 scripts which are the same)
OBS-URL: https://build.opensuse.org/package/show/windows:mingw:win64/mingw64-filesystem?expand=0&rev=74
This commit is contained in:
parent
0309079717
commit
037efc09a2
@ -2,34 +2,37 @@
|
||||
|
||||
# This script reads filenames from STDIN and outputs any relevant provides
|
||||
# information that needs to be included in the package.
|
||||
target="mingw64"
|
||||
host="x86_64-w64-mingw32"
|
||||
|
||||
if [ "$1" ]
|
||||
then
|
||||
if [ -n "$1" ]; then
|
||||
package_name="$1"
|
||||
fi
|
||||
|
||||
[ -z "$OBJDUMP" ] && OBJDUMP=x86_64-w64-mingw32-objdump
|
||||
[ -z "$OBJDUMP" ] && OBJDUMP="$host-objdump"
|
||||
|
||||
filelist=`sed "s/['\"]/\\\&/g"`
|
||||
filelist="/tmp/$target-find-provides.$$"
|
||||
sed "s/['\"]/\\\&/g" >"$filelist"
|
||||
|
||||
dlls=$(echo $filelist | tr [:blank:] '\n' | grep '\.dll$')
|
||||
pcs=$(echo $filelist | tr [:blank:] '\n' | grep '\.pc$')
|
||||
implibs=$(echo $filelist | tr [:blank:] '\n' | grep '\.a$')
|
||||
dlls=$(grep '\.dll$' "$filelist")
|
||||
pcs=$(grep '\.pc$' "$filelist")
|
||||
implibs=$(grep '\.dll\.a$' "$filelist")
|
||||
|
||||
for f in $dlls; do
|
||||
[ ! -f "$f" ] && continue
|
||||
basename=`basename $f | tr [:upper:] [:lower:]`
|
||||
echo "mingw64($basename)"
|
||||
basename=`basename "$f" | tr "[:upper:]" "[:lower:]"`
|
||||
echo "$target($basename)"
|
||||
done
|
||||
|
||||
for g in $pcs; do
|
||||
[ ! -f "$g" ] && continue
|
||||
dirname=`dirname $g`
|
||||
PKG_CONFIG_PATH=$dirname x86_64-w64-mingw32-pkg-config --print-errors --print-provides $g | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
||||
PKG_CONFIG_PATH="${g%/*}" "$host-pkg-config" --print-errors --print-provides "$g" | awk '{ print "'"$target"'(pkg:"$1")", $2, $3 }'
|
||||
done | sort -u
|
||||
|
||||
for h in $implibs; do
|
||||
[ ! -f "$h" ] && continue
|
||||
libname=`basename $h | sed 's#^lib##g' | sed 's#\.dll\.#\.#g' | sed 's#\.a##g'`
|
||||
echo "mingw64(lib:$libname)"
|
||||
libname=`basename "$h" | sed 's#^lib##g' | sed 's#\.dll\.#\.#g' | sed 's#\.a##g'`
|
||||
echo "$target(lib:$libname)"
|
||||
done
|
||||
|
||||
rm "$filelist"
|
||||
|
@ -2,17 +2,19 @@
|
||||
|
||||
# This script reads filenames from STDIN and outputs any relevant provides
|
||||
# information that needs to be included in the package.
|
||||
target="mingw64"
|
||||
host="x86_64-w64-mingw32"
|
||||
|
||||
if [ "$1" ]
|
||||
then
|
||||
if [ -n "$1" ]; then
|
||||
package_name="$1"
|
||||
fi
|
||||
|
||||
[ -z "$OBJDUMP" ] && OBJDUMP=x86_64-w64-mingw32-objdump
|
||||
[ -z "$OBJDUMP" ] && OBJDUMP="$host-objdump"
|
||||
|
||||
# Get the list of files.
|
||||
|
||||
filelist=`sed "s/['\"]/\\\&/g"`
|
||||
filelist="/tmp/$target-find-requires.$$"
|
||||
sed "s/['\"]/\\\&/g" >"$filelist"
|
||||
|
||||
libs_to_exclude="
|
||||
advapi32
|
||||
@ -64,43 +66,43 @@ libs_to_exclude="
|
||||
|
||||
exclude_pattern=""
|
||||
for i in $libs_to_exclude; do
|
||||
if test "$exclude_pattern" == ""; then
|
||||
exclude_pattern=$i;
|
||||
if [ -z "$exclude_pattern" ]; then
|
||||
exclude_pattern="$i"
|
||||
else
|
||||
exclude_pattern=$exclude_pattern"|"$i;
|
||||
exclude_pattern="$exclude_pattern|$i"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
dlls=$(echo $filelist | tr [:blank:] '\n' | grep -Ei '\.(dll|exe)$')
|
||||
pcs=$(echo $filelist | tr [:blank:] '\n' | grep '\.pc$')
|
||||
configs=$(echo $filelist | tr [:blank:] '\n' | grep 'config$')
|
||||
dlls=$(grep -Ei '\.(dll|exe)$' "$filelist")
|
||||
pcs=$(grep '\.pc$' "$filelist")
|
||||
configs=$(grep 'config$' "$filelist")
|
||||
|
||||
for f in $dlls; do
|
||||
$OBJDUMP -p $f | grep 'DLL Name' | tr [:upper:] [:lower:] |
|
||||
"$OBJDUMP" -p "$f" | grep 'DLL Name' | tr "[:upper:]" "[:lower:]" |
|
||||
grep -Eo '[-._\+[:alnum:]]+\.dll' |
|
||||
grep -Ev "$exclude_pattern" |
|
||||
sed 's/\(.*\)/mingw64(\1)/'
|
||||
sed 's/\(.*\)/'"$target"'(\1)/'
|
||||
done | sort -u
|
||||
|
||||
(
|
||||
for g in $pcs; do
|
||||
dirname=`dirname $g`
|
||||
PKG_CONFIG_PATH=$dirname x86_64-w64-mingw32-pkg-config --print-errors --print-requires $g | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
||||
PKG_CONFIG_PATH=$dirname x86_64-w64-mingw32-pkg-config --print-errors --print-requires-private $g | grep -Ev "$exclude_pattern" | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
||||
for h in `PKG_CONFIG_PATH=$dirname x86_64-w64-mingw32-pkg-config --libs-only-l $g | sed 's#\-l##g'`; do
|
||||
echo "mingw64(lib:$h)"
|
||||
dirname="${g%/*}"
|
||||
PKG_CONFIG_PATH="$dirname" "$host-pkg-config" --print-errors --print-requires $g | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
||||
PKG_CONFIG_PATH="$dirname" "$host-pkg-config" --print-errors --print-requires-private $g | grep -Ev "$exclude_pattern" | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
||||
for h in $(PKG_CONFIG_PATH="$dirname" "$host-pkg-config" --libs-only-l "$g" | sed 's#\-l##g'); do
|
||||
echo "$target(lib:$h)"
|
||||
done
|
||||
done
|
||||
for k in $configs; do
|
||||
for j in `PKG_CONFIG=x86_64-w64-mingw32-pkg-config $k --libs`; do
|
||||
case $j in
|
||||
for j in $(PKG_CONFIG="$host-pkg-config" "$k" --libs); do
|
||||
case "$j" in
|
||||
-l*)
|
||||
echo $j | sed 's#\-l##g' | grep -Ev "$exclude_pattern" | awk '{ print "mingw64(lib:"$1")" }'
|
||||
echo "$j" | sed 's#\-l##g' | grep -Ev "$exclude_pattern" | awk '{ print "'"$target"'(lib:"$1")" }'
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
) | sort -u
|
||||
|
||||
rm "$filelist"
|
||||
|
Loading…
x
Reference in New Issue
Block a user