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.

242 lines
7.0 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM spcopywow64.cmd - Surajp
  4. @REM Copy appropriate 32bit files from a release into a 64bit build
  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. use Logmsg;
  19. sub Usage { print<<USAGE; exit(1) }
  20. copywow64 [-l <language>] [-qfe:qfe number]
  21. Copy appropriate 32bit files from a release into a 64bit build.
  22. If _NTWOWBINSTREE is set that is the location 32bit files will be
  23. copied from.
  24. USAGE
  25. sub Dependencies {
  26. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  27. errmsg("Unable to open dependency list file.");
  28. die;
  29. }
  30. print DEPEND<<DEPENDENCIES;
  31. \[$0\]
  32. IF {...}
  33. ADD {
  34. congeal_scripts\\blainf\\wowexcp.txt
  35. congeal_scripts\\covinf\\layout.inx
  36. congeal_scripts\\dtcinf\\wowexcp.txt
  37. congeal_scripts\\entinf\\wowexcp.txt
  38. congeal_scripts\\layout.inx
  39. congeal_scripts\\layout.txt
  40. congeal_scripts\\perinf\\wowexcp.txt
  41. congeal_scripts\\sbsinf\\wowexcp.txt
  42. congeal_scripts\\srvinf\\wowexcp.txt
  43. congeal_scripts\\wowexcp.txt
  44. congeal_scripts\\wowlist.inf
  45. }
  46. DEPENDENCIES
  47. close DEPEND;
  48. exit;
  49. }
  50. my $qfe;
  51. parseargs('?' => \&Usage,
  52. 'plan' => \&Dependencies,
  53. 'qfe:' => \$ENV{qfe});
  54. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  55. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  56. errmsg("Unable to open skip list file.");
  57. die;
  58. }
  59. while (<SKIP>) {
  60. chomp;
  61. exit if lc$_ eq lc$0;
  62. }
  63. close SKIP;
  64. }
  65. # *** TEMPLATE CODE ***
  66. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  67. __END__
  68. @:CPCBegin
  69. @set _CPCMAGIC=
  70. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  71. @if not defined DEBUG echo off
  72. @REM *** CMD SCRIPT BELOW ***
  73. REM This script generates a list of wow32 binaries to be copied from
  74. REM a 32 bit machine. The list itself is generated on the 64 bit machine
  75. REM Bail if your not on a 64 bit machine
  76. if /i "%_BuildArch%" neq "ia64" (
  77. if /i "%_BuildArch%" neq "amd64" (
  78. call logmsg.cmd "Not Win64, exiting."
  79. goto :End
  80. )
  81. )
  82. if not "%qfe%" == "" goto :GotNum
  83. if not exist %_ntpostbld%\congeal_scripts\__qfenum__ (
  84. call logmsg "Cannot get the Build number(File __qfenum__ missing) "
  85. goto :EOF
  86. )
  87. for /f "tokens=1,2 delims==" %%a in (%_ntpostbld%\congeal_scripts\__qfenum__) do (
  88. if "%%a" == "QFEBUILDNUMBER" (
  89. set BuildNumber=%%b
  90. goto :GotNum
  91. )
  92. )
  93. :GotNum
  94. REM If you want to get your own x86 bits instead of those from
  95. REM your VBL, you have to set _NTWOWBINSTREE
  96. if defined _NTWOWBINSTREE (
  97. set SourceDir=%_NTWOWBINSTREE%
  98. goto :GotSourceDir
  99. )
  100. if not "%qfe%" == "" (
  101. if defined OFFICIAL_BUILD_MACHINE (
  102. set srchString="BuildMachine::x86::%_BuildType%::QFE"
  103. ) else (
  104. set SourceDir=%_NTPostBld:ia64=x86%
  105. goto :GotSourceDir
  106. )
  107. ) else (
  108. set srchString="BuildMachine::x86::%_BuildType%::%lang%"
  109. )
  110. for /f "tokens=1,2 delims==" %%a in (%RazzleToolPath%\sp\xpsp1.ini) do (
  111. if /i "%%a" == !srchString! (
  112. set BuildMachine=%%b
  113. goto :BuildMachine
  114. )
  115. )
  116. call errmsg "unable to find the buildMachine for x86%_BuildType% and lang %lang% in xpsp1.ini"
  117. :BuildMachine
  118. if not "%qfe%" == "" (
  119. set SourceDir=\\%BuildMachine%\postbuild.x86%_BuildType%\%lang%
  120. ) else (
  121. set SourceDir=\\%BuildMachine%\release\%BuildNumber%\%lang%\x86%_BuildType%\bin
  122. )
  123. :GotSourceDir
  124. echo %SourceDir%
  125. :waitForX86Share
  126. if "%qfe%"=="" (
  127. if not exist %SourceDir% (
  128. echo Waiting for x86 share -- %SourceDir% ......
  129. sleep 120
  130. goto :waitForX86Share
  131. )
  132. ) else (
  133. findstr /bei Q%qfe% %SourceDir%\build_logs\CopyWowCanStart.txt >nul 2>nul
  134. if errorlevel 1 (
  135. echo Waiting for x86 share -- %SourceDir% ......
  136. sleep 5
  137. goto :waitForX86Share
  138. )
  139. )
  140. REM Set the Destination directory
  141. set DestDir=!_NTPostBld!\wowbins
  142. set UnCompDestDir=!_NTPostBld!\wowbins_uncomp
  143. REM Set the rest
  144. set outputfile=%tmp%\copywowlist.txt
  145. call logmsg.cmd "Copying files from %SourceDir%"
  146. REM Delete the output file if it already exists
  147. if exist %tmp%\copywowlist.txt del /f %tmp%\copywowlist.txt
  148. if exist %tmp%\copywowlist1 del /f %tmp%\copywowlist1
  149. pushd %_NTPostBld%\congeal_scripts
  150. REM File compare the x86 and 64-bit layout.inf
  151. REM If they are different log a warning
  152. fc %SourceDir%\congeal_scripts\layout.inx layout.inx 2>Nul 1>Nul
  153. if /i NOT "%ErrorLevel%" == "0" (
  154. call logmsg.cmd /t "WARNING: the x86 build machine's layout.inx is different than this machine's - continuing"
  155. )
  156. if /i "%Comp%" == "No" (
  157. if exist !DestDir! (
  158. if exist !UnCompDestDir! rd /s /q !UnCompDestDir!
  159. if exist !DestDir! move !DestDir! !UnCompDestDir!
  160. )
  161. )
  162. REM Make the dosnet.tmp1 list: file with filenames and Media IDs.
  163. copy /b layout.inx+layout.txt dosnet.tmp1
  164. prodfilt dosnet.tmp1 dosnet.tmp2 +@
  165. prodfilt dosnet.tmp2 dosnet.tmp1 +i
  166. rem wowlist -i dosnet.tmp1 -c wowlist.inf -f w -o dosnet.tmp2 -ac -p 2>NUL
  167. wowlist -i dosnet.tmp1 -c wowlist.inf -o dosnet.tmp2 -ac 2>NUL
  168. copy /b dosnet.tmp2+wowexcp.txt dosnet.tmp1
  169. copy /b layout.inx+layout.txt layout64.tmp1
  170. prodfilt layout64.tmp1 layout64.tmp2 +w
  171. prodfilt layout64.tmp2 layout64.tmp1 +m
  172. REM Process dosnet.tmp1 using layout64.tmp1 to get appropriate
  173. REM folder relative to \i386 and prepend to the entry before writing out to the outputfile
  174. call ExecuteCmd "perl %RazzleToolPath%\postbuildscripts\Copywowlist.pl layout64.tmp1 dosnet.tmp1 %outputfile%"
  175. copy %outputfile% %_NTPostBld%\congeal_scripts\copywowlist.txt
  176. if not exist !UnCompDestDir! md !UnCompDestDir!
  177. if /i "%Comp%" == "Yes" (
  178. if not exist !DestDir! md !DestDir!
  179. )
  180. set copyWowList=%_NTPostBld%\congeal_scripts\copywowlist.txt
  181. echo "perl %Razzletoolpath%\sp\spcopywow.pl %_NTPOSTBLD%\..\build_logs\files.txt %copyWowList% %SourceDir% %_NTPOSTBLD%\wowbins_uncomp %qfe%"
  182. perl %Razzletoolpath%\sp\spcopywow.pl %_NTPOSTBLD%\..\build_logs\files.txt %copyWowList% %SourceDir% %_NTPOSTBLD%\wowbins_uncomp %qfe%
  183. if exist %UnCompDestDir% (
  184. dir /b /a-d %UnCompDestDir% >%tmp%\wowlist.tmp
  185. for /f %%a in (%tmp%\wowlist.tmp) do (
  186. if exist %UnCompDestDir%\%%a ren %UnCompDestDir%\%%a w%%~nxa
  187. )
  188. )
  189. if exist %UnCompDestDir%\lang (
  190. dir /b /a-d %UnCompDestDir%\lang >%tmp%\wowlist_lang.tmp
  191. for /f %%a in (%tmp%\wowlist_lang.tmp) do (
  192. if exist %UnCompDestDir%\lang\%%a ren %UnCompDestDir%\lang\%%a w%%~nxa
  193. )
  194. )
  195. if not "%qfe%" == "" goto :last
  196. call ExecuteCmd.cmd "%RazzleToolPath%\sp\incwowcat.cmd"
  197. call ExecuteCmd.cmd "ntsign %UnCompDestDir%\wow64.cat"
  198. call ExecuteCmd.cmd "ntsign %UnCompDestDir%\lang\wowlang.cat"
  199. move %UnCompDestDir%\wow64.cat %_NTPOSTBLD%
  200. move %UnCompDestDir%\lang\wowlang.cat %_NTPOSTBLD%
  201. :last
  202. call ExecuteCmd.cmd "if exist !DestDir! rd /s/q !DestDir!"
  203. call ExecuteCmd.cmd "move !UnCompDestDir! !DestDir!"
  204. :end