Subversion Repositories DevTools

Rev

Rev 263 | Rev 269 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 263 Rev 267
Line 35... Line 35...
35
 
35
 
36
package BuildVersion;
36
package BuildVersion;
37
use JatsError;
37
use JatsError;
38
use JatsSystem;
38
use JatsSystem;
39
use JatsVersionUtils;
39
use JatsVersionUtils;
-
 
40
use ConfigurationFile;
40
 
41
 
41
our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
42
our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
42
use Exporter;
43
use Exporter;
43
 
44
 
44
$VERSION = 1.00;
45
$VERSION = 1.00;
Line 114... Line 115...
114
#
115
#
115
# Description     : Create a Windows RC file to describe the build version
116
# Description     : Create a Windows RC file to describe the build version
116
#                   This file may be used directly
117
#                   This file may be used directly
117
#
118
#
118
# Inputs          : $FileName           - Output filename (Optional)
119
# Inputs          : $FileName           - Output filename (Optional)
119
#                   $icon               - Name of icon (optional )
120
#                   @opts               - Options
-
 
121
#                           --Definitions
-
 
122
#                           --Icon=path
-
 
123
#                           --Comment=text
-
 
124
#                           --Description=text
-
 
125
#                           --Product=text
-
 
126
#                           --Version=text          (Internal Use)
120
#                   $defs               - Definitions Only (optional)
127
#                           --PkgName=text          (Internal Use)
121
#
-
 
-
 
128
#                           --ToolUse               (Internal Use)
122
# Returns         :
129
# Returns         : Nothing
123
#
130
#
124
sub BuildVersionWinRC
131
sub BuildVersionWinRC
125
{
132
{
126
    my ( $fname, $icon, $defs ) = @_;
133
    my ( $fname, @opts ) = @_;
-
 
134
    my $icon;
-
 
135
    my $defs;
-
 
136
    my $product = '';
-
 
137
    my $version = $BUILDNAME_VERSION || '';
-
 
138
    my $pkg_name = $BUILDNAME_PACKAGE || '';
-
 
139
    my $comment = "Build Date: $CurrentTime";
-
 
140
    my $description = '';
-
 
141
    my $used_by_tool = '';
-
 
142
 
-
 
143
    #
-
 
144
    #   Process options
-
 
145
    #
-
 
146
    foreach ( @opts )
-
 
147
    {
-
 
148
        if ( m~^--Icon=(.+)~ ) {
-
 
149
            $icon = $1;
-
 
150
        } elsif ( m~^--Definitions~ ) {
-
 
151
            $defs = 1;
-
 
152
        } elsif ( m~^--Comment=(.+)~ ) {
-
 
153
            $comment = $1;
-
 
154
        } elsif ( m~^--Description=(.+)~ ) {
-
 
155
            $description = $1;
-
 
156
        } elsif ( m~^--Product=(.+)~ ) {
-
 
157
            $product = $1;
-
 
158
        } elsif ( m~^--Version=(.+)~ ) {
-
 
159
            $version = $1;
-
 
160
        } elsif ( m~^--PkgName=(.+)~ ) {
-
 
161
            $pkg_name = $1;
-
 
162
        } elsif ( m~^--ToolUse~ ) {
-
 
163
            $used_by_tool = 1;
-
 
164
        } else {
-
 
165
            Error ("WinRC Style Version. Unknown option: $_");
-
 
166
        }
-
 
167
    }
-
 
168
 
-
 
169
    #
-
 
170
    #   Setup defaults
-
 
171
    #
127
    $fname = 'version.rc' unless $fname;
172
    $fname = 'version.rc' unless $fname;
-
 
173
    Error ("WinRC: No Build Version provided") unless ( $version );
-
 
174
    Error ("WinRC: No Build Package Name provided") unless ( $pkg_name );
128
 
175
 
129
    #
176
    #
130
    #   Store the files location for use at runtime
177
    #   Store the files location for use at runtime
131
    #   It will be a file that is 'known' to JATS
178
    #   It will be a file that is 'known' to JATS
132
    #
179
    #
-
 
180
    unless ( $used_by_tool  )
-
 
181
    {
133
    $fname = ::BuildAddKnownFile ( $Srcdir, $fname );
182
        $fname = ::BuildAddKnownFile ( $Srcdir, $fname );
134
    return if ( $Clobber );      # clobber mode ?
183
        return if ( $Clobber );      # clobber mode ?
135
    
184
    }
-
 
185
 
136
    Message ("Creating Windows Resource File: $fname" );
186
    Message ("Creating Windows Resource File: $fname" );
-
 
187
 
137
    #
188
    #
138
    #   Determine the build version
189
    #   Determine the build version
139
    #
190
    #
140
    my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
191
    my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($version);
141
    my $product_version = "$major, $minor, $patch, $build";
192
    my $product_version = "$major, $minor, $patch, $build";
142
    
193
    
143
 
194
 
144
    #
195
    #
145
    #   Create the file
196
    #   Create the file
Line 154... Line 205...
154
    }
205
    }
