bug 316387 - make version_win.pl able to use the app version from configure vars, r=ted
authorRobert Kaiser <kairo@kairo.at>
Tue, 05 May 2009 19:28:16 +0200
changeset 27998 6c911e46665499429395525be3cb3eb20d3c2054
parent 27997 b1f84820222109855566dc9eaaa099cdc6c4d637
child 27999 d518bbb7db8601da6f3e37cf9fca7d499fe0b059
push id6836
push userkairo@kairo.at
push dateTue, 05 May 2009 17:31:15 +0000
treeherdermozilla-central@d518bbb7db86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs316387
milestone1.9.2a1pre
bug 316387 - make version_win.pl able to use the app version from configure vars, r=ted
config/version.mk
config/version_win.pl
--- a/config/version.mk
+++ b/config/version.mk
@@ -41,17 +41,17 @@ INCLUDED_VERSION_MK=1
 # TODO:
 # PBI      : Private build info.  Not used currently.
 #            Guessing the best way would be to set an env var.
 # BINARY   : Binary name.  Not used currently.
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 ifndef RESFILE
 RCFILE=./module.rc
 RESFILE=./module.res
-_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(topsrcdir) -BITS $(MOZ_BITS) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME)
+_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(topsrcdir) -BITS $(MOZ_BITS) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
 ifneq ($(BUILD_OFFICIAL)_$(MOZILLA_OFFICIAL),_)
 _RC_STRING += -OFFICIAL 1
 endif
 ifdef MOZ_DEBUG
 _RC_STRING += -DEBUG 1
 endif
 ifdef MODULE
 _RC_STRING += -MODNAME $(MODULE)
--- a/config/version_win.pl
+++ b/config/version_win.pl
@@ -69,16 +69,17 @@ sub daysFromBuildID
 # MSTONE - tells which milestone is being built;
 # OBJDIR - Holds the object directory;
 # MODNAME - tells what the name of the module is like nsBMPModule
 # DEPTH - Holds the path to the root obj dir
 # TOPSRCDIR - Holds the path to the root mozilla dir
 # SRCDIR - Holds module.ver and source
 # BINARY - Holds the name of the binary file
 # DISPNAME - Holds the display name of the built application
+# APPVERSION - Holds the version string of the built application
 # BITS - 16 or 32 bit
 # RCINCLUDE - Holds the name of the RC File to include or ""
 # QUIET - Turns off output
 
 #Description and Comment come from module.ver
 #Bug 23560
 #http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/rc_7x2d.asp
 
@@ -107,28 +108,30 @@ my ($quiet,$objdir,$debug,$official,$mil
 
 GetOptions( "QUIET" => \$quiet,
 		"DEBUG=s" => \$debug,
 		"OFFICIAL=s" => \$official,
 		"MSTONE=s" => \$milestone,
 		"MODNAME=s" => \$module,
 		"BINARY=s" => \$binary,
 		"DISPNAME=s" => \$displayname,
+		"APPVERSION=s" => \$appversion,
 		"SRCDIR=s" => \$srcdir,
 		"TOPSRCDIR=s" => \$topsrcdir,
 		"DEPTH=s" => \$depth,
 		"RCINCLUDE=s" => \$rcinclude,
 		"OBJDIR=s" => \$objdir,
 		"BITS=s" => \$bits);
 if (!defined($debug)) {$debug="";}
 if (!defined($official)) {$official="";}
 if (!defined($milestone)) {$milestone="";}
 if (!defined($module)) {$module="";}
 if (!defined($binary)) {$binary="";}
 if (!defined($displayname)) {$displayname="Mozilla";}
+if (!defined($appversion)) {$appversion=$milestone;}
 if (!defined($depth)) {$depth=".";}
 if (!defined($rcinclude)) {$rcinclude="";}
 if (!defined($objdir)) {$objdir=".";}
 if (!defined($srcdir)) {$srcdir=".";}
 if (!defined($topsrcdir)) {$topsrcdir=".";}
 if (!defined($bits)) {$bits="";}
 my $mfversion = "Personal";
 my $mpversion = "Personal";
@@ -221,16 +224,19 @@ close BUILDID;
 
 my $daycount = daysFromBuildID($buildid);
 
 if ($milestone eq "") {
     $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE);
 }
 
 $mfversion = $mpversion = $milestone;
+if ($appversion eq "") {
+  $appversion = $milestone;
+}
 
 if ($debug eq "1")
 {
 	push @fileflags, "VS_FF_DEBUG";
 	$mpversion .= " Debug";
 	$mfversion .= " Debug";
 }
 
@@ -247,34 +253,46 @@ my @mstone = split(/\./,$milestone);
 if (!$mstone[2]) {
     $mstone[2] = "0";
 }
 else {
     $mstone[2] =~s/\D.*$//;
 }
 $fileversion = $productversion="$mstone[0],$mstone[1],$mstone[2],$daycount";
 
+my @appver = split(/\./,$appversion);
+for ($j = 1; $j < 4; $j++)
+{
+    if (!$appver[$j]) {
+        $appver[$j] = "0";
+    }
+    else {
+        $appver[$j] =~s/\D.*$//;
+    }
+}
+my $winappversion = "$appver[0],$appver[1],$appver[2],$appver[3]";
+
 my $copyright = "License: MPL 1.1/GPL 2.0/LGPL 2.1";
 my $company = "Mozilla Foundation";
 my $trademarks = "Mozilla";
 my $productname = $displayname;
 
 
 if (defined($override_comment)){$override_comment =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $comment=$override_comment;}
 if (defined($override_description)){$override_description =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $description=$override_description;}
-if (defined($override_fileversion)){$fileversion=$override_fileversion;}
-if (defined($override_mfversion)){$mfversion=$override_mfversion;}
+if (defined($override_fileversion)){$override_fileversion =~ s/\@MOZ_APP_WINVERSION\@/$winappversion/g; $fileversion=$override_fileversion;}
+if (defined($override_mfversion)){$override_mfversion =~ s/\@MOZ_APP_VERSION\@/$appversion/g; $mfversion=$override_mfversion;}
 if (defined($override_company)){$company=$override_company;}
 if (defined($override_module)){$override_module =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $module=$override_module;}
 if (defined($override_copyright)){$override_copyright =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $copyright=$override_copyright;}
 if (defined($override_trademarks)){$override_trademarks =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $trademarks=$override_trademarks;}
 if (defined($override_filename)){$binary=$override_filename;}
 if (defined($override_productname)){$override_productname =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $productname=$override_productname;}
-if (defined($override_productversion)){$productversion=$override_productversion;}
-if (defined($override_mpversion)){$mpversion=$override_mpversion;}
+if (defined($override_productversion)){$override_productversion =~ s/\@MOZ_APP_WINVERSION\@/$winappversion/g; $productversion=$override_productversion;}
+if (defined($override_mpversion)){$override_mpversion =~ s/\@MOZ_APP_VERSION\@/$appversion/g; $mpversion=$override_mpversion;}
 
 
 #Override section
 
 open(RCFILE, ">$objdir/module.rc") || die("Can't edit module.rc - It must be locked.\n");
 print RCFILE qq{
 // ***** BEGIN LICENSE BLOCK *****
 // Version: MPL 1.1/GPL 2.0/LGPL 2.1