Rev 2314 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### Copyright (C) 2010 Vix-ERG Limited, All rights reserved## Module name : nsisDirective.pm# Module type : Makefile system# Compiler(s) : Perl# Environment(s): jats## Description : Provides the 'nsisDirective' directive to JATS## Usage : See Below##......................................................................#require 5.008_002;use strict;use warnings;use JatsError;our $ScmPlatform; # Target Platform#-------------------------------------------------------------------------------# Function : MakeNsisPackage## Description : This directive supports the building of Windows Installers# using NSIS. This is a script driven application## Inputs : $platform - Pltaform selector# @elements - Options and arguments## Valid Options and Arguments# --Script=Name - Specifies the script to use# Multiple allowed# --Verbose=n - Specifies verbosity# --Output=Name - Specifies the output EXE# Defaults to useful name# --Define=Name=Value - Send to compiler# --Package=Name - Use this package name instead# of the build's name.# Not suggested# --Plain - No frills### Returns : Will not return on error#sub MakeNsisPackage{my( $platforms, @elements ) = @_;my @scripts;my $vlevel = 2;my $ofile;my @defines;my @genargs;my $package = $ScmBuildPackage;return if ( ! ActivePlatform($platforms) );## Parse the command line arguments#foreach ( @elements ){if ( m~^--Script=(.+)~i ) {push @scripts, $1;} elsif ( m~^--Verbose=(\d+)~i ) {$vlevel = $1;} elsif ( m~^--Output=(.+)~i ) {$ofile = $1;} elsif ( m~^--Define=(.+)~i ) {push @defines, $1;} elsif ( m~^--Plain~i ) {push @genargs, '-Plain';} elsif ( m~^--Package=(.+)~i ) {push @genargs, '-Package=' . $1;$package = $1;} else {Warning ("nsisDirective: Unknown option ignored: $_");}}## Sanity Tests#Error ("nsisDirective: No script specified" ) unless ( @scripts );$vlevel = 4 if ( $vlevel > 4 );$vlevel = 0 if ( $vlevel < 0 );## Create a 'nice' executable name, unless one has been provided# Could have ${GBE_TYPE} suffix, but other windows installers don't## Note: Fix platform to WIN32 incase the installer is based on other# platforms (ie: VS2005) as that would be most confusing.# Could be based on machine type.#unless ( $ofile ){$ofile = "$package-$ScmBuildVersion.$ScmBuildProject-WIN32";}$ofile .= '.exe' unless ( $ofile =~ m~\.exe$~i );## Create build time values in a file suitable for NSIS to include#GenerateFiles ('*', '--Tool=MakeNsisDefs.pl','-installer=' . $ofile,@genargs,'-out=--Generated(JatsNsisDefs.nsh)' );## Invoke 'makensys' to do the hard work#GenerateFiles ('*', 'makensis' ,'--AutoGenerate','--NoVarTag','--UnknownPreq','--CreatedProg='. $ofile,'/NOCONFIG','/NOCD','--Var(BinDir,--tag=/DGBE_BINDIR)','--Var(ObjDir,--tag=/DGBE_OBJDIR)','--Var(Target,--tag=/DGBE_TARGET)','--Var(Type,--tag=/DGBE_TYPE)',(map { '/D' . $_ } @defines),'/V' . $vlevel,'--Prerequisite(JatsNsisDefs.nsh)',map { '--Prerequisite('.$_. ')' } @scripts,);# Package up the EXE#PackageFile ('*', $ofile );}