155
 
206
 
156
    sub pdefs
207
    sub pdefs
157
    {
208
    {
158
        my ($arg, $val) = @_;
209
        my ($arg, $val) = @_;
-
 
210
        Error ("Undefined value for $arg") unless ( defined $val );
159
        return "#define $arg \"$val\\0\"\n";
211
        return "#define $arg \"$val\\0\"\n";
160
    }
212
    }
161
 
213
 
162
    sub pdef
214
    sub pdef
163
    {
215
    {
164
        my ($arg, $val) = @_;
216
        my ($arg, $val) = @_;
-
 
217
        Error ("Undefined value for $arg") unless ( defined $val );
165
        return "#define $arg $val\n";
218
        return "#define $arg $val\n";
166
    }
219
    }
167
 
220
 
168
    $fh->Write(prc     (""));
221
    $fh->Write(prc     (""));
169
#    $fh->Write(prc     ("#include \"afxres.h\""));
222
#    $fh->Write(prc     ("#include \"afxres.h\""));
170
#    $fh->Write(prc     (""));
223
#    $fh->Write(prc     (""));
171
    $fh->Write(prc     (""));
224
    $fh->Write(prc     (""));
172
    $fh->Write(pdefs   ("RC_STR_EMPTY"         , "" ));
225
    $fh->Write(pdefs   ("RC_STR_EMPTY"         , "" ));
173
    $fh->Write(pdefs   ("RC_STR_COMPANY"       , "ERG Group" ));
226
    $fh->Write(pdefs   ("RC_STR_COMPANY"       , "ERG Group" ));
174
    $fh->Write(pdefs   ("RC_STR_PRODUCTNAME"   , "ERG Group test" ));
227
    $fh->Write(pdefs   ("RC_STR_PRODUCTNAME"   , $product ));
175
    $fh->Write(pdefs   ("RC_STR_COMMENT"       , "Build Date: $CurrentTime" ));
228
    $fh->Write(pdefs   ("RC_STR_COMMENT"       , $comment ));
176
    $fh->Write(pdefs   ("RC_STR_DESCRIPTION"   , "From: $BUILDNAME_PACKAGE" ));
229
    $fh->Write(pdefs   ("RC_STR_DESCRIPTION"   , $description ));
177
    $fh->Write(pdefs   ("RC_STR_NAME"          , $BUILDNAME_PACKAGE ));
230
    $fh->Write(pdefs   ("RC_STR_NAME"          , $pkg_name ));
178
    $fh->Write(pdefs   ("RC_STR_VERSION"       , $product_version ));
231
    $fh->Write(pdefs   ("RC_STR_VERSION"       , $product_version ));
179
    $fh->Write(pdef    ("RC_NUM_VERSION"       , $product_version ));
232
    $fh->Write(pdef    ("RC_NUM_VERSION"       , $product_version ));
180
    $fh->Write(pdefs   ("RC_STR_COPYRIGHT"     , "Copyright ERG Group $CurrentYear" ));
233
    $fh->Write(pdefs   ("RC_STR_COPYRIGHT"     , "Copyright ERG Group $CurrentYear" ));
181
    $fh->Write(prc     ('#ifdef _DEBUG'));
234
    $fh->Write(prc     ('#ifdef _DEBUG'));
182
    $fh->Write(pdefs   ("RC_STR_SPECIAL"       , "Debug Version" ));
235
    $fh->Write(pdefs   ("RC_STR_SPECIAL"       , "Debug Version" ));