Source code of Windows XP (NT5)
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.

194 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, $pIsCleanBld )=@_;
  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( $pIsCleanBld ){ $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. -c Clean build mode.
  69. Defaults to incremental build.
  70. /? Displays usage.
  71. Examples:
  72. $0 -l:intl
  73. Generates the libraries and headers common to all languages.
  74. $0 -l:ger
  75. Does the compile time localization for GER.
  76. $0 -l:ger -t:INFS,PERFS -c
  77. Clean builds the GER infs and performance counters.
  78. USAGE
  79. exit(1);
  80. }
  81. #------------------------------------------------------------------//
  82. #Cmd entry point for script.
  83. #------------------------------------------------------------------//
  84. if (eval("\$0 =~ /" . __PACKAGE__ . "\\.pl\$/i"))
  85. {
  86. # <run perl.exe GetParams.pm /? to get the complete usage for GetParams.pm>
  87. &GetParams ('-n', 'l:','-o', 'g:e:t:c', '-p', 'lang logfile errfile target iscleanbld', @ARGV);
  88. #Validate or Set default
  89. $lang = uc($lang);
  90. exit(1) if( !&ValidateParams( $lang, $logfile, $errfile ) );
  91. $rtno = &intlbld::main( $lang, $target, $iscleanbld );
  92. exit( !$rtno );
  93. }
  94. #----------------------------------------------------------------//
  95. #Function: GetParams
  96. #----------------------------------------------------------------//
  97. sub GetParams
  98. {
  99. use GetParams;
  100. #Call pm getparams with specified arguments
  101. &GetParams::getparams(@_);
  102. #Call the usage if specified by /?
  103. if ($HELP){ &Usage();}
  104. }
  105. #------------------------------------------------------------------//
  106. #Function ValidateParams
  107. #------------------------------------------------------------------//
  108. sub ValidateParams
  109. {
  110. my ( $pLang, $pLogfile, $pErrfile ) = @_;
  111. # Validate language
  112. if ( uc($pLang) ne "INTL" && !cklang::CkLang($pLang) )
  113. {
  114. errmsg("Invalid language $pLang.");
  115. return 0;
  116. }
  117. # Define a default location for the log and err file
  118. my $defdir=$ENV{_NTTREE};
  119. if ( uc($pLang) ne "INTL" ) {
  120. $defdir .= "\\$pLang";
  121. }
  122. $defdir .= "\\build_logs";
  123. if( !( -e $defdir ) )
  124. {
  125. &comlib::ExecuteSystem( "md $defdir");
  126. }
  127. #Define LOGFILE and ERRFILE
  128. $ENV{LOGFILE} = $pLogfile;
  129. if ( !$pLogfile )
  130. {
  131. $ENV{LOGFILE} = $defdir . "\\intlbld.log";
  132. # backup and clear log files at the beginning of every run
  133. -e $ENV{"LOGFILE"} and qx("copy $ENV{LOGFILE} $ENV{LOGFILE}.old");
  134. }
  135. $ENV{ERRFILE} = $pErrfile;
  136. if( !$pErrfile )
  137. {
  138. $ENV{ERRFILE} = $defdir . "\\intlbld.err";
  139. # backup and clear log files at the beginning of every run
  140. -e $ENV{"ERRFILE"} and qx("copy $ENV{ERRFILE} $ENV{ERRFILE}.old");
  141. }
  142. # Nuke the existing logging files.
  143. &comlib::ExecuteSystem( "del $ENV{LOGFILE}" ) if( -e $ENV{LOGFILE} );
  144. &comlib::ExecuteSystem( "del $ENV{ERRFILE}" ) if( -e $ENV{ERRFILE} );
  145. return 1;
  146. }
  147. #------------------------------------------------------------------//
  148. 1;