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.

141 lines
4.4 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM startcompress.cmd - BPerkins
  4. @REM Starts parallel compression
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if defined _CPCMAGIC goto CPCBegin
  10. @perl -x "%~f0" %*
  11. @goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use ParseArgs;
  18. sub Usage { print<<USAGE; exit(1) }
  19. startcompress <PreComp|PostComp|EndComp> [-l <language>]
  20. Starts parallel compression
  21. USAGE
  22. parseargs('?' => \&Usage,
  23. sub { $ENV{OPTION} = shift });
  24. # *** TEMPLATE CODE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. @:CPCBegin
  28. @set _CPCMAGIC=
  29. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. @if not defined DEBUG echo off
  31. @REM *** CMD SCRIPT BELOW ***
  32. if not exist %tmp%\compression md %tmp%\compression
  33. if NOT exist %_NTPostBld%\comp md %_NTPostBld%\comp
  34. if NOT exist %_NTPostBld%\comp\perinf md %_NTPostBld%\comp\perinf
  35. if NOT exist %_NTPostBld%\comp\blainf md %_NTPostBld%\comp\blainf
  36. if NOT exist %_NTPostBld%\comp\sbsinf md %_NTPostBld%\comp\sbsinf
  37. if NOT exist %_NTPostBld%\comp\srvinf md %_NTPostBld%\comp\srvinf
  38. if NOT exist %_NTPostBld%\comp\entinf md %_NTPostBld%\comp\entinf
  39. if NOT exist %_NTPostBld%\comp\dtcinf md %_NTPostBld%\comp\dtcinf
  40. if NOT exist %_NTPostBld%\comp\lang md %_NTPostBld%\comp\lang
  41. set EventNames=
  42. call :%option%
  43. if errorlevel 1 call errmsg "Invalid option %option%"
  44. if defined EventNames (
  45. perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -iwv !EventNames!
  46. )
  47. goto end
  48. :PreComp
  49. REM Add any PreComp processing here.
  50. REM If errors, goto end
  51. call logmsg.cmd /t "Beginning Startcompress precomp"
  52. if "%NUMBER_OF_PROCESSORS%" == "1" (
  53. set PreCompFiles=%TMP%\Precomp.lst
  54. set EventNames=precomp.lst
  55. ) else (
  56. set _NUMBER_OF_PROCESSORS=%NUMBER_OF_PROCESSORS%
  57. set NUMBER_OF_PROCESSORS=2
  58. if exist %TMP%\compression\precomp*.tmp del /f %TMP%\compression\precomp*.tmp
  59. Call %RazzleToolPath%\PostBuildScripts\SplitList.cmd -s %TMP%\precomp.lst -l %lang%
  60. for /l %%a in (1,1,!NUMBER_OF_PROCESSORS!) do (
  61. if exist %TMP%\Precomp.%%a (
  62. set PrecompFiles=!PrecompFiles! %TMP%\Precomp.%%a
  63. set EventNames=!EventNames! precomp.%%a
  64. )
  65. )
  66. set NUMBER_OF_PROCESSORS=!_NUMBER_OF_PROCESSORS!
  67. )
  68. for %%a in (%PrecompFiles%) do (
  69. start /min "PB_Precompress %%a" cmd /c %RazzleToolPath%\PostBuildScripts\startthread.cmd -e pre -c %%a -l %lang%
  70. )
  71. goto :EOF
  72. :PostComp
  73. REM Add any PostComp processing here.
  74. REM If errors, goto end
  75. call logmsg.cmd /t "Beginning Startcompress postcomp"
  76. if "%NUMBER_OF_PROCESSORS%" == "1" (
  77. set PostCompFiles=%TMP%\Postcomp.lst
  78. set EventNames=postcomp.lst
  79. ) else (
  80. if exist %TMP%\compression\postcomp*.tmp del /f %TMP%\compression\postcomp*.tmp
  81. set _NUMBER_OF_PROCESSORS=%NUMBER_OF_PROCESSORS%
  82. set NUMBER_OF_PROCESSORS=2
  83. Call %RazzleToolPath%\PostBuildScripts\SplitList.cmd -s %TMP%\postcomp.lst -l %lang%
  84. for /l %%a in (1,1,!NUMBER_OF_PROCESSORS!) do (
  85. if exist %TMP%\Postcomp.%%a (
  86. set PostcompFiles=!PostcompFiles! %TMP%\Postcomp.%%a
  87. set EventNames=!EventNames! postcomp.%%a
  88. )
  89. )
  90. set NUMBER_OF_PROCESSORS=!_NUMBER_OF_PROCESSORS!
  91. )
  92. for %%a in (%PostcompFiles%) do (
  93. start /min "PB_Postcompress %%a" cmd /c %RazzleToolPath%\PostBuildScripts\startthread.cmd -e post -c %%a -l %lang%
  94. )
  95. goto :EOF
  96. :Endcomp
  97. REM Add any EndComp processing here.
  98. REM If errors, goto end
  99. call logmsg.cmd /t "Beginning Startcompress endcomp"
  100. if "%NUMBER_OF_PROCESSORS%" == "1" (
  101. set AllCompFiles=%TMP%\allcomp.lst
  102. set EventNames=allcomp.lst
  103. ) else (
  104. if exist %TMP%\compression\allcomp*.tmp del /f %TMP%\compression\allcomp*.tmp
  105. Call %RazzleToolPath%\PostBuildScripts\SplitList.cmd -s %TMP%\Allcomp.lst -l %lang%
  106. for /l %%a in (1,1,!NUMBER_OF_PROCESSORS!) do (
  107. if exist %TMP%\Allcomp.%%a (
  108. set AllcompFiles=!AllcompFiles! %TMP%\Allcomp.%%a
  109. set EventNames=!EventNames! allcomp.%%a
  110. )
  111. )
  112. )
  113. for %%a in (%AllcompFiles%) do (
  114. start /min "PB_Endcompress %%a" cmd /c %RazzleToolPath%\PostBuildScripts\startthread.cmd -e all -c %%a -l %lang%
  115. )
  116. goto :EOF
  117. :end
  118. seterror.exe "%errors%"& goto :EOF