From 657d8c480d8b63c7d00b82e811e796801e836222 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Added --run option. --- nsiswrapper/nsiswrapper.pl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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 () -- 1.8.3.1