From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Wed, 8 Oct 2008 14:12:45 +0000 (+0100) Subject: Added --run option. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=657d8c480d8b63c7d00b82e811e796801e836222;p=fedora-mingw.git Added --run option. --- diff --git a/nsiswrapper/nsiswrapper.pl b/nsiswrapper/nsiswrapper.pl index 344e5c0..f0eafb8 100755 --- a/nsiswrapper/nsiswrapper.pl +++ b/nsiswrapper/nsiswrapper.pl @@ -22,6 +22,7 @@ use strict; use Getopt::Long; use Pod::Usage; +use File::Temp qw/tempfile/; =pod @@ -162,10 +163,12 @@ This is the same as the C option to NSIS. =cut my $objdump; +my %files; + my $help = ''; my $man = ''; my $verbose = ''; -my %files; +my $run = ''; my $name = ''; my $outfile = 'installer.exe'; my $installdir = ''; @@ -177,6 +180,7 @@ sub get_options "help|?" => \$help, "man" => \$man, "verbose" => \$verbose, + "run" => \$run, "name=s" => \$name, "outfile=s" => \$outfile, "installdir=s" => \$installdir, @@ -612,7 +616,15 @@ Section -post WriteUninstaller "\$INSTDIR\\Uninstall $name.exe" SectionEnd EOT +} +# Run makensis on the named file. + +sub run_makensis +{ + my $filename = shift; + + system ("makensis", $filename) == 0 or die "makensis: $?" } # Main program. @@ -625,7 +637,14 @@ sub main do_dependencies (); install_names (); print_files () if $verbose; - write_script (\*STDOUT); + if ($run) { + my ($io, $filename) = tempfile ("nswXXXXXX", UNLINK => 1); + write_script ($io); + close $io; + run_makensis ($filename); + } else { + write_script (\*STDOUT); + } } main ()