summaryrefslogtreecommitdiffstats
path: root/ntversion.pl
blob: 586e8056cd620e5b29eb84c1445a6b593e1b5afe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# BEGIN COPYRIGHT BLOCK
# Copyright 2001 Sun Microsystems, Inc.
# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
# All rights reserved.
# END COPYRIGHT BLOCK
#
@date = localtime();
$FILEVERSION = &doubleDigit( $date[5] ) . ',' .		# year
    &doubleDigit( $date[4] + 1 ) . ',' .			# month
    &doubleDigit( $date[3] ) . ',' .				# date
    &doubleDigit( $date[2] );
$FILEVERSIONTEXT = '"' . &doubleDigit( $date[4] ) . '/' .	# month
    &doubleDigit( $date[3] ) . '/' .				# date
    &doubleDigit( $date[5] ) . ' ' .				# year
    &doubleDigit( $date[2] ) . ':' .				# hour
    &doubleDigit( $date[1] ) . '"';				# minute
$MAJORVERSION=$ARGV[1];
$MINORVERSION=$ARGV[2];

open(VERSIONFILE, ">$ARGV[0]/include/nt/ntversion.h"); 
print VERSIONFILE "// This file is automatically generated.\r\n";
print VERSIONFILE "// Please do not edit this file manually.\r\n";
print VERSIONFILE "// It contains the version number of this build.\r\n";
print VERSIONFILE "\r\n";
print VERSIONFILE "#define VERSION $FILEVERSION\r\n";
print VERSIONFILE "#define PRODUCT $MAJORVERSION,0,0,$MINORVERSION\r\n";
print VERSIONFILE "#define VERSIONTEXT $FILEVERSIONTEXT\r\n";
print VERSIONFILE "#define PRODUCTTEXT \"$MAJORVERSION.$MINORVERSION\"\r\n";
close( VERSIONFILE );

sub doubleDigit {
    $_[0] > 9 ? $_[0] : '0' . $_[0];
}