Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.2 KiB

  1. #----------------------------------------------------------------//
  2. # Script: intlbld.pl
  3. #
  4. # (c) 2000 Microsoft Corporation. All rights reserved.
  5. #
  6. # Purpose: This script is a wrapper for intlbld.mak
  7. # It provides error checking, loging and usage.
  8. #
  9. # Version: <1.00> 07/28/2000 : Suemiao Rossognol
  10. #----------------------------------------------------------------//
  11. ###-----Set current script Name/Version.----------------//
  12. package intlbld;
  13. $VERSION = '1.00';
  14. $ENV{script_name} = 'intlbld.pl';
  15. ###-----Require section and extern modual.---------------//
  16. require 5.003;
  17. use strict;
  18. use lib $ENV{RazzleToolPath };
  19. use lib $ENV{RazzleToolPath } . "\\PostBuildScripts";
  20. no strict 'vars';
  21. no strict 'subs';
  22. no strict 'refs';
  23. use Logmsg;
  24. use cklang;
  25. use comlib;
  26. #------------------------------------------------------------------//
  27. #Function: Main
  28. #Parameter: (1) Language
  29. # (2) Target of the project
  30. # (3) Clean build flag
  31. #------------------------------------------------------------------//
  32. sub main
  33. {
  34. my( $pLang, $pTarget, $pIncr )=@_;
  35. my $intlmak = "$ENV{RazzleToolPath}\\intlbld.mak";
  36. $cmdLine = "nmake /f $intlmak LANGUAGE=$pLang LOGFILE=$ENV{LOGFILE} ERRFILE=$ENV{ERRFILE}";
  37. if( $pTarget )
  38. {
  39. $pTarget =~ s/\,/ /g;
  40. $cmdLine .= " " .$pTarget;
  41. }
  42. if( !$pIncr ){ $cmdLine .= " ". "CLEAN=1"; }
  43. &comlib::ExecuteSystem( $cmdLine );
  44. exit( !&comlib::CheckError($ENV{ERRFILE}, "Build Successfully" ) );
  45. }
  46. #------------------------------------------------------------------//
  47. #Function Usage
  48. #------------------------------------------------------------------//
  49. sub Usage
  50. {
  51. print <<USAGE;
  52. A wrapper for intlbld.mak which does the compile time localization.
  53. Usage:
  54. $0 -l:<lang> [-g:<LOGFILE>] [-e:<ERRFILE>] [-t:<Target>] [-c]
  55. -l Language.
  56. If "intl", compile libraries and headers common to all
  57. languages and targets. Otherwise, compile the given language.
  58. -g Log file.
  59. Defaults to %_NTTREE%\\build_logs\\intlbld.log for "intl"
  60. and to %_NTTREE%\\<LANG>\\build_logs\\intlbld.log otherwise.
  61. -e Error file.
  62. Defaults to %_NTTREE%\\build_logs\\intlbld.err for "intl"
  63. and to %_NTTREE%\\<LANG>\\build_logs\\intlbld.err otherwise.
  64. -t Target to build.
  65. Use ',' to separate multiple targets.
  66. Defaults to all targets.
  67. Tools\intlbld.txt lists the targets pertinent to international.
  68. -i Incremental build mode.
  69. Defaults to clean build.
  70. /? Displays usage.
  71. Examples:
  72. $0 -l:ger
  73. Does the compile time localization for GER.
  74. $0 -l:ger -t:INFS,PERFS -i
  75. Incremental build of the GER infs and performance counters.
  76. USAGE
  77. exit(1);
  78. }
  79. #------------------------------------------------------------------//
  80. #Cmd entry point for script.
  81. #------------------------------------------------------------------//
  82. if (eval("\$0 =~ /" . __PACKAGE__ . "\\.pl\$/i"))
  83. {
  84. # <run perl.exe GetParams.pm /? to get the complete usage for GetParams.pm>
  85. &GetParams ('-n', 'l:','-o', 'g:e:t:i', '-p', 'lang logfile errfile target incr', @ARGV);
  86. #Validate or Set default
  87. $lang = uc($lang);
  88. exit(1) if( !&ValidateParams( $lang, $logfile, $errfile ) );
  89. &comlib::ExecuteSystem( "VerifySym.cmd -l:$lang" );
  90. $rtno = &intlbld::main( $lang, $target, $incr );
  91. exit( !$rtno );
  92. }
  93. #----------------------------------------------------------------//
  94. #Function: GetParams
  95. #----------------------------------------------------------------//
  96. sub GetParams
  97. {
  98. use GetParams;
  99. #Call pm getparams with specified arguments
  100. &GetParams::getparams(@_);
  101. #Call the usage if specified by /?
  102. if ($HELP){ &Usage();}
  103. }
  104. #------------------------------------------------------------------//
  105. #Function ValidateParams
  106. #------------------------------------------------------------------//
  107. sub ValidateParams
  108. {
  109. my ( $pLang, $pLogfile, $pErrfile ) = @_;
  110. # Validate language
  111. if ( !cklang::CkLang($pLang) )
  112. {
  113. errmsg("Invalid language $pLang.");
  114. return 0;
  115. }
  116. # Define a default location for the log and err file
  117. my $defdir=$ENV{_NTTREE};
  118. $defdir .= "\\$pLang";
  119. $defdir .= "\\build_logs";
  120. if( !( -e $defdir ) )
  121. {
  122. &comlib::ExecuteSystem( "md $defdir");
  123. }
  124. #Define LOGFILE and ERRFILE
  125. $ENV{LOGFILE} = $pLogfile;
  126. if ( !$pLogfile )
  127. {
  128. $ENV{LOGFILE} = $defdir . "\\intlbld.log";
  129. # backup and clear log files at the beginning of every run
  130. -e $ENV{"LOGFILE"} and qx("copy $ENV{LOGFILE} $ENV{LOGFILE}.old");
  131. }
  132. $ENV{ERRFILE} = $pErrfile;
  133. if( !$pErrfile )
  134. {
  135. $ENV{ERRFILE} = $defdir . "\\intlbld.err";
  136. # backup and clear log files at the beginning of every run
  137. -e $ENV{"ERRFILE"} and qx("copy $ENV{ERRFILE} $ENV{ERRFILE}.old");
  138. }
  139. # Nuke the existing logging files.
  140. &comlib::ExecuteSystem( "del $ENV{LOGFILE}" ) if( -e $ENV{LOGFILE} );
  141. &comlib::ExecuteSystem( "del $ENV{ERRFILE}" ) if( -e $ENV{ERRFILE} );
  142. return 1;
  143. }
  144. #------------------------------------------------------------------//
  145. 1;