Subversion Repositories DevTools

Rev

Rev 5709 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
########################################################################
6177 dpurdie 2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
227 dpurdie 3
#
4
# Module name   : gen_winrc.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s):
8
#
9
# Description   : A script to generate a RC file
267 dpurdie 10
#                 Provided for backward compatablity only
11
#                 Use BuildVersion ( '--Style=WinRc', ... );
12
#
227 dpurdie 13
#                 The script will:
14
#                   Take user options
15
#                   Create a .rc file
16
#
17
#......................................................................#
18
 
255 dpurdie 19
require 5.006_001;
227 dpurdie 20
use strict;
21
use warnings;
22
 
23
use JatsError;
267 dpurdie 24
use BuildVersion;
227 dpurdie 25
use Getopt::Long;
26
use Pod::Usage;                             # required for help support
27
use Cwd;
28
 
267 dpurdie 29
my $VERSION = "1.2.0";                      # Update this
227 dpurdie 30
 
31
#
32
#   Options
33
#
34
my $opt_outfile;
35
my $opt_version;
36
my $opt_comment;
37
my $opt_product;
38
my $opt_name;
39
my $opt_description;
40
my $opt_defs_only;
41
my $opt_icon;
42
 
43
my $opt_help = 0;
44
my $opt_debug   = $ENV{'GBE_DEBUG'}     || 0;      # Allow global debug
45
my $opt_verbose = $ENV{'GBE_VERBOSE'}   || 0;      # Allow global verbose
46
 
47
#
48
#   Global variables
267 dpurdie 49
#   Used to allow the re-use of BuildVersion.pm
227 dpurdie 50
#
267 dpurdie 51
our $CurrentYear;
52
our $CurrentTime;
53
our $BuildVersion;
227 dpurdie 54
 
55
#-------------------------------------------------------------------------------
56
# Entry           : Main program entry
57
#
58
# Inputs          : Options and arguments on the command line
59
#
60
my $result = GetOptions (
267 dpurdie 61
                "help:+"        => \$opt_help,
62
                "manual:3"      => \$opt_help,
63
                "verbose:+"     => \$opt_verbose,
227 dpurdie 64
 
65
                "out:s"         => \$opt_outfile,
66
                "version:s"     => \$opt_version,
67
                "comment:s"     => \$opt_comment,
68
                "product:s"     => \$opt_product,
69
                "name:s"        => \$opt_name,
70
                "description:s" => \$opt_description,
71
                "definitions"   => \$opt_defs_only,
72
                "icon:s"        => \$opt_icon,
73
 
74
                );
75
 
76
                #
77
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
78
                #
79
 
80
#
81
#   Process help and manual options
82
#
83
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
84
pod2usage(-verbose => 1)  if ($opt_help == 2 );
267 dpurdie 85
pod2usage(-verbose => 2)  if ($opt_help > 2);
227 dpurdie 86
 
87
#
88
#   Configure the Error reporting process now that we have the user options
89
#
90
ErrorConfig( 'name'    =>'GENRC', 'verbose' => $opt_verbose );
91
 
