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.

141 lines
4.2 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM startcompress.cmd
  5. REM Starts parallel compression
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. if defined _CPCMAGIC goto CPCBegin
  11. perl -x "%~f0" %*
  12. goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. startcompress <PreComp|PostComp|EndComp> [-l <language>]
  21. Starts parallel compression
  22. USAGE
  23. parseargs('?' => \&Usage,
  24. sub { $ENV{OPTION} = shift });
  25. # *** NEXT FEW LINES ARE TEMPLATE ***
  26. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  27. __END__
  28. :CPCBegin
  29. set _CPCMAGIC=
  30. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  31. REM *** BEGIN YOUR 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