hi,
i rewrite all mingw-find- scripts since the build targets was hardcoded
into these.
the mingw-find-requires already has a bug since the *ddl_found if never
be true since the win32/64_dll_found=true was inside a pipe which cause
it to be local variable of the subshell.
i hope these also can be applied.

both of the macro and this patch are backward compatible with the
current filesystem macro and files scripts. so those who wouldn't like
to use the the mingwtool script still can use the old long spec files.

-- 
  Levente                               "Si vis pacem para bellum!"
Index: mingw-find-requires.sh
===================================================================
--- mingw-find-requires.sh      (revision 99)
+++ mingw-find-requires.sh      (working copy)
@@ -5,7 +5,7 @@
 
 if [ "$1" ]
 then
-   package_name="$1"
+       package_name="$1"
 fi
 
 [ -z "$OBJDUMP" ] && OBJDUMP=mingw-objdump
@@ -15,34 +15,22 @@
 filelist=`sed "s/['\"]/\\\&/g"`
 
 dlls=$(echo $filelist | tr [:blank:] '\n' | grep -Ei '\.(dll|exe)$')
-win32_dll_found=false
-win64_dll_found=false
 
-for f in $dlls; do
-    case "$f" in
-        *x86_64-w64-mingw32*)
-            $OBJDUMP -p $f | grep 'DLL Name' | grep -Eo 
'[-._\+[:alnum:]]+\.dll' |
-                tr [:upper:] [:lower:] |
-                sed 's/\(.*\)/mingw64(\1)/'
-            win32_dll_found=true
-            ;;
-
-        *i686-w64-mingw32*)
-            $OBJDUMP -p $f | grep 'DLL Name' | grep -Eo 
'[-._\+[:alnum:]]+\.dll' |
-                tr [:upper:] [:lower:] |
-                sed 's/\(.*\)/mingw32(\1)/'
-            win64_dll_found=true
-            ;;
-    esac
+targets=`rpm --eval '%{mingw_build_targets}'`
+for target in $targets; do
+       dll_found=false
+       path=`rpm --eval "%{${target}_target}"`
+       for f in $dlls; do
+               if [[ $f =~ .*$path.* ]]; then
+                       $OBJDUMP -p $f | grep 'DLL Name' | grep -Eio 
'[-._\+[:alnum:]]+\.dll' |
+                               tr [:upper:] [:lower:] |
+                               sed "s/\(.*\)/$target(\1)/"
+                       dll_found=true
+               fi
+       done
+       # Add a dependency on filesystem and crt if necessary
+       if [ $dll_found ]; then
+               echo "${target}-filesystem >= 74"
+               echo "${target}-crt"
+       fi
 done | sort -u
-
-# Add a dependency on mingw{32,64}-filesystem and mingw{32,64}-crt if necessary
-if test "$win32_dll_found" = "true" ; then
-    echo 'mingw32-filesystem >= 70'
-    echo 'mingw32-crt'
-fi
-if test "$win64_dll_found" = "true" ; then
-    echo 'mingw64-filesystem >= 70'
-    echo 'mingw64-crt'
-fi
-
Index: mingw-find-provides.sh
===================================================================
--- mingw-find-provides.sh      (revision 99)
+++ mingw-find-provides.sh      (working copy)
@@ -5,23 +5,20 @@
 
 if [ "$1" ]
 then
-   package_name="$1"
+    package_name="$1"
 fi
 
 filelist=`sed "s/['\"]/\\\&/g"`
 
 dlls=$(echo $filelist | tr [:blank:] '\n' | grep '\.dll$')
 
-# MinGW
+targets=`rpm --eval '%{mingw_build_targets}'`
 for f in $dlls; do
     basename=`basename $f | tr [:upper:] [:lower:]`
-    case "$f" in
-        *x86_64-w64-mingw32*)
-            echo "mingw64($basename)"
-            ;;
-
-        *i686-w64-mingw32*)
-            echo "mingw32($basename)"
-            ;;
-    esac
+    for target in $targets; do
+        path=`rpm --eval "%{${target}_target}"`
+        [[ $f =~ .*$path.* ]] && echo "$target($basename)"
+    done
 done
+
+exit 0
Index: mingw-find-debuginfo.sh
===================================================================
--- mingw-find-debuginfo.sh     (revision 99)
+++ mingw-find-debuginfo.sh     (working copy)
@@ -31,13 +31,10 @@
        find $RPM_BUILD_ROOT -type f -name "*.exe.debug" -or -name 
"*.dll.debug" |
             sed -n -e "s#^$RPM_BUILD_ROOT##p" > $BUILDDIR/debugfiles.list
 else
-       MINGW32_PREFIX=`rpm --eval "%{mingw32_prefix}"`
-       MINGW64_PREFIX=`rpm --eval "%{mingw64_prefix}"`
-
-       find $RPM_BUILD_ROOT$MINGW32_PREFIX -type f -name "*.exe.debug" -or 
-name "*.dll.debug" |
-           sed -n -e "s#^$RPM_BUILD_ROOT##p" > 
$BUILDDIR/mingw32-debugfiles.list
-
-       find $RPM_BUILD_ROOT$MINGW64_PREFIX -type f -name "*.exe.debug" -or 
-name "*.dll.debug" |
-           sed -n -e "s#^$RPM_BUILD_ROOT##p" > 
$BUILDDIR/mingw64-debugfiles.list
+       shift 
+       for target in $@; do
+               prefix=`rpm --eval "%{${target}_prefix}"`
+               find $RPM_BUILD_ROOT$prefix -type f -name "*.exe.debug" -or 
-name "*.dll.debug" |
+                       sed -n -e "s#^$RPM_BUILD_ROOT##p" > 
$BUILDDIR/${target}-debugfiles.list
+       done
 fi
-

Attachment: mingw-find-files.sh
Description: application/shellscript

_______________________________________________
mingw mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/mingw

Reply via email to