92
#
93
#   Validate user options
94
#   Not expecting any user arguments, other than options, so spit if any are found
95
#
96
Error ("Unexpected command line arguments present" )
97
    if ( $#ARGV >= 0 );
98
 
99
#
100
#   Sanity test of user arguments
101
#
102
Error ("No output file specified")  unless ( $opt_outfile );
103
Error ("No version specified")      unless ( $opt_version );
104
Error ("No name specified")         unless ( $opt_name );
105
 
106
#
267 dpurdie 107
#   Use BuildVersionWinRC to do the hard work
108
#   Create an option call list for this function
227 dpurdie 109
#
267 dpurdie 110
my @args = '--ToolUse';
111
push @args, "--Version=$opt_version"  if ( $opt_version );
112
push @args, "--Comment=$opt_comment"  if ( $opt_comment );
113
push @args, "--Product=$opt_product"  if ( $opt_product );
114
push @args, "--PkgName=$opt_name"     if ( $opt_name );
115
push @args, "--Description=$opt_description"  if ( $opt_description );
116
push @args, "--Definitions"  if ( $opt_defs_only );
117
push @args, "--Icon=$opt_icon"     if ( $opt_icon );
227 dpurdie 118
 
119
#
267 dpurdie 120
#   Keep the Module Happy
121
#   Provide globals used by the module
227 dpurdie 122
#
267 dpurdie 123
$CurrentTime = localtime;
124
my ($sec, $min, $hour, $mday, $mon, $year) = localtime();
125
$CurrentYear = 1900 + $year;
126
$BuildVersion = 'Unknown';
227 dpurdie 127
 
128
#
267 dpurdie 129
#   Invoke the same class used by the jats build process to create
130
#   the Resource File.
227 dpurdie 131
#
132
 
267 dpurdie 133
BuildVersionWinRC ( $opt_outfile, @args );
227 dpurdie 134
exit 0;
135
 
136
#-------------------------------------------------------------------------------
267 dpurdie 137
#   Documentation
227 dpurdie 138
#
139
 
140
=pod
141
 
361 dpurdie 142
=for htmltoc    MAKEUTIL::
143
 
227 dpurdie 144
=head1 NAME
145
 
146
gen_winrc.pl - Generate a Windows RC file
147
 
148
=head1 SYNOPSIS
149
 
150
 gen_winrc.pl [arguments] ...
151
 
152
 Arguments:
153
    -help                   - brief help message
154
    -help -help             - Detailed help message
155
    -man                    - Full documentation
156
    -verbose                - Verbose information
157
 
158
   Mandatory
159
    -out file               - Name of the output file
160
    -version nn.nn.nn       - Release version
161
    -name string            - Program Name
162
 
163
  Optional
164
    -comment string         - Comment string
165
    -description string     - Description string
166
    -definitions            - Only generate the definitions
167
    -icon filename          - The name of an icon file
168
 
169
=head1 OPTIONS
170
 
171
=over 8
172
 
361 dpurdie 173
=item -help
227 dpurdie 174
 
175
Print a brief help message and exits.
176
 
361 dpurdie 177
=item -help -help
227 dpurdie 178
 
179
Print a detailed help message with an explanation for each option.
180
 
361 dpurdie 181
=item -man
227 dpurdie 182
 
183
Prints the manual page and exits.
184
 
361 dpurdie 185
=item -verbose
227 dpurdie 186
 
187
Increase the level of debugging information displayed. This option may be used
188
multiple times.
189
 
361 dpurdie 190
=item -out file
227 dpurdie 191
 
192
Specifies the name of the output file. The option is mandatory.
193
 
361 dpurdie 194
=item -version nn.nn.nn
227 dpurdie 195
 
196
Specify the version to include include in the resource file. This must be of
197
the form nn.nn.nn, where nn is a decimal digit.
198
 
199
Within a JATS makefile the value of $ScmBuildVersion may be used.
200
 
201
The option is mandatory.
202
 
361 dpurdie 203
=item -name string
227 dpurdie 204
 
205
Specify the name of the program. The option is mandatory.
206
 
207
Within a JATS makefile the value of $ScmBuildPackage may be used.
208
 
361 dpurdie 209
=item -comment string
227 dpurdie 210
 
211
Specify an optional comment string. If the string contains whitespace then item
212
should be enclosed in quotes.
213
 
361 dpurdie 214
=item -description string
227 dpurdie 215
 
216
Specify an optional description string. If the string contains whitespace then item
217
should be enclosed in quotes.
218
 
361 dpurdie 219
=item -definitions
227 dpurdie 220
 
221
This option will only write out a file that contains the definitions. The body
222
of the resource script will not be generated. The file that is generated may
223
be included within another resource file.
224
 
361 dpurdie 225
=item -icon filename
227 dpurdie 226
 
227
This option will add the specified icon file to the resource being created.
228
The icon will appear against the DLL.
229
 
230
=back
231
 
232
=head1 DESCRIPTION
233
 
361 dpurdie 234
This program will generate a basic Windows resource file that contains the
227 dpurdie 235
program name and version number. The resulting file may then be included in
236
another resource file, or used directly to generate a basic program resource.
237
 
361 dpurdie 238
=for htmlclass Note
239
 
240
Note: Use of this utility has been deprecated in favour of the BuildVersion
241
directive that performs the same operation with a simpler interface.
242
 
227 dpurdie 243
=head1 EXAMPLE
244
 
245
=head2 Used within makefile.pl - Basic
246
 
247
    GenerateFiles ('WIN32', "--Tool=gen_winrc.pl",
248
                            "-out --GeneratedCommon(prog.rc)",
249
                            "-version=$ScmBuildVersion",
250
                            "-comment='This is a comment'",
251
                            "-name=$ScmBuildPackage",
252
                            "-description='This is a description'",
253
                            "--NoWarn" );
254
 
255
    Prog          ( '*'    , "MyProg", @OBJS );
256
    Prog          ( 'WIN32', "MyProg", "--Resource=prog.rc" );
257
 
258
The resource script will be generated with basic information. It can then be
259
added to the program or DLL as required.
260
 
261
=cut