[mingw-nsiswrapper] Generate the list of DLLs programmatically (RHBZ#856354).

Richard W.M. Jones rjones at fedoraproject.org
Sat Jul 13 12:51:41 UTC 2013


commit cdb82a6295627d23cfc0b47fdfa15156636364b3
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sat Jul 13 13:45:41 2013 +0100

    Generate the list of DLLs programmatically (RHBZ#856354).
    
    - Remove 'Group' line, unnecessary for modern RPM.
    - Add simple check section.

 mingw-nsiswrapper.spec |   15 ++++++++++--
 nsiswrapper.pl         |   54 +++++++++++++++++++++++++++++------------------
 2 files changed, 45 insertions(+), 24 deletions(-)
---
diff --git a/mingw-nsiswrapper.spec b/mingw-nsiswrapper.spec
index b86b494..07abbc7 100644
--- a/mingw-nsiswrapper.spec
+++ b/mingw-nsiswrapper.spec
@@ -1,11 +1,11 @@
 Name:           mingw-nsiswrapper
-Version:        9
-Release:        6%{?dist}
+Version:        10
+Release:        1%{?dist}
 Summary:        Helper program for making NSIS Windows installers
 
 License:        GPLv2+
-Group:          Development/Libraries
 URL:            http://fedoraproject.org/wiki/MinGW
+
 Source0:        nsiswrapper.pl
 Source1:        README
 Source2:        COPYING
@@ -49,6 +49,10 @@ installer script that NSIS needs.
 # empty
 
 
+%check
+perl -Tc %{SOURCE0}
+
+
 %install
 mkdir -p $RPM_BUILD_ROOT%{_bindir}
 install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT%{_bindir}/nsiswrapper
@@ -72,6 +76,11 @@ pod2man -c "NSIS" -r "%{name}-%{version}" %{SOURCE0} \
 
 
 %changelog
+* Sat Jul 13 2013 Richard W.M. Jones <rjones at redhat.com> - 10-1
+- Generate the list of DLLs programmatically (RHBZ#856354).
+- Remove 'Group' line, unnecessary for modern RPM.
+- Add simple check section.
+
 * Fri Feb 22 2013 Ivan Romanov <drizt at land.ru> - 9-6
 - pod2man now is in perl-podlators (#914187)
 
diff --git a/nsiswrapper.pl b/nsiswrapper.pl
index e673b98..c766e16 100755
--- a/nsiswrapper.pl
+++ b/nsiswrapper.pl
@@ -487,30 +487,42 @@ sub get_deps_for_file
     return @deps;
 }
 
+my %dlls = ();
+
+sub get_windows_system_dlls
+{
+    return if keys %dlls > 0;
+
+    local $_;
+
+    # https://bugzilla.redhat.com/show_bug.cgi?id=856354#c6
+    my $cmd = q{
+        set -e
+        for pkg in mingw32-filesystem mingw64-filesystem; do
+            if rpm -q $pkg >/dev/null 2>&1; then
+                rpm -q --provides $pkg
+            fi
+        done
+    };
+    open PROVIDES, "$cmd |" or die "$!";
+    while (<PROVIDES>) {
+        chomp;
+        $dlls{$1} = 1 if m/^mingw.*\((.*\.dll)\)/
+    }
+    close PROVIDES or die "$!";
+
+    #print "DLLs = ", join (",", keys %dlls), "\n";
+
+    die if keys %dlls == 0;
+}
+
 sub is_windows_system_dll
 {
-    local $_ = shift;
+    my $dll_wanted = shift;
+
+    get_windows_system_dlls ();
 
-    $_ eq 'gdi32.dll' ||
-	$_ eq 'kernel32.dll' ||
-	$_ eq 'ole32.dll' ||
-	$_ eq 'mscoree.dll' ||
-	$_ eq 'msvcrt.dll' ||
-	$_ eq 'user32.dll' ||
-	$_ eq 'advapi32.dll' ||
-	$_ eq 'comctl32.dll' ||
-	$_ eq 'comdlg32.dll' ||
-	$_ eq 'imm32.dll' ||
-	$_ eq 'msimg32.dll' ||
-	$_ eq 'oleaut32.dll' ||
-	$_ eq 'shell32.dll' ||
-	$_ eq 'shlwapi.dll' ||
-	$_ eq 'winmm.dll' ||
-	$_ eq 'wsock32.dll' ||
-	$_ eq 'ws2_32.dll' ||
-	$_ eq 'wldap32.dll' ||
-	$_ eq 'version.dll' ||
-	$_ eq 'dnsapi.dll'
+    return exists $dlls{$dll_wanted};
 }
 
 # Add Gtk dependencies, if --with-gtk.


More information about the scm-commits mailing list