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
|
# This script reads filenames from STDIN and outputs any relevant provides
|
||||||
# information that needs to be included in the package.
|
# information that needs to be included in the package.
|
||||||
|
target="mingw64"
|
||||||
|
host="x86_64-w64-mingw32"
|
||||||
|
|
||||||
if [ "$1" ]
|
if [ -n "$1" ]; then
|
||||||
then
|
|
||||||
package_name="$1"
|
package_name="$1"
|
||||||
fi
|
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$')
|
dlls=$(grep '\.dll$' "$filelist")
|
||||||
pcs=$(echo $filelist | tr [:blank:] '\n' | grep '\.pc$')
|
pcs=$(grep '\.pc$' "$filelist")
|
||||||
implibs=$(echo $filelist | tr [:blank:] '\n' | grep '\.a$')
|
implibs=$(grep '\.dll\.a$' "$filelist")
|
||||||
|
|
||||||
for f in $dlls; do
|
for f in $dlls; do
|
||||||
[ ! -f "$f" ] && continue
|
[ ! -f "$f" ] && continue
|
||||||
basename=`basename $f | tr [:upper:] [:lower:]`
|
basename=`basename "$f" | tr "[:upper:]" "[:lower:]"`
|
||||||
echo "mingw64($basename)"
|
echo "$target($basename)"
|
||||||
done
|
done
|
||||||
|
|
||||||
for g in $pcs; do
|
for g in $pcs; do
|
||||||
[ ! -f "$g" ] && continue
|
[ ! -f "$g" ] && continue
|
||||||
dirname=`dirname $g`
|
PKG_CONFIG_PATH="${g%/*}" "$host-pkg-config" --print-errors --print-provides "$g" | awk '{ print "'"$target"'(pkg:"$1")", $2, $3 }'
|
||||||
PKG_CONFIG_PATH=$dirname x86_64-w64-mingw32-pkg-config --print-errors --print-provides $g | awk '{ print "mingw64(pkg:"$1")", $2, $3 }'
|
|
||||||
done | sort -u
|
done | sort -u
|
||||||
|
|
||||||
for h in $implibs; do
|
for h in $implibs; do
|
||||||
[ ! -f "$h" ] && continue
|
[ ! -f "$h" ] && continue
|
||||||
libname=`basename $h | sed 's#^lib##g' | sed 's#\.dll\.#\.#g' | sed 's#\.a##g'`
|
libname=`basename "$h" | sed 's#^lib##g' | sed 's#\.dll\.#\.#g' | sed 's#\.a##g'`
|
||||||
echo "mingw64(lib:$libname)"
|
echo "$target(lib:$libname)"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm "$filelist"
|
||||||
|
@ -2,17 +2,19 @@
|
|||||||
|
|
||||||
# This script reads filenames from STDIN and outputs any relevant provides
|
# This script reads filenames from STDIN and outputs any relevant provides
|
||||||
# information that needs to be included in the package.
|
# information that needs to be included in the package.
|
||||||
|
target="mingw64"
|
||||||
|
host="x86_64-w64-mingw32"
|
||||||
|
|
||||||
if [ "$1" ]
|
if [ -n "$1" ]; then
|
||||||
then
|
|
||||||
package_name="$1"
|
package_name="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$OBJDUMP" ] && OBJDUMP=x86_64-w64-mingw32-objdump
|
[ -z "$OBJDUMP" ] && OBJDUMP="$host-objdump"
|
||||||
|
|
||||||
# Get the list of files.
|
# Get the list of files.
|
||||||
|
|
||||||
filelist=`sed "s/['\"]/\\\&/g"`
|
filelist="/tmp/$target-find-requires.$$"
|
||||||
|
sed "s/['\"]/\\\&/g" >"$filelist"
|
||||||
|
|
||||||
libs_to_exclude="
|
libs_to_exclude="
|
||||||
advapi32
|
advapi32
|
||||||
@ -64,43 +66,43 @@ libs_to_exclude="
|
|||||||
|
|
||||||
exclude_pattern=""
|
exclude_pattern=""
|
||||||
for i in $libs_to_exclude; do
|
for i in $libs_to_exclude; do
|
||||||
if test "$exclude_pattern" == ""; then
|
if [ -z "$exclude_pattern" ]; then
|
||||||
exclude_pattern=$i;
|
exclude_pattern="$i"
|
||||||
else
|
else
|
||||||
exclude_pattern=$exclude_pattern"|"$i;
|
exclude_pattern="$exclude_pattern|$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
dlls=$(echo $filelist | tr [:blank:] '\n' | grep -Ei '\.(dll|exe)$')
|
dlls=$(grep -Ei '\.(dll|exe)$' "$filelist")
|
||||||
pcs=$(echo $filelist | tr [:blank:] '\n' | grep '\.pc$')
|
pcs=$(grep '\.pc$' "$filelist")
|
||||||
configs=$(echo $filelist | tr [:blank:] '\n' | grep 'config$')
|
configs=$(grep 'config$' "$filelist")
|
||||||
|
|
||||||
for f in $dlls; do
|
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 -Eo '[-._\+[:alnum:]]+\.dll' |
|
||||||
grep -Ev "$exclude_pattern" |
|
grep -Ev "$exclude_pattern" |
|
||||||
sed 's/\(.*\)/mingw64(\1)/'
|
sed 's/\(.*\)/'"$target"'(\1)/'
|
||||||
done | sort -u
|
done | sort -u
|
||||||
|
|
||||||
(
|
(
|
||||||
for g in $pcs; do
|
for g in $pcs; do
|
||||||
dirname=`dirname $g`
|
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" "$host-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 }'
|
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 x86_64-w64-mingw32-pkg-config --libs-only-l $g | sed 's#\-l##g'`; do
|
for h in $(PKG_CONFIG_PATH="$dirname" "$host-pkg-config" --libs-only-l "$g" | sed 's#\-l##g'); do
|
||||||
echo "mingw64(lib:$h)"
|
echo "$target(lib:$h)"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
for k in $configs; do
|
for k in $configs; do
|
||||||
for j in `PKG_CONFIG=x86_64-w64-mingw32-pkg-config $k --libs`; do
|
for j in $(PKG_CONFIG="$host-pkg-config" "$k" --libs); do
|
||||||
case $j in
|
case "$j" in
|
||||||
-l*)
|
-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
|
esac
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
) | sort -u
|
) | sort -u
|
||||||
|
|
||||||
|
rm "$filelist"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user