| 227 |
dpurdie |
1 |
#! perl
|
|
|
2 |
########################################################################
|
|
|
3 |
# Copyright ( C ) 2004 ERG Limited, All rights reserved
|
|
|
4 |
#
|
|
|
5 |
# Module name : jats.sh
|
|
|
6 |
# Module type : Makefile system
|
|
|
7 |
# Compiler(s) : n/a
|
|
|
8 |
# Environment(s): jats
|
|
|
9 |
#
|
|
|
10 |
# Description : Provide varions functions used by the BuildVersion
|
|
|
11 |
# directive.
|
|
|
12 |
#
|
|
|
13 |
# Use only within buildlib.pl as this package assumes
|
|
|
14 |
# a great deal about its environment.
|
|
|
15 |
#
|
|
|
16 |
# Usage:
|
|
|
17 |
#
|
|
|
18 |
# Version Who Date Description
|
|
|
19 |
#
|
|
|
20 |
#......................................................................#
|
|
|
21 |
|
| 255 |
dpurdie |
22 |
require 5.006_001;
|
| 227 |
dpurdie |
23 |
use strict;
|
|
|
24 |
use warnings;
|
|
|
25 |
|
|
|
26 |
our $Clobber;
|
|
|
27 |
our $CurrentYear;
|
|
|
28 |
our $CurrentTime;
|
|
|
29 |
our $Srcdir;
|
|
|
30 |
our $BuildVersion;
|
|
|
31 |
our $BUILDNAME;
|
|
|
32 |
our $BUILDNAME_PACKAGE;
|
|
|
33 |
our $BUILDNAME_VERSION;
|
|
|
34 |
our $BUILDNAME_PROJECT;
|
|
|
35 |
|
|
|
36 |
package BuildVersion;
|
|
|
37 |
use JatsError;
|
|
|
38 |
use JatsSystem;
|
|
|
39 |
use JatsVersionUtils;
|
| 267 |
dpurdie |
40 |
use ConfigurationFile;
|
| 289 |
dpurdie |
41 |
use FileUtils;
|
| 227 |
dpurdie |
42 |
|
| 283 |
dpurdie |
43 |
#
|
|
|
44 |
# Package Interface
|
|
|
45 |
#
|
|
|
46 |
use base qw(Exporter);
|
|
|
47 |
our @EXPORT = qw( BuildVersionC
|
| 227 |
dpurdie |
48 |
BuildVersionCdefs
|
|
|
49 |
BuildVersionCSharp
|
|
|
50 |
BuildVersionWinRC
|
| 229 |
dpurdie |
51 |
BuildVersionProperties
|
| 289 |
dpurdie |
52 |
BuildVersionDelphi
|
| 315 |
dpurdie |
53 |
BuildVersionVB
|
| 227 |
dpurdie |
54 |
);
|
|
|
55 |
|
|
|
56 |
#-------------------------------------------------------------------------------
|
|
|
57 |
# Function : BuildVersionCSharp
|
|
|
58 |
#
|
|
|
59 |
# Description : Generate a C# versionn information file to allow
|
|
|
60 |
# insertion of data into an assembly
|
|
|
61 |
#
|
|
|
62 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
63 |
#
|
|
|
64 |
# Returns :
|
|
|
65 |
#
|
|
|
66 |
sub BuildVersionCSharp
|
|
|
67 |
{
|
|
|
68 |
my ( $fname ) = @_;
|
|
|
69 |
$fname = 'AssemblyVersionInfo.cs' unless $fname;
|
|
|
70 |
|
| 247 |
dpurdie |
71 |
#
|
|
|
72 |
# Store the files location for use at runtime
|
|
|
73 |
# It will be a file that is 'known' to JATS
|
|
|
74 |
#
|
|
|
75 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname );
|
|
|
76 |
return if ( $Clobber ); # clobber mode ?
|
| 289 |
dpurdie |
77 |
Message ("Creating C# Version File: $fname" );
|
| 227 |
dpurdie |
78 |
|
|
|
79 |
#
|
|
|
80 |
# Determine the build version
|
|
|
81 |
#
|
|
|
82 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
|
|
|
83 |
my $vstring = "$major.$minor.$patch.$build";
|
|
|
84 |
|
|
|
85 |
|
| 247 |
dpurdie |
86 |
my $fh = ConfigurationFile::New( $fname, '--Type=CSharp' );
|
| 227 |
dpurdie |
87 |
$fh->HeaderSimple( "buildlib (Version $BuildVersion)",
|
|
|
88 |
"CSharp Assembly Version Definition" );
|
|
|
89 |
|
|
|
90 |
$fh->Write( "\n" );
|
|
|
91 |
$fh->Write( "using System.Reflection;\n" );
|
|
|
92 |
$fh->Write( "using System.Runtime.CompilerServices;\n" );
|
|
|
93 |
$fh->Write( "\n" );
|
|
|
94 |
$fh->Write( "[assembly: AssemblyCompany(\"ERG Group\")]\n" );
|
|
|
95 |
$fh->Write( "[assembly: AssemblyProduct(\"$BUILDNAME_PACKAGE\")]\n" );
|
|
|
96 |
$fh->Write( "[assembly: AssemblyCopyright(\"ERG Group $CurrentYear\")]\n" );
|
|
|
97 |
$fh->Write( "[assembly: AssemblyTrademark(\"\")]\n" );
|
|
|
98 |
$fh->Write( "\n");
|
|
|
99 |
$fh->Comment( "\n");
|
|
|
100 |
$fh->Comment( "Version information for an assembly consists of the following four values:\n");
|
|
|
101 |
$fh->Comment( "\n");
|
|
|
102 |
$fh->Comment( " Major Version -ERG:Major\n");
|
|
|
103 |
$fh->Comment( " Minor Version - ERG:Minor\n");
|
|
|
104 |
$fh->Comment( " Build Number - ERG:Patch\n");
|
|
|
105 |
$fh->Comment( " Revision - ERG:Build Number\n");
|
|
|
106 |
$fh->Comment( "\n");
|
|
|
107 |
$fh->Write( "\n");
|
|
|
108 |
$fh->Write( "[assembly: AssemblyVersion(\"$vstring\")]\n" );
|
|
|
109 |
$fh->Write( "\n");
|
|
|
110 |
|
|
|
111 |
$fh->Close();
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
#-------------------------------------------------------------------------------
|
|
|
115 |
# Function : BuildVersionWinRC
|
|
|
116 |
#
|
|
|
117 |
# Description : Create a Windows RC file to describe the build version
|
|
|
118 |
# This file may be used directly
|
|
|
119 |
#
|
|
|
120 |
# Inputs : $FileName - Output filename (Optional)
|
| 267 |
dpurdie |
121 |
# @opts - Options
|
|
|
122 |
# --Definitions
|
|
|
123 |
# --Icon=path
|
|
|
124 |
# --Comment=text
|
|
|
125 |
# --Description=text
|
|
|
126 |
# --Product=text
|
|
|
127 |
# --Version=text (Internal Use)
|
|
|
128 |
# --PkgName=text (Internal Use)
|
|
|
129 |
# --ToolUse (Internal Use)
|
|
|
130 |
# Returns : Nothing
|
| 227 |
dpurdie |
131 |
#
|
|
|
132 |
sub BuildVersionWinRC
|
|
|
133 |
{
|
| 267 |
dpurdie |
134 |
my ( $fname, @opts ) = @_;
|
|
|
135 |
my $icon;
|
|
|
136 |
my $defs;
|
|
|
137 |
my $product = '';
|
|
|
138 |
my $version = $BUILDNAME_VERSION || '';
|
|
|
139 |
my $pkg_name = $BUILDNAME_PACKAGE || '';
|
|
|
140 |
my $comment = "Build Date: $CurrentTime";
|
|
|
141 |
my $description = '';
|
|
|
142 |
my $used_by_tool = '';
|
|
|
143 |
|
|
|
144 |
#
|
|
|
145 |
# Process options
|
|
|
146 |
#
|
|
|
147 |
foreach ( @opts )
|
|
|
148 |
{
|
|
|
149 |
if ( m~^--Icon=(.+)~ ) {
|
|
|
150 |
$icon = $1;
|
|
|
151 |
} elsif ( m~^--Definitions~ ) {
|
|
|
152 |
$defs = 1;
|
|
|
153 |
} elsif ( m~^--Comment=(.+)~ ) {
|
|
|
154 |
$comment = $1;
|
|
|
155 |
} elsif ( m~^--Description=(.+)~ ) {
|
|
|
156 |
$description = $1;
|
|
|
157 |
} elsif ( m~^--Product=(.+)~ ) {
|
|
|
158 |
$product = $1;
|
|
|
159 |
} elsif ( m~^--Version=(.+)~ ) {
|
|
|
160 |
$version = $1;
|
|
|
161 |
} elsif ( m~^--PkgName=(.+)~ ) {
|
|
|
162 |
$pkg_name = $1;
|
|
|
163 |
} elsif ( m~^--ToolUse~ ) {
|
|
|
164 |
$used_by_tool = 1;
|
|
|
165 |
} else {
|
|
|
166 |
Error ("WinRC Style Version. Unknown option: $_");
|
|
|
167 |
}
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
#
|
|
|
171 |
# Setup defaults
|
|
|
172 |
#
|
| 227 |
dpurdie |
173 |
$fname = 'version.rc' unless $fname;
|
| 267 |
dpurdie |
174 |
Error ("WinRC: No Build Version provided") unless ( $version );
|
|
|
175 |
Error ("WinRC: No Build Package Name provided") unless ( $pkg_name );
|
| 227 |
dpurdie |
176 |
|
|
|
177 |
#
|
| 247 |
dpurdie |
178 |
# Store the files location for use at runtime
|
|
|
179 |
# It will be a file that is 'known' to JATS
|
|
|
180 |
#
|
| 267 |
dpurdie |
181 |
unless ( $used_by_tool )
|
|
|
182 |
{
|
|
|
183 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname );
|
|
|
184 |
return if ( $Clobber ); # clobber mode ?
|
|
|
185 |
}
|
|
|
186 |
|
| 247 |
dpurdie |
187 |
Message ("Creating Windows Resource File: $fname" );
|
| 267 |
dpurdie |
188 |
|
| 247 |
dpurdie |
189 |
#
|
| 227 |
dpurdie |
190 |
# Determine the build version
|
|
|
191 |
#
|
| 267 |
dpurdie |
192 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($version);
|
| 227 |
dpurdie |
193 |
my $product_version = "$major, $minor, $patch, $build";
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
#
|
|
|
197 |
# Create the file
|
|
|
198 |
#
|
| 247 |
dpurdie |
199 |
my $fh = ConfigurationFile::New( $fname, '--Type=C++' );
|
| 227 |
dpurdie |
200 |
$fh->HeaderSimple( "buildlib (Version $BuildVersion)",
|
|
|
201 |
"Windows Resource Version Definition" );
|
|
|
202 |
|
|
|
203 |
sub prc
|
|
|
204 |
{
|
|
|
205 |
return "@_\n";
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
sub pdefs
|
|
|
209 |
{
|
|
|
210 |
my ($arg, $val) = @_;
|
| 267 |
dpurdie |
211 |
Error ("Undefined value for $arg") unless ( defined $val );
|
| 227 |
dpurdie |
212 |
return "#define $arg \"$val\\0\"\n";
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
sub pdef
|
|
|
216 |
{
|
|
|
217 |
my ($arg, $val) = @_;
|
| 267 |
dpurdie |
218 |
Error ("Undefined value for $arg") unless ( defined $val );
|
| 227 |
dpurdie |
219 |
return "#define $arg $val\n";
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
$fh->Write(prc (""));
|
|
|
223 |
# $fh->Write(prc ("#include \"afxres.h\""));
|
|
|
224 |
# $fh->Write(prc (""));
|
| 269 |
dpurdie |
225 |
|
| 227 |
dpurdie |
226 |
$fh->Write(prc (""));
|
|
|
227 |
$fh->Write(pdefs ("RC_STR_EMPTY" , "" ));
|
|
|
228 |
$fh->Write(pdefs ("RC_STR_COMPANY" , "ERG Group" ));
|
| 267 |
dpurdie |
229 |
$fh->Write(pdefs ("RC_STR_PRODUCTNAME" , $product ));
|
|
|
230 |
$fh->Write(pdefs ("RC_STR_COMMENT" , $comment ));
|
|
|
231 |
$fh->Write(pdefs ("RC_STR_DESCRIPTION" , $description ));
|
|
|
232 |
$fh->Write(pdefs ("RC_STR_NAME" , $pkg_name ));
|
| 227 |
dpurdie |
233 |
$fh->Write(pdefs ("RC_STR_VERSION" , $product_version ));
|
|
|
234 |
$fh->Write(pdef ("RC_NUM_VERSION" , $product_version ));
|
|
|
235 |
$fh->Write(pdefs ("RC_STR_COPYRIGHT" , "Copyright ERG Group $CurrentYear" ));
|
|
|
236 |
$fh->Write(prc ('#ifdef _DEBUG'));
|
|
|
237 |
$fh->Write(pdefs ("RC_STR_SPECIAL" , "Debug Version" ));
|
|
|
238 |
$fh->Write(prc ('#else'));
|
|
|
239 |
$fh->Write(pdefs ("RC_STR_SPECIAL" , "Production Version" ));
|
|
|
240 |
$fh->Write(prc ('#endif'));
|
|
|
241 |
$fh->Write(prc (""));
|
|
|
242 |
|
| 263 |
dpurdie |
243 |
unless ( $defs )
|
|
|
244 |
{
|
| 269 |
dpurdie |
245 |
$fh->Write(prc ('#define VS_VERSION_INFO 1'));
|
| 263 |
dpurdie |
246 |
$fh->Write(prc (''));
|
|
|
247 |
$fh->Write(prc ('VS_VERSION_INFO VERSIONINFO'));
|
|
|
248 |
$fh->Write(prc (' FILEVERSION RC_NUM_VERSION'));
|
|
|
249 |
$fh->Write(prc (' PRODUCTVERSION RC_NUM_VERSION'));
|
|
|
250 |
$fh->Write(prc (' FILEFLAGSMASK 0x3fL'));
|
|
|
251 |
$fh->Write(prc ('#ifdef _DEBUG'));
|
|
|
252 |
$fh->Write(prc (' FILEFLAGS 0x1L'));
|
|
|
253 |
$fh->Write(prc ('#else'));
|
|
|
254 |
$fh->Write(prc (' FILEFLAGS 0x0L'));
|
|
|
255 |
$fh->Write(prc ('#endif'));
|
|
|
256 |
$fh->Write(prc (' FILEOS 0x40004L'));
|
|
|
257 |
$fh->Write(prc (' FILETYPE 0x1L'));
|
|
|
258 |
$fh->Write(prc (' FILESUBTYPE 0x0L'));
|
|
|
259 |
$fh->Write(prc ('BEGIN'));
|
|
|
260 |
$fh->Write(prc (' BLOCK "StringFileInfo"'));
|
|
|
261 |
$fh->Write(prc (' BEGIN'));
|
|
|
262 |
$fh->Write(prc (' BLOCK "0c0904b0"'));
|
|
|
263 |
$fh->Write(prc (' BEGIN'));
|
|
|
264 |
$fh->Write(prc (' VALUE "Comments", RC_STR_COMMENT'));
|
|
|
265 |
$fh->Write(prc (' VALUE "CompanyName", RC_STR_COMPANY'));
|
|
|
266 |
$fh->Write(prc (' VALUE "FileDescription", RC_STR_DESCRIPTION'));
|
|
|
267 |
$fh->Write(prc (' VALUE "FileVersion", RC_STR_VERSION'));
|
|
|
268 |
$fh->Write(prc (' VALUE "InternalName", RC_STR_NAME'));
|
|
|
269 |
$fh->Write(prc (' VALUE "LegalCopyright", RC_STR_COPYRIGHT'));
|
|
|
270 |
$fh->Write(prc (' VALUE "LegalTrademarks", RC_STR_EMPTY'));
|
|
|
271 |
$fh->Write(prc (' VALUE "OriginalFilename", RC_STR_NAME'));
|
|
|
272 |
$fh->Write(prc (' VALUE "PrivateBuild", RC_STR_EMPTY'));
|
|
|
273 |
$fh->Write(prc (' VALUE "ProductName", RC_STR_PRODUCTNAME'));
|
|
|
274 |
$fh->Write(prc (' VALUE "ProductVersion", RC_STR_VERSION'));
|
|
|
275 |
$fh->Write(prc (' VALUE "SpecialBuild", RC_STR_SPECIAL'));
|
|
|
276 |
$fh->Write(prc (' END'));
|
|
|
277 |
$fh->Write(prc (' END'));
|
|
|
278 |
$fh->Write(prc (' BLOCK "VarFileInfo"'));
|
|
|
279 |
$fh->Write(prc (' BEGIN'));
|
|
|
280 |
$fh->Write(prc (' VALUE "Translation", 0xc09, 1200'));
|
|
|
281 |
$fh->Write(prc (' END'));
|
|
|
282 |
$fh->Write(prc ('END'));
|
|
|
283 |
$fh->Write(prc (''));
|
| 227 |
dpurdie |
284 |
|
| 263 |
dpurdie |
285 |
if ( $icon )
|
|
|
286 |
{
|
|
|
287 |
$fh->Write(prc (''));
|
|
|
288 |
$fh->Write(prc ('/////////////////////////////////////////////////////////////////////////////'));
|
|
|
289 |
$fh->Write(prc ('//'));
|
|
|
290 |
$fh->Write(prc ('// Icon'));
|
|
|
291 |
$fh->Write(prc ('//'));
|
|
|
292 |
$fh->Write(prc ('// Icon with lowest ID value placed first to ensure application icon'));
|
|
|
293 |
$fh->Write(prc ('// remains consistent on all systems.'));
|
|
|
294 |
$fh->Write(prc ("101 ICON DISCARDABLE \"$icon\""));
|
|
|
295 |
$fh->Write(prc (''));
|
|
|
296 |
}
|
| 235 |
dpurdie |
297 |
}
|
|
|
298 |
|
|
|
299 |
|
| 227 |
dpurdie |
300 |
$fh->Close();
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
#-------------------------------------------------------------------------------
|
|
|
304 |
# Function : BuildVersionC
|
|
|
305 |
#
|
|
|
306 |
# Description : Create a "C" style version.c and version.h file
|
|
|
307 |
#
|
| 289 |
dpurdie |
308 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
309 |
# If provided it will be 'known' to all
|
|
|
310 |
# of jats. Done for backward compatability
|
|
|
311 |
# $Prefix - Text to prefix generated variables with
|
| 227 |
dpurdie |
312 |
# Used to avoid namespace conflicts
|
|
|
313 |
# $Type - Type of version to create
|
|
|
314 |
# Only allowed value is 'array'
|
|
|
315 |
#
|
|
|
316 |
# Returns :
|
|
|
317 |
#
|
|
|
318 |
|
|
|
319 |
sub BuildVersionC
|
|
|
320 |
{
|
| 289 |
dpurdie |
321 |
my( $FileName, $Prefix, $Type ) = @_;
|
| 227 |
dpurdie |
322 |
my $ver;
|
|
|
323 |
|
| 289 |
dpurdie |
324 |
#
|
|
|
325 |
# Default name of the file
|
|
|
326 |
# Don't allow the user to play with the extension
|
|
|
327 |
# If the user provided a filename It will be a file that is 'known' to JATS
|
|
|
328 |
#
|
|
|
329 |
my $bname = defined($FileName) ? StripExt($FileName) : 'version';
|
| 227 |
dpurdie |
330 |
|
| 289 |
dpurdie |
331 |
my $fname_c = ::BuildAddKnownFile ( $Srcdir, $bname . '.c', !defined($FileName) );
|
|
|
332 |
my $fname_h = ::BuildAddKnownFile ( $Srcdir, $bname . '.h', !defined($FileName) );
|
|
|
333 |
|
|
|
334 |
return if ( $Clobber ); # clobber mode ?
|
|
|
335 |
Message ("Creating C Version File: $fname_c" );
|
|
|
336 |
|
| 227 |
dpurdie |
337 |
#
|
|
|
338 |
# Default prefix is none
|
|
|
339 |
# Set to a defined, bet empty, string
|
|
|
340 |
#
|
|
|
341 |
$Prefix = "" if ( ! defined( $Prefix ) );
|
|
|
342 |
$Type = "" if ( ! defined( $Type ) );
|
|
|
343 |
|
|
|
344 |
# src/version.c
|
|
|
345 |
#..
|
| 289 |
dpurdie |
346 |
open( VERSIONC, '>', $fname_c ) ||
|
|
|
347 |
Error( "cannot create $fname_c" );
|
| 227 |
dpurdie |
348 |
|
|
|
349 |
print VERSIONC
|
|
|
350 |
"/* Please do not edit this file.\n" .
|
|
|
351 |
" * It was auto-generated by Buildlib ($BuildVersion) on $::CurrentTime\n" .
|
|
|
352 |
" */\n" .
|
|
|
353 |
"#include \"version.h\"\n";
|
|
|
354 |
|
|
|
355 |
print VERSIONC
|
|
|
356 |
"\n" .
|
|
|
357 |
"static char what[] = \"@(#) $BUILDNAME $::CurrentDate ERG\";\n" .
|
|
|
358 |
"\n";
|
|
|
359 |
|
|
|
360 |
|
|
|
361 |
my @PACKAGEVERS = PackageEntry::GetPackageVersionList();
|
|
|
362 |
if ( $Type eq "array" )
|
|
|
363 |
{ # new style
|
|
|
364 |
print VERSIONC
|
|
|
365 |
"static const char *pkgarray[] = \n" .
|
|
|
366 |
"{\n";
|
|
|
367 |
|
|
|
368 |
foreach $ver ( @PACKAGEVERS ) {
|
|
|
369 |
print VERSIONC " \"$ver\",\n";
|
|
|
370 |
}
|
|
|
371 |
|
|
|
372 |
print VERSIONC
|
|
|
373 |
" 0\n",
|
|
|
374 |
"};\n\n";
|
|
|
375 |
|
|
|
376 |
print VERSIONC
|
|
|
377 |
"\nconst char *\n$Prefix"."VersionString(void)\n" .
|
|
|
378 |
"{\n".
|
|
|
379 |
" return \"$BUILDNAME\";\n" .
|
|
|
380 |
"}\n" .
|
|
|
381 |
"\nconst char **\n$Prefix"."PkgStrings(void)\n" .
|
|
|
382 |
"{\n".
|
|
|
383 |
" return pkgarray;\n" .
|
|
|
384 |
"}\n" .
|
|
|
385 |
"\nconst char *\n$Prefix"."GetModuleInfo(void)\n" .
|
|
|
386 |
"{\n" .
|
|
|
387 |
" return \"$BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS\";\n" .
|
|
|
388 |
"}\n";
|
|
|
389 |
}
|
|
|
390 |
else
|
|
|
391 |
{ # old style
|
|
|
392 |
print VERSIONC
|
|
|
393 |
"\nconst char *\n$Prefix"."VersionString(void)\n" .
|
|
|
394 |
"{\n".
|
|
|
395 |
" return \"$BUILDNAME @PACKAGEVERS\";\n" .
|
|
|
396 |
"}\n" .
|
|
|
397 |
"\nconst char *\n$Prefix"."GetModuleInfo(void)\n" .
|
|
|
398 |
"{\n" .
|
|
|
399 |
" return \"$BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS\";\n" .
|
|
|
400 |
"}\n";
|
|
|
401 |
}
|
|
|
402 |
close VERSIONC;
|
|
|
403 |
|
|
|
404 |
# src/version.h
|
|
|
405 |
#..
|
| 289 |
dpurdie |
406 |
open( VERSIONH, '>', $fname_h ) ||
|
|
|
407 |
Error( "cannot create $fname_h" );
|
| 227 |
dpurdie |
408 |
|
|
|
409 |
print VERSIONH
|
|
|
410 |
"#ifndef VERSION_H_INCLUDED\n" .
|
|
|
411 |
"#define VERSION_H_INCLUDED\n" .
|
|
|
412 |
"/* Please do not edit this file.\n" .
|
|
|
413 |
" * It was auto-generated by Buildlib ($BuildVersion) on $::CurrentTime\n" .
|
|
|
414 |
" */\n\n" .
|
|
|
415 |
"#define BUILDNAME \"$BUILDNAME\"\n" .
|
|
|
416 |
"#define BUILDDATE \"$::CurrentTime\"\n" .
|
|
|
417 |
"\n";
|
|
|
418 |
|
|
|
419 |
print VERSIONH
|
|
|
420 |
"#ifdef __cplusplus\n" .
|
|
|
421 |
" extern \"C\" { /* force C calling convention when using C++ */\n" .
|
|
|
422 |
"#endif\n" .
|
|
|
423 |
"\n";
|
|
|
424 |
|
|
|
425 |
if ( $Type eq "array" )
|
|
|
426 |
{ # extended interface
|
|
|
427 |
print VERSIONH
|
|
|
428 |
"extern const char ** $Prefix"."PkgStrings(void);\n";
|
|
|
429 |
}
|
|
|
430 |
print VERSIONH
|
|
|
431 |
"extern const char * $Prefix"."VersionString(void);\n".
|
|
|
432 |
"extern const char * $Prefix"."GetModuleInfo(void);\n";
|
|
|
433 |
|
|
|
434 |
print VERSIONH
|
|
|
435 |
"\n" .
|
|
|
436 |
"#ifdef __cplusplus\n" .
|
|
|
437 |
" } /* extern \"C\" */\n" .
|
|
|
438 |
"#endif\n" .
|
|
|
439 |
"\n";
|
|
|
440 |
|
|
|
441 |
print VERSIONH
|
|
|
442 |
"\n#endif /*VERSION_H_INCLUDED*/\n";
|
|
|
443 |
close VERSIONH;
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
#-------------------------------------------------------------------------------
|
|
|
447 |
# Function : BuildVersionCdefs
|
|
|
448 |
#
|
|
|
449 |
# Description : Generate a "C" style version definitions file
|
|
|
450 |
# This file simply contains definitions
|
|
|
451 |
#
|
| 289 |
dpurdie |
452 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
453 |
# If provided it will be 'known' to all
|
|
|
454 |
# of jats. Done for backward compatability
|
|
|
455 |
# $Mode - File suffix
|
| 227 |
dpurdie |
456 |
# $ModePrefix - Tag for all generated definitions
|
|
|
457 |
#
|
|
|
458 |
# Returns :
|
|
|
459 |
#
|
|
|
460 |
|
|
|
461 |
sub BuildVersionCdefs
|
|
|
462 |
{
|
| 289 |
dpurdie |
463 |
my ( $FileName, $Mode, $ModePrefix ) = @_;
|
| 227 |
dpurdie |
464 |
|
| 289 |
dpurdie |
465 |
my $fname = defined($FileName) ? $FileName : "version_$Mode.h";
|
|
|
466 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname , ! defined($FileName) );
|
|
|
467 |
return if ( $Clobber ); # clobber mode ?
|
|
|
468 |
Message ("Creating C Version Defs File: $fname" );
|
| 227 |
dpurdie |
469 |
|
|
|
470 |
#
|
|
|
471 |
# Generate version_defs.h
|
|
|
472 |
# This file contains ONLY definitions. It may be used by assembler
|
|
|
473 |
# programs (that support a preprocessor) to access version information
|
|
|
474 |
#
|
|
|
475 |
# Allow for a user supplied filename fragment that will be used within
|
|
|
476 |
# all the definitions with in the file.
|
|
|
477 |
#
|
|
|
478 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
|
|
|
479 |
my @PACKAGEVERS = PackageEntry::GetPackageVersionList();
|
|
|
480 |
|
|
|
481 |
#
|
|
|
482 |
# Base names on a user supplied value or a default
|
|
|
483 |
#
|
|
|
484 |
my $vtag = uc( "VERSION$ModePrefix" );
|
|
|
485 |
my $guard_name = uc($fname);
|
| 289 |
dpurdie |
486 |
$guard_name =~ tr~\.\/\\~_~s;
|
| 227 |
dpurdie |
487 |
|
| 289 |
dpurdie |
488 |
open( VERSIOND, '>', $fname ) ||
|
|
|
489 |
Error( "cannot create $fname" );
|
| 227 |
dpurdie |
490 |
|
|
|
491 |
print VERSIOND
|
|
|
492 |
"#ifndef $guard_name\n" .
|
|
|
493 |
"#define $guard_name\n" .
|
|
|
494 |
"/* Please do not edit this file.\n" .
|
|
|
495 |
" * It was auto-generated by Buildlib ($BuildVersion) on $::CurrentTime\n" .
|
|
|
496 |
" */\n\n" .
|
|
|
497 |
"\n".
|
|
|
498 |
"#define ${vtag}_BUILDNAME \"$BUILDNAME\"\n".
|
|
|
499 |
"#define ${vtag}_BUILDDATE \"$::CurrentTime\"\n".
|
|
|
500 |
"\n".
|
|
|
501 |
"#define ${vtag}_PACKAGE \"$BUILDNAME_PACKAGE\"\n".
|
|
|
502 |
"#define ${vtag}_VERSION \"$BUILDNAME_VERSION\"\n".
|
|
|
503 |
"#define ${vtag}_MAJOR_STR \"$major\"\n".
|
|
|
504 |
"#define ${vtag}_MINOR_STR \"$minor\"\n".
|
|
|
505 |
"#define ${vtag}_PATCH_STR \"$patch\"\n".
|
|
|
506 |
"#define ${vtag}_BUILD_STR \"$build\"\n".
|
|
|
507 |
"#define ${vtag}_PATCHBUILD_STR \"$raw_patch\"\n".
|
|
|
508 |
"#define ${vtag}_PROJECT \"$BUILDNAME_PROJECT\"\n".
|
|
|
509 |
"#define ${vtag}_MAJOR " . strip_zeros($major) . "\n".
|
|
|
510 |
"#define ${vtag}_MINOR " . strip_zeros($minor) . "\n".
|
|
|
511 |
"#define ${vtag}_PATCH " . strip_zeros($patch) . "\n".
|
|
|
512 |
"#define ${vtag}_BUILD " . strip_zeros($build) . "\n".
|
|
|
513 |
"#define ${vtag}_PATCHBUILD " . strip_zeros($raw_patch) . "\n".
|
|
|
514 |
"#define ${vtag}_ALL \"$BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS\"\n".
|
|
|
515 |
"#define ${vtag}_BUILDTIME " . strip_zeros(time()) . "\n".
|
|
|
516 |
"\n".
|
|
|
517 |
"#endif /* $guard_name */\n";
|
|
|
518 |
|
|
|
519 |
close VERSIOND;
|
|
|
520 |
}
|
|
|
521 |
|
|
|
522 |
#-------------------------------------------------------------------------------
|
| 229 |
dpurdie |
523 |
# Function : BuildVersionProperties
|
|
|
524 |
#
|
|
|
525 |
# Description : Generate a "Java" style version definitions file
|
|
|
526 |
# This is a simple properties file
|
|
|
527 |
#
|
|
|
528 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
529 |
# $Prefix - Tag for all generated definitions
|
|
|
530 |
#
|
|
|
531 |
# Returns :
|
|
|
532 |
#
|
|
|
533 |
sub BuildVersionProperties
|
|
|
534 |
{
|
|
|
535 |
my ( $fname, $Prefix ) = @_;
|
|
|
536 |
|
|
|
537 |
#
|
|
|
538 |
# Default name of the file
|
|
|
539 |
#
|
|
|
540 |
$fname = 'version.properties' unless $fname;
|
|
|
541 |
|
|
|
542 |
#
|
| 247 |
dpurdie |
543 |
# Store the files location for use at runtime
|
|
|
544 |
# It will be a file that is 'known' to JATS
|
|
|
545 |
#
|
|
|
546 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname );
|
|
|
547 |
return if ( $Clobber ); # clobber mode ?
|
| 289 |
dpurdie |
548 |
Message ("Creating Properties Version File: $fname" );
|
| 247 |
dpurdie |
549 |
|
|
|
550 |
#
|
| 229 |
dpurdie |
551 |
# Generate version properties file
|
|
|
552 |
#
|
|
|
553 |
# This file contains ONLY definitions. It may be included by the ANT
|
|
|
554 |
# builds. Its not intended to be imported by the java code
|
|
|
555 |
|
|
|
556 |
|
|
|
557 |
#
|
|
|
558 |
# Allow for a user supplied property prefix
|
|
|
559 |
# Not really needed as
|
|
|
560 |
#
|
|
|
561 |
my $vtag = '';
|
|
|
562 |
$vtag = $Prefix . '.' if $Prefix;
|
|
|
563 |
|
|
|
564 |
|
|
|
565 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
|
|
|
566 |
my @PACKAGEVERS = PackageEntry::GetPackageVersionList();
|
|
|
567 |
|
|
|
568 |
#
|
|
|
569 |
# Create properties in the same form as for "C" definitions
|
|
|
570 |
# Note:
|
|
|
571 |
# The 'ALL' is in a format used by other software. Do not change
|
|
|
572 |
#
|
| 247 |
dpurdie |
573 |
open( VERSIOND, ">$fname" ) ||
|
|
|
574 |
Error( "cannot create $fname" );
|
| 229 |
dpurdie |
575 |
|
|
|
576 |
print VERSIOND
|
|
|
577 |
"# Please do not edit this file.\n" .
|
|
|
578 |
"# It was auto-generated by Buildlib ($BuildVersion) on $::CurrentTime\n" .
|
|
|
579 |
"#\n" .
|
|
|
580 |
"${vtag}BUILDNAME = $BUILDNAME\n".
|
|
|
581 |
"${vtag}BUILDDATE = $::CurrentTime\n".
|
|
|
582 |
"\n".
|
|
|
583 |
"${vtag}PACKAGE = $BUILDNAME_PACKAGE\n".
|
|
|
584 |
"${vtag}VERSION = $BUILDNAME_VERSION\n".
|
|
|
585 |
"${vtag}MAJOR_STR = $major\n".
|
|
|
586 |
"${vtag}MINOR_STR = $minor\n".
|
|
|
587 |
"${vtag}PATCH_STR = $patch\n".
|
|
|
588 |
"${vtag}BUILD_STR = $build\n".
|
|
|
589 |
"${vtag}PATCHBUILD_STR = $raw_patch\n".
|
|
|
590 |
"${vtag}PROJECT = $BUILDNAME_PROJECT\n".
|
|
|
591 |
"${vtag}MAJOR = " . strip_zeros($major) . "\n".
|
|
|
592 |
"${vtag}MINOR = " . strip_zeros($minor) . "\n".
|
|
|
593 |
"${vtag}PATCH = " . strip_zeros($patch) . "\n".
|
|
|
594 |
"${vtag}BUILD = " . strip_zeros($build) . "\n".
|
|
|
595 |
"${vtag}PATCHBUILD = " . strip_zeros($raw_patch) . "\n".
|
|
|
596 |
"${vtag}ALL = $BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS\n".
|
|
|
597 |
"${vtag}BUILDTIME = " . strip_zeros(time()) . "\n".
|
|
|
598 |
"\n";
|
|
|
599 |
#
|
|
|
600 |
# Create a set of definitions for each dependent package
|
|
|
601 |
#
|
|
|
602 |
print VERSIOND "# Dependent Packages and Versions\n".
|
|
|
603 |
"#\n";
|
|
|
604 |
|
|
|
605 |
foreach my $tag ( PackageEntry::GetPackageList() )
|
|
|
606 |
{
|
|
|
607 |
my ($name, $version, $type) = PackageEntry::GetPackageData($tag);
|
|
|
608 |
# push @attributes, "build=\"true\"" if $type =~ /Build/i;
|
|
|
609 |
print VERSIOND "${vtag}PACKAGE.$name=$version\n";
|
|
|
610 |
}
|
|
|
611 |
close VERSIOND;
|
|
|
612 |
}
|
|
|
613 |
|
|
|
614 |
#-------------------------------------------------------------------------------
|
| 289 |
dpurdie |
615 |
# Function : BuildVersionDelphi
|
|
|
616 |
#
|
|
|
617 |
# Description : Create a pascal file in Delphi format
|
|
|
618 |
#
|
|
|
619 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
620 |
# $Prefix - Tag for all generated definitions
|
|
|
621 |
#
|
|
|
622 |
#
|
|
|
623 |
# Returns :
|
|
|
624 |
#
|
|
|
625 |
sub BuildVersionDelphi
|
|
|
626 |
{
|
|
|
627 |
my ( $fname, $Prefix ) = @_;
|
|
|
628 |
|
|
|
629 |
#
|
|
|
630 |
# Default name of the file
|
|
|
631 |
#
|
|
|
632 |
$fname = 'version_defs.pas' unless $fname;
|
|
|
633 |
$fname .= '.pas'
|
|
|
634 |
unless ( $fname =~ m~\.~ );
|
|
|
635 |
my $unit_name = StripDirExt($fname);
|
|
|
636 |
Error ("BuildVersion: Delphi Style. Filename \'$unit_name\. not allowed")
|
|
|
637 |
if ( $unit_name =~ m~^version$~i );
|
|
|
638 |
|
|
|
639 |
#
|
|
|
640 |
# Store the files location for use at runtime
|
|
|
641 |
# It will be a file that is 'known' to JATS
|
|
|
642 |
#
|
|
|
643 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname );
|
|
|
644 |
return if ( $Clobber ); # clobber mode ?
|
|
|
645 |
Message ("Creating Delpi Version File: $fname" );
|
|
|
646 |
|
|
|
647 |
#
|
|
|
648 |
# Generate version source file
|
|
|
649 |
# This file contains ONLY constant definitions.
|
|
|
650 |
|
|
|
651 |
#
|
|
|
652 |
# Allow for a user supplied property prefix
|
|
|
653 |
# Not really needed as
|
|
|
654 |
#
|
|
|
655 |
my $vtag = '';
|
|
|
656 |
$vtag = $Prefix . '_' if $Prefix;
|
|
|
657 |
|
|
|
658 |
|
|
|
659 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
|
|
|
660 |
my @PACKAGEVERS = PackageEntry::GetPackageVersionList();
|
|
|
661 |
|
|
|
662 |
#
|
|
|
663 |
# Create properties in the same form as for "C" definitions
|
|
|
664 |
# Note:
|
|
|
665 |
# The 'ALL' is in a format used by other software. Do not change
|
|
|
666 |
#
|
|
|
667 |
sub pstring
|
|
|
668 |
{
|
|
|
669 |
my ($arg, $val) = @_;
|
|
|
670 |
Error ("Undefined value for $arg") unless ( defined $val );
|
|
|
671 |
return sprintf ( "%-24s = \'%s\';" , $arg, $val);
|
|
|
672 |
}
|
|
|
673 |
sub pnum
|
|
|
674 |
{
|
|
|
675 |
my ($arg, $val) = @_;
|
|
|
676 |
Error ("Undefined value for $arg") unless ( defined $val );
|
|
|
677 |
return sprintf ( "%-24s = %s;" , $arg, strip_zeros($val) );
|
|
|
678 |
}
|
|
|
679 |
|
|
|
680 |
my $fh = ConfigurationFile::New( $fname, '--Type=Delphi' );
|
|
|
681 |
$fh->HeaderSimple( "buildlib (Version $BuildVersion)",
|
|
|
682 |
"Delphi Unit Version Definition" );
|
|
|
683 |
|
|
|
684 |
$fh->WriteLn(
|
|
|
685 |
"unit $unit_name;",
|
|
|
686 |
"interface",
|
|
|
687 |
"const",
|
|
|
688 |
pstring ("${vtag}BUILDNAME",$BUILDNAME),
|
|
|
689 |
pstring ("${vtag}BUILDDATE",$::CurrentTime),
|
|
|
690 |
'',
|
|
|
691 |
pstring ("${vtag}PACKAGE",$BUILDNAME_PACKAGE),
|
|
|
692 |
pstring ("${vtag}VERSION",$BUILDNAME_VERSION),
|
|
|
693 |
pstring ("${vtag}MAJOR_STR",$major),
|
|
|
694 |
pstring ("${vtag}MINOR_STR",$minor),
|
|
|
695 |
pstring ("${vtag}PATCH_STR",$patch),
|
|
|
696 |
pstring ("${vtag}BUILD_STR",$build),
|
|
|
697 |
pstring ("${vtag}PATCHBUILD_STR",$raw_patch),
|
|
|
698 |
pstring ("${vtag}PROJECT",$BUILDNAME_PROJECT),
|
|
|
699 |
pnum ("${vtag}MAJOR",$major),
|
|
|
700 |
pnum ("${vtag}MINOR",$minor),
|
|
|
701 |
pnum ("${vtag}PATCH",$patch),
|
|
|
702 |
pnum ("${vtag}BUILD",$build),
|
|
|
703 |
pnum ("${vtag}PATCHBUILD",$raw_patch),
|
|
|
704 |
pstring ("${vtag}ALL","$BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS"),
|
|
|
705 |
pnum ("${vtag}BUILDTIME",time()),
|
|
|
706 |
''
|
|
|
707 |
);
|
|
|
708 |
|
|
|
709 |
#
|
|
|
710 |
# Create a set of definitions for each dependent package
|
|
|
711 |
#
|
|
|
712 |
$fh->Comment("Dependent Packages and Versions\n");
|
|
|
713 |
$fh->Comment("\n");
|
|
|
714 |
|
|
|
715 |
foreach my $tag ( PackageEntry::GetPackageList() )
|
|
|
716 |
{
|
|
|
717 |
my ($name, $version, $type) = PackageEntry::GetPackageData($tag);
|
|
|
718 |
$fh->WriteLn(pstring ("${vtag}PACKAGE_$name", $version));
|
|
|
719 |
}
|
|
|
720 |
$fh->WriteLn( '',
|
|
|
721 |
"implementation",
|
|
|
722 |
"end.");
|
|
|
723 |
|
|
|
724 |
|
|
|
725 |
$fh->WriteLn();
|
|
|
726 |
$fh->Close();
|
|
|
727 |
}
|
|
|
728 |
|
| 315 |
dpurdie |
729 |
#-------------------------------------------------------------------------------
|
|
|
730 |
# Function : BuildVersionVB
|
|
|
731 |
#
|
|
|
732 |
# Description : Create a VB6 file in Basic format
|
|
|
733 |
#
|
|
|
734 |
# Inputs : $FileName - Output filename (Optional)
|
|
|
735 |
# $Prefix - Tag for all generated definitions
|
|
|
736 |
#
|
|
|
737 |
#
|
|
|
738 |
# Returns :
|
|
|
739 |
#
|
|
|
740 |
sub BuildVersionVB
|
|
|
741 |
{
|
|
|
742 |
my ( $fname, $Prefix ) = @_;
|
| 289 |
dpurdie |
743 |
|
| 315 |
dpurdie |
744 |
#
|
|
|
745 |
# Default name of the file
|
|
|
746 |
#
|
|
|
747 |
$fname = 'version.bas' unless $fname;
|
|
|
748 |
$fname .= '.bas'
|
|
|
749 |
unless ( $fname =~ m~\.~ );
|
|
|
750 |
|
|
|
751 |
#
|
|
|
752 |
# Store the files location for use at runtime
|
|
|
753 |
# It will be a file that is 'known' to JATS
|
|
|
754 |
#
|
|
|
755 |
$fname = ::BuildAddKnownFile ( $Srcdir, $fname );
|
|
|
756 |
return if ( $Clobber ); # clobber mode ?
|
|
|
757 |
Message ("Creating Visual Basic Version File: $fname" );
|
|
|
758 |
|
|
|
759 |
#
|
|
|
760 |
# Generate version source file
|
|
|
761 |
# This file contains ONLY constant definitions.
|
|
|
762 |
|
|
|
763 |
#
|
|
|
764 |
# Allow for a user supplied property prefix
|
|
|
765 |
# Not really needed as
|
|
|
766 |
#
|
|
|
767 |
my $vtag = '';
|
|
|
768 |
$vtag = $Prefix . '_' if $Prefix;
|
|
|
769 |
|
|
|
770 |
|
|
|
771 |
my ($major, $minor, $patch, $build, $raw_patch) = SplitVersion($BUILDNAME_VERSION);
|
|
|
772 |
my @PACKAGEVERS = PackageEntry::GetPackageVersionList();
|
|
|
773 |
|
|
|
774 |
#
|
|
|
775 |
# Create properties in the same form as for "C" definitions
|
|
|
776 |
# Note:
|
|
|
777 |
# The 'ALL' is in a format used by other software. Do not change
|
|
|
778 |
#
|
|
|
779 |
sub pvbstring
|
|
|
780 |
{
|
|
|
781 |
my ($arg, $val) = @_;
|
|
|
782 |
Error ("Undefined value for $arg") unless ( defined $val );
|
|
|
783 |
return sprintf ( "Public Const %-24s = \"%s\"" , $arg, $val);
|
|
|
784 |
}
|
|
|
785 |
sub pvbnum
|
|
|
786 |
{
|
|
|
787 |
my ($arg, $val) = @_;
|
|
|
788 |
Error ("Undefined value for $arg") unless ( defined $val );
|
|
|
789 |
return sprintf ( "Public Const %-24s = %s" , $arg, strip_zeros($val) );
|
|
|
790 |
}
|
|
|
791 |
|
|
|
792 |
my $fh = ConfigurationFile::New( $fname, '--Type=Basic' );
|
|
|
793 |
$fh->HeaderSimple( "buildlib (Version $BuildVersion)",
|
|
|
794 |
"Visual Basic Version Definition" );
|
|
|
795 |
|
|
|
796 |
$fh->WriteLn(
|
|
|
797 |
"Attribute VB_Name = \"JatsVersion\"",
|
|
|
798 |
'',
|
|
|
799 |
pvbstring ("${vtag}BUILDNAME", $BUILDNAME),
|
|
|
800 |
pvbstring ("${vtag}BUILDDATE", $::CurrentTime),
|
|
|
801 |
'',
|
|
|
802 |
pvbstring ("${vtag}PACKAGE", $BUILDNAME_PACKAGE),
|
|
|
803 |
pvbstring ("${vtag}VERSION", $BUILDNAME_VERSION),
|
|
|
804 |
pvbstring ("${vtag}MAJOR_STR", $major),
|
|
|
805 |
pvbstring ("${vtag}MINOR_STR", $minor),
|
|
|
806 |
pvbstring ("${vtag}PATCH_STR", $patch),
|
|
|
807 |
pvbstring ("${vtag}BUILD_STR", $build),
|
|
|
808 |
pvbstring ("${vtag}PATCHBUILD_STR", $raw_patch),
|
|
|
809 |
pvbstring ("${vtag}PROJECT", $BUILDNAME_PROJECT),
|
|
|
810 |
pvbnum ("${vtag}MAJOR", $major),
|
|
|
811 |
pvbnum ("${vtag}MINOR", $minor),
|
|
|
812 |
pvbnum ("${vtag}PATCH", $patch),
|
|
|
813 |
pvbnum ("${vtag}BUILD", $build),
|
|
|
814 |
pvbnum ("${vtag}PATCHBUILD", $raw_patch),
|
|
|
815 |
pvbstring ("${vtag}ALL", "$BUILDNAME_PACKAGE ($BUILDNAME_VERSION.$BUILDNAME_PROJECT) @PACKAGEVERS"),
|
|
|
816 |
pvbnum ("${vtag}BUILDTIME", time()),
|
|
|
817 |
''
|
|
|
818 |
);
|
|
|
819 |
|
|
|
820 |
#
|
|
|
821 |
# Create a set of definitions for each dependent package
|
|
|
822 |
#
|
|
|
823 |
$fh->Comment("Dependent Packages and Versions\n");
|
|
|
824 |
$fh->Comment("\n");
|
|
|
825 |
|
|
|
826 |
foreach my $tag ( PackageEntry::GetPackageList() )
|
|
|
827 |
{
|
|
|
828 |
my ($name, $version, $type) = PackageEntry::GetPackageData($tag);
|
|
|
829 |
$fh->WriteLn(pstring ("${vtag}PACKAGE_$name", $version));
|
|
|
830 |
}
|
|
|
831 |
|
|
|
832 |
$fh->WriteLn();
|
|
|
833 |
$fh->Close();
|
|
|
834 |
}
|
|
|
835 |
|
|
|
836 |
|
| 289 |
dpurdie |
837 |
#-------------------------------------------------------------------------------
|
| 227 |
dpurdie |
838 |
# Function : stip_zeros
|
|
|
839 |
#
|
|
|
840 |
# Description : Remove leading 0's from a string
|
|
|
841 |
#
|
|
|
842 |
# Inputs : A string
|
|
|
843 |
#
|
|
|
844 |
# Returns : A string without leading zeros
|
|
|
845 |
#
|
|
|
846 |
sub strip_zeros
|
|
|
847 |
{
|
|
|
848 |
my ($text) = @_;
|
|
|
849 |
|
|
|
850 |
$text =~ s~^0*~~;
|
|
|
851 |
$text = '0' unless ( $text );
|
|
|
852 |
return $text;
|
|
|
853 |
}
|
|
|
854 |
|
|
|
855 |
1;
|