Rev 361 | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### Copyright (C) 1998-2004 ERG Limited, All rights reserved## Module name : gen_winrc.pl# Module type : Makefile system# Compiler(s) : n/a# Environment(s):## Description : A script to generate a RC file# Provided for backward compatablity only# Use BuildVersion ( '--Style=WinRc', ... );## The script will:# Take user options# Create a .rc file##......................................................................#require 5.006_001;use strict;use warnings;use JatsError;use BuildVersion;use Getopt::Long;use Pod::Usage; # required for help supportuse Cwd;my $VERSION = "1.2.0"; # Update this## Options#my $opt_outfile;my $opt_version;my $opt_comment;my $opt_product;my $opt_name;my $opt_description;my $opt_defs_only;my $opt_icon;my $opt_help = 0;my $opt_debug = $ENV{'GBE_DEBUG'} || 0; # Allow global debugmy $opt_verbose = $ENV{'GBE_VERBOSE'} || 0; # Allow global verbose## Global variables# Used to allow the re-use of BuildVersion.pm#our $CurrentYear;our $CurrentTime;our $BuildVersion;#-------------------------------------------------------------------------------# Entry : Main program entry## Inputs : Options and arguments on the command line#my $result = GetOptions ("help:+" => \$opt_help,"manual:3" => \$opt_help,"verbose:+" => \$opt_verbose,"out:s" => \$opt_outfile,"version:s" => \$opt_version,"comment:s" => \$opt_comment,"product:s" => \$opt_product,"name:s" => \$opt_name,"description:s" => \$opt_description,"definitions" => \$opt_defs_only,"icon:s" => \$opt_icon,);## UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!### Process help and manual options#pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);pod2usage(-verbose => 1) if ($opt_help == 2 );pod2usage(-verbose => 2) if ($opt_help > 2);## Configure the Error reporting process now that we have the user options#ErrorConfig( 'name' =>'GENRC', 'verbose' => $opt_verbose );## Validate user options# Not expecting any user arguments, other than options, so spit if any are found#Error ("Unexpected command line arguments present" )if ( $#ARGV >= 0 );## Sanity test of user arguments#Error ("No output file specified") unless ( $opt_outfile );Error ("No version specified") unless ( $opt_version );Error ("No name specified") unless ( $opt_name );## Use BuildVersionWinRC to do the hard work# Create an option call list for this function#my @args = '--ToolUse';push @args, "--Version=$opt_version" if ( $opt_version );push @args, "--Comment=$opt_comment" if ( $opt_comment );push @args, "--Product=$opt_product" if ( $opt_product );push @args, "--PkgName=$opt_name" if ( $opt_name );push @args, "--Description=$opt_description" if ( $opt_description );push @args, "--Definitions" if ( $opt_defs_only );push @args, "--Icon=$opt_icon" if ( $opt_icon );## Keep the Module Happy# Provide globals used by the module#$CurrentTime = localtime;my ($sec, $min, $hour, $mday, $mon, $year) = localtime();$CurrentYear = 1900 + $year;$BuildVersion = 'Unknown';## Invoke the same class used by the jats build process to create# the Resource File.#BuildVersionWinRC ( $opt_outfile, @args );exit 0;#-------------------------------------------------------------------------------# Documentation#=pod=for htmltoc MAKEUTIL::=head1 NAMEgen_winrc.pl - Generate a Windows RC file=head1 SYNOPSISgen_winrc.pl [arguments] ...Arguments:-help - brief help message-help -help - Detailed help message-man - Full documentation-verbose - Verbose informationMandatory-out file - Name of the output file-version nn.nn.nn - Release version-name string - Program NameOptional-comment string - Comment string-description string - Description string-definitions - Only generate the definitions-icon filename - The name of an icon file=head1 OPTIONS=over 8=item -helpPrint a brief help message and exits.=item -help -helpPrint a detailed help message with an explanation for each option.=item -manPrints the manual page and exits.=item -verboseIncrease the level of debugging information displayed. This option may be usedmultiple times.=item -out fileSpecifies the name of the output file. The option is mandatory.=item -version nn.nn.nnSpecify the version to include include in the resource file. This must be ofthe form nn.nn.nn, where nn is a decimal digit.Within a JATS makefile the value of $ScmBuildVersion may be used.The option is mandatory.=item -name stringSpecify the name of the program. The option is mandatory.Within a JATS makefile the value of $ScmBuildPackage may be used.=item -comment stringSpecify an optional comment string. If the string contains whitespace then itemshould be enclosed in quotes.=item -description stringSpecify an optional description string. If the string contains whitespace then itemshould be enclosed in quotes.=item -definitionsThis option will only write out a file that contains the definitions. The bodyof the resource script will not be generated. The file that is generated maybe included within another resource file.=item -icon filenameThis option will add the specified icon file to the resource being created.The icon will appear against the DLL.=back=head1 DESCRIPTIONThis program will generate a basic Windows resource file that contains theprogram name and version number. The resulting file may then be included inanother resource file, or used directly to generate a basic program resource.=for htmlclass NoteNote: Use of this utility has been deprecated in favour of the BuildVersiondirective that performs the same operation with a simpler interface.=head1 EXAMPLE=head2 Used within makefile.pl - BasicGenerateFiles ('WIN32', "--Tool=gen_winrc.pl","-out --GeneratedCommon(prog.rc)","-version=$ScmBuildVersion","-comment='This is a comment'","-name=$ScmBuildPackage","-description='This is a description'","--NoWarn" );Prog ( '*' , "MyProg", @OBJS );Prog ( 'WIN32', "MyProg", "--Resource=prog.rc" );The resource script will be generated with basic information. It can then beadded to the program or DLL as required.=cut