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.

756 lines
24 KiB

  1. @if "%_echo%"=="" echo off
  2. rem setting title based on some info
  3. @rem
  4. @rem Set some basic vars based on the path of this script
  5. @rem
  6. if "%RazzleScriptName%" == "" set RazzleScriptName=razzle
  7. if defined RazzleToolPath set RazzleAlreadyDefined=1
  8. set RazzleToolPath=%~dp0
  9. @rem Sometimes cmd leaves the trailing backslash on - remove it.
  10. if "%RazzleToolPath:~-1%" == "\" set RazzleToolPath=%RazzleToolPath:~0,-1%
  11. set _NTDRIVE=%~d0
  12. set _nttemproot=%~p0
  13. @rem Sometimes cmd leaves the trailing backslash on - remove it.
  14. if "%_nttemproot:~-1%" == "\" set _nttemproot=%_nttemproot:~0,-1%
  15. @rem Remove the trailing \tools if it exists.
  16. if /I "%_nttemproot:~-6%" == "\tools" set _nttemproot=%_nttemproot:~0,-6%
  17. set _NTROOT=%_nttemproot%
  18. set _nttemproot=
  19. @rem
  20. @rem Parse command line arguments
  21. @rem
  22. @rem
  23. @rem Please name all local variables to handle arguments "_ArgWhatever".
  24. @rem
  25. set _ArgAmd64=false
  26. set _ArgBinDir=
  27. set _ArgCheckDepots=false
  28. set _ArgChkKrnl=false
  29. set _ArgDotnet=false
  30. set _ArgEmulDir=
  31. set _ArgEmulation=false
  32. set _ArgEnigmaSigning=false
  33. set _ArgFree=false
  34. set _ArgNTTest=false
  35. set _ArgNgws=false
  36. set _ArgNoBatch=false
  37. set _ArgNoBin=false
  38. set _ArgNoCertCheck=false
  39. set _ArgNoOpt=false
  40. set _ArgNoPrefast=false
  41. set _ArgNoSDRefresh=false
  42. set _ArgNoTitle=false
  43. set _ArgNoURT=false
  44. set _ArgNoWebCheckin=false
  45. set _ArgOfficial=false
  46. set _ArgOffline=false
  47. set _ArgPocketPC=false
  48. set _ArgRemoteServer=false
  49. set _ArgRestPath=false
  50. set _ArgSepChar=.
  51. set _ArgTemp=
  52. set _ArgVaultSigning=false
  53. set _ArgWin64=false
  54. set _ArgWin32=false
  55. set _Arg_NTPostBld=
  56. if defined RazzleAlreadyDefined echo Razzle.cmd must be run from clean cmd window&goto Usage
  57. @rem The "exec" argument has special cleanup semantics
  58. set _ExecParams=false
  59. if exist %_NTDRIVE%%_NTROOT%\developer\%USERNAME%\setrazzle.cmd (
  60. call %_NTDRIVE%%_NTROOT%\developer\%USERNAME%\setrazzle.cmd
  61. )
  62. @rem RazzleArguments is set by setrazzle.cmd above
  63. if not "%RazzleArguments%" == "" (
  64. echo Default Razzle Arguments: %RazzleArguments%
  65. call :NextArg %RazzleArguments% %1 %2 %3 %4 %5 %6 %7 %8 %9
  66. goto :eof
  67. )
  68. :NextArg
  69. if "%1" == "help" goto Usage
  70. if "%1" == "-?" goto Usage
  71. if "%1" == "/?" goto Usage
  72. if "%1" == "-help" goto Usage
  73. if "%1" == "/help" goto Usage
  74. if /I "%1" == "Amd64" set _ArgAmd64=true&goto ArgOk
  75. if /I "%1" == "Binaries_dir" set _ArgBinDir=%2&shift&goto ArgOK
  76. if /I "%1" == "CheckDepots" set _ArgCheckDepots=true&goto ArgOK
  77. if /I "%1" == "ChkKernel" set _ArgChkKrnl=true&goto ArgOK
  78. if /I "%1" == "Coverage" echo coverage parameter is no longer supported&goto Usage
  79. if /I "%1" == "DotNet" set _ArgDotnet=true&goto ArgOK
  80. if /I "%1" == "Emulation" set _ArgEmulation=true&&goto ArgOk
  81. if /I "%1" == "Enigma" set _ArgEnigmaSigning=true&goto ArgOK
  82. if /I "%1" == "Exec" set _ExecParams=true&shift&goto GetStarted
  83. if /I "%1" == "Free" set _ArgFree=true&goto ArgOK
  84. if /I "%1" == "NTTest" set _ArgNTTest=true&goto ArgOK
  85. if /I "%1" == "Ngws" set _ArgNgws=true&goto ArgOK
  86. if /I "%1" == "No_batch" set _ArgNoBatch=true&goto ArgOK
  87. if /I "%1" == "No_binaries" set _ArgNoBin=true&goto ArgOK
  88. if /I "%1" == "No_certcheck" set _ArgNoCertCheck=true&goto ArgOK
  89. if /I "%1" == "No_opt" set _ArgNoOpt=true&goto ArgOK
  90. if /I "%1" == "No_prefast" set _ArgNoPrefast=true&goto ArgOK
  91. if /I "%1" == "No_sdrefresh" set _ArgNoSDRefresh=true&goto ArgOK
  92. if /I "%1" == "No_title" set _ArgNoTitle=true&goto ArgOK
  93. if /I "%1" == "No_urt" set _ArgNoURT=true&goto ArgOK
  94. if /I "%1" == "No_webcheckin" set _ArgNoWebCheckin=true&goto ArgOK
  95. if /I "%1" == "OfficialBuild" set _ArgOfficial=true&set _ArgRestPath=true&goto ArgOK
  96. if /I "%1" == "Offline" set _ArgOffline=true&goto ArgOK
  97. if /I "%1" == "Pocketpc" set _ArgPocketPC=true&&goto ArgOk
  98. if /I "%1" == "Postbld_dir" set _Arg_NTPostBld=%2&shift&goto ArgOK
  99. if /I "%1" == "PrimaryBuild" set _ArgOfficial=true&goto ArgOK
  100. if /I "%1" == "RemoteServer" set _ArgRemoteServer=true&goto ArgOK
  101. if /I "%1" == "Restricted_path" set _ArgRestPath=true&goto ArgOK
  102. if /I "%1" == "Sepchar" set _ArgSepChar=%2&shift&goto ArgOK
  103. if /I "%1" == "Temp" set _ArgTemp=%2&shift&goto ArgOK
  104. if /I "%1" == "URT" set _ArgNoURT=false & goto ArgOK
  105. if /I "%1" == "UseMyStoreCert" goto ArgOK
  106. if /I "%1" == "VaultSign" set _ArgVaultSigning=true&goto ArgOK
  107. if /I "%1" == "Verbose" set _echo=1&&echo on&goto ArgOK
  108. if /I "%1" == "WebCheckin" goto ArgOK
  109. if /I "%1" == "Win64" set _ArgWin64=true&goto ArgOK
  110. if /I "%1" == "Win32" set _ArgWin32=true&goto ArgOK
  111. if /I "%1" == "no_muimagic" set MUI_MAGIC=&goto ArgOK
  112. if /I "%1" == "no_perlcheck" set _ArgNoPerlCheck=1&goto ArgOK
  113. if NOT "%1" == "" echo Unknown argument: %1&goto Usage
  114. if "%1" == "" goto :GetStarted
  115. :ArgOK
  116. shift
  117. goto :NextArg
  118. @rem
  119. @rem OK, do the real stuff now
  120. @rem
  121. :GetStarted
  122. @rem Win9x support
  123. if "%PROCESSOR_ARCHITECTURE%" == "" set PROCESSOR_ARCHITECTURE=x86
  124. if "%COPYCMD%" == "" set COPYCMD=/Y
  125. set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  126. @rem Check for obvious mistakes
  127. if "%_ArgPocketPC%" == "true" (
  128. if "%_ArgWin64%" == "true" echo Win64 and PocketPC are mutually exclusive&goto Usage
  129. if "%_ArgAmd64%" == "true" echo AMD64 and PocketPC are mutually exclusive&goto Usage
  130. if NOT "%PROCESSOR_ARCHITECTURE%" == "x86" echo PocketPC is only built on X86&goto Usage
  131. )
  132. if "%_ArgEmulation%" == "true" (
  133. if "%_ArgWin64%" == "true" echo Win64 and Emulation are mutually exclusive&goto Usage
  134. if "%_ArgAmd64%" == "true" echo AMD64 and Emulation are mutually exclusive&goto Usage
  135. if "%_ArgPocketPC%" == "false" echo Emulation requires PocketPC&goto Usage
  136. )
  137. if "%_ArgAmd64%" == "true" (
  138. if "%_ArgWin64%" == "false" echo AMD64 requires Win64&goto Usage
  139. )
  140. if "%_ArgWin32%" == "true" (
  141. if "%PROCESSOR_ARCHITECTURE%" == "x86" echo Win32 is only for non-x86 machines&goto Usage
  142. )
  143. @rem
  144. @rem the script engines write some keys that cause signing errors during postbuild
  145. @rem unless they're whacked. Just do it here if the build # is between 2410 and 2480.
  146. @rem
  147. for /f "tokens=3 delims=.]" %%i in ('ver') do set OS_BUILDNUMBER=%%i
  148. @rem Previous line doesn't work on NT4. [Some ancient build machines still use NT4.]
  149. if "%OS_BUILDNUMBER%" == "" set OS_BUILDNUMBER=1381
  150. if %OS_BUILDNUMBER% GEQ 2410 (
  151. if %OS_BUILDNUMBER% LEQ 2480 (
  152. regini %RazzleToolPath%\delsip.ini
  153. )
  154. )
  155. @rem
  156. @rem Start with a pure system path. If people want to muck it up they can do so in their setenv.cmd
  157. @rem This will ensure we can build 16-bit stuff (16-bit tools sometimes puke on long paths) AND start
  158. @rem with the same environment all the time.
  159. @rem
  160. set BASE_OS_PATH=%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem
  161. @rem Set the default inf stamp date for Win .Net (let the version number continue to float)
  162. set STAMPINF_DATE=10/01/2002
  163. @rem set STAMPINF_VERSION=5.1.2535.0
  164. @rem
  165. @rem Put hook in for NTTest environment
  166. @rem
  167. if "%_ArgNTTest%" == "true" (
  168. set NTTestEnv=1
  169. @rem Turn off symbol checking for the test build environment until the tree is clean
  170. set BUILD_NO_SYMCHK=1
  171. )
  172. @rem
  173. @rem Enable offline building for the source kit (no MS network access)
  174. @rem
  175. if "%_ArgOffline%" == "true" (
  176. set BUILD_OFFLINE=1
  177. set _NO_DDK=1
  178. set _ArgNoPrefast=true
  179. set _ArgNoSDRefresh=true
  180. )
  181. @rem check for cross building
  182. set RazzleToolPath_CrossPlatform=
  183. set HOST_TOOLS=
  184. @rem
  185. @rem Pocket PC support
  186. @rem
  187. if "%_ArgPocketPC%" == "true" (
  188. set _BuildPocketPC=PocketPC
  189. if "%_ArgEmulation%" == "true" (
  190. set POCKETPC_EMULATION=1
  191. set _BuildPocketPC=PocketPC Emulation
  192. set _ArgEmulDir=em
  193. )
  194. set HOST_TOOLS="PATH=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;%RazzleToolPath%;%BASE_OS_PATH%"
  195. @rem PocketPC is always ARM and there's no other tools except the x86 hosted variants
  196. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\arm;
  197. set ARM=1
  198. set _BuildArch=arm
  199. @rem Prefast not available on ARM builds
  200. set _ArgNoPrefast=true
  201. set POCKETPC=1
  202. )
  203. @rem
  204. @rem Win64 support
  205. @rem
  206. if "%_ArgWin64%" == "true" (
  207. set HOST_TOOLS="PATH=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;%RazzleToolPath%;%BASE_OS_PATH%"
  208. @rem Prefast not available on win64 builds
  209. set _ArgNoPrefast=true
  210. @rem If amd64 is set, use it otherwise, assume ia64.
  211. if "%_ArgAmd64%" == "true" (
  212. set _BuildArch=amd64
  213. if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  214. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\win64\x86\amd64;%RazzleToolPath%\x86;
  215. ) else (
  216. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\win64\x86\amd64;
  217. )
  218. ) else (
  219. set _BuildArch=ia64
  220. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\win64\%PROCESSOR_ARCHITECTURE%;
  221. )
  222. if "%PROCESSOR_ARCHITECTURE%" == "x86" (
  223. @rem For now, managed toolset only exist on X86
  224. set MANAGED_TOOL_PATH=%RazzleToolPath%\x86\managed
  225. )
  226. )
  227. @rem
  228. @rem build x86 on win64, using the x86 on x86 tools
  229. @rem
  230. @rem THIS IT NOT SUPPORTED. USE AT YOUR OWN RISK.
  231. @rem
  232. @rem The parts of the tree that are built with 16bit tools will not build on Win64.
  233. @rem
  234. if "%_ArgWin32%" == "true" (
  235. set HOST_TOOLS="PATH=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;%RazzleToolPath%;%BASE_OS_PATH%"
  236. @rem assume Win32 is x86.
  237. set _BuildArch=x86
  238. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\x86;
  239. set 386=1
  240. @rem Force compiler/linker to use VC6 debug formats if building for X86.
  241. set _ML_=/Ztmp
  242. set _CL_=/Ztmp
  243. set _LINK_=/tmp
  244. )
  245. @rem
  246. @rem Native Support
  247. @rem
  248. if "%RazzleToolPath_CrossPlatform%" == "" (
  249. @rem Must be a native build
  250. set _BuildArch=%PROCESSOR_ARCHITECTURE%
  251. if "%PROCESSOR_ARCHITECTURE%" == "x86" (
  252. set 386=1
  253. @rem Force compiler/linker to use VC6 debug formats if building for X86.
  254. set _ML_=/Ztmp
  255. set _CL_=/Ztmp
  256. set _LINK_=/tmp
  257. set PCOPY_COMPARE_DEBUG=1
  258. @rem For now, managed code only exists on X86.
  259. set MANAGED_TOOL_PATH=%RazzleToolPath%\x86\managed
  260. )
  261. )
  262. set BUILD_DEFAULT_TARGETS=-%_BuildArch%
  263. set %_BuildArch%=1
  264. @rem Make sure the perl binaries are current
  265. call %RazzleToolPath%\perlrefresh.cmd
  266. set RazzleToolPath_Perl=%RazzleToolPath%\perl\bin;
  267. set PERL5LIB=%RazzleToolPath%\perl\site\lib;%RazzleToolPath%\perl\lib
  268. if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  269. set RazzleToolPath_Native=%RazzleToolPath_CrossPlatform%
  270. set RazzleToolPath_CrossPlatform=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;
  271. ) else (
  272. set RazzleToolPath_Native=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%
  273. )
  274. if "%_ArgNoPrefast%" == "false" set RazzleToolPath_Prefast=%RazzleToolPath%\x86\prefast\scripts;
  275. @rem
  276. @rem Build up the path
  277. @rem
  278. set BUILD_PATH=%RazzleToolPath_CrossPlatform%
  279. if "%CORPATH%" == "" goto _NoCorPath
  280. set BUILD_PATH=%BUILD_PATH%%CORPATH%;
  281. :_NoCorPath
  282. set BUILD_PATH=%BUILD_PATH%%RazzleToolPath_Native%;%RazzleToolPath_Perl%%RazzleToolPath%;%BASE_OS_PATH%
  283. :_NoManagedPath
  284. set PATH=%RazzleToolPath_CrossPlatform%%RazzleToolPath_Native%;%RazzleToolPath_Perl%%RazzleToolPath%;%RazzleToolPath_Prefast%;%PATH%
  285. set RazzleToolPath_CrossPlatform=
  286. set RazzleToolPath_Perl=
  287. set RazzleToolPath_Native=
  288. set RazzleToolPath_Prefast=
  289. set BASE_OS_PATH=
  290. if "%UseUnsupportedOS%" == "" (
  291. if %OS_BUILDNUMBER% LEQ 2599 (
  292. echo Old OS build detected - Upgrade to XP ^(bld 2600^) or one of the .NET OS's ^(bld 35xx^)
  293. echo Old OS build detected - Upgrade to XP ^(bld 2600^) or one of the .NET OS's ^(bld 35xx^)
  294. sleep 5
  295. exit
  296. )
  297. )
  298. REM
  299. REM Install the URT.
  300. REM
  301. if "%MANAGED_TOOL_PATH%" == "" goto NoURTInstall
  302. if "%_ArgNoURT%" == "true" set MANAGED_TOOL_PATH=&goto NoURTInstall
  303. call %MANAGED_TOOL_PATH%\urtinstall\urtinstall.cmd
  304. @rem set BUILD_PATH=%BUILD_PATH%;%MANAGED_TOOL_PATH%\urt\%COMPLUS_VERSION%
  305. @rem set BUILD_PATH=%BUILD_PATH%;%MANAGED_TOOL_PATH%\sdk\bin
  306. :NoURTInstall
  307. @rem
  308. @rem Set temp/tmp dirs if specified
  309. @rem
  310. if /i "%_ArgTemp%" == "" goto EndSetTemp
  311. set TEMP=%_ArgTemp%
  312. set TMP=%_ArgTemp%
  313. if NOT exist %_ArgTemp% (
  314. md %_ArgTemp% 2>Nul 1>Nul
  315. )
  316. :EndSetTemp
  317. @rem
  318. @rem Check/free build? Default to checked
  319. @rem
  320. set _KernelType=
  321. if "%_ArgFree%" == "true" goto BuildFree
  322. set NTDEBUG=ntsd
  323. set NTDEBUGTYPE=windbg
  324. set COMPRESS_PDBS=1
  325. set _BuildType=chk
  326. goto CheckOptimization
  327. :BuildFree
  328. set NTDEBUG=ntsdnodbg
  329. set NTDEBUGTYPE=windbg
  330. set COMPRESS_PDBS=1
  331. set _BuildType=fre
  332. if "%_ArgChkKrnl%" == "true" set BUILD_CHECKED_KERNEL=1&& set _KernelType=/ChkKernel
  333. :CheckOptimization
  334. @rem
  335. @rem Disable compiler optimizations?
  336. @rem
  337. set _BuildOpt=full opt
  338. if "%_ArgNoOpt%" == "true" set MSC_OPTIMIZATION=/Odi&& set _BuildOpt=no opt
  339. @rem
  340. @rem Binplace? Default to yes with base location of %_NTDRIVE%\binaries
  341. @rem
  342. if "%_ArgNoBin%" == "true" goto NoBinplace
  343. set BinariesDir=%_NTDRIVE%\binaries
  344. @rem
  345. @rem Override base Binplace location? (Still append architecture and type)
  346. @rem
  347. if "%_ArgBinDir%" == "" goto SetBinplace
  348. set BinariesDir=%_ArgBinDir%
  349. :SetBinplace
  350. set _NT%_BuildArch%TREE=%BinariesDir%%_ArgSepChar%%_BuildArch%%_ArgEmulDir%%_BuildType%
  351. set _NTTREE=%BinariesDir%%_ArgSepChar%%_BuildArch%%_ArgEmulDir%%_BuildType%
  352. set NTDBGFILES=1
  353. set NTDBGFILES_PRIVATE=1
  354. set BINPLACE_FLAGS=-xa -:LOGPDB
  355. if "%__MTSCRIPT_ENV_ID%"=="" (
  356. set BINPLACE_LOG=%BinariesDir%%_ArgSepChar%%_BuildArch%%_BuildType%\build_logs\binplace.log
  357. ) else (
  358. set BINPLACE_LOG=%BinariesDir%%_ArgSepChar%%_BuildArch%%_BuildType%\build_logs\binplace_%COMPUTERNAME%.log
  359. )
  360. set BINPLACE_EXCLUDE_FILE=%RazzleToolPath%\symbad.txt
  361. set NTBBT=1
  362. set _BuildBins=binaries in: %BinariesDir%%_ArgSepChar%%_BuildArch%%_ArgEmulDir%%_BuildType%
  363. set BinariesDir=
  364. :NoBinplace
  365. @rem
  366. @rem Define %_NTPostBld% path
  367. @rem
  368. set _NTPOSTBLD=%_NTTREE%
  369. if /i "%_Arg_NTPostBld%" == "" goto EndNTPostBld
  370. set _NTPOSTBLD=%_Arg_NTPostBld%%_ArgSepChar%%_BuildArch%%_BuildType%
  371. set _PostBuildBins=/postbuild in: %_NTPOSTBLD%
  372. :EndNTPostBld
  373. @rem
  374. @rem set vars etc for SD/SDX
  375. @rem
  376. if exist %RazzleToolPath%\SDINIT.CMD (
  377. call %RazzleToolPath%\SDINIT.CMD
  378. ) else (
  379. if "%SDCONFIG%" == "" set SDCONFIG=sd.ini
  380. if "%SDXROOT%" == "" set SDXROOT=%_NTDRIVE%%_NTROOT%
  381. )
  382. set SDDIFF=windiff.exe
  383. if "%_BuildPocketPC%" == "" (
  384. set _BuildWTitle=Build Window: %_BuildArch%/%_BuildType%%_KernelType%/%_BuildOpt%/%_BuildBins%%_PostBuildBins%
  385. ) else (
  386. set _BuildWTitle=Build Window: %_BuildPocketPC% %_BuildArch%/%_BuildType%%_KernelType%/%_BuildOpt%/%_BuildBins%%_PostBuildBins%
  387. )
  388. set BATCH_NMAKE=1
  389. @rem Make sure the sd client is current
  390. if "%_ArgNoSDRefresh%" == "false" call sdrefresh.cmd
  391. @rem Set the SignTool_Sign variable appropriately.
  392. if "%_ArgOffline%" == "true" (
  393. @rem Offline: Use the driver.pfx file for test signing (only available in OEM source kit)
  394. SET SIGNTOOL_SIGN=/f "%RazzleToolPath%\driver.pfx" /d "Microsoft Windows TEST" /du "http://ntbld"
  395. ) else (
  396. @rem Online: Use autoenrolled signing cert in cert store (only available to internal Microsoft users)
  397. SET SIGNTOOL_SIGN=/a /uw /r "Microsoft Test Root Authority" /d "Microsoft Windows TEST" /du "http://ntbld"
  398. )
  399. if "%_ArgNoCertCheck%" == "true" goto NoCertCheck
  400. @rem make sure the test root certificate is installed (so signcode etc will work).
  401. call CheckTestRoot.cmd
  402. call CheckTestPCA.cmd
  403. call SignTest.cmd
  404. :NoCertCheck
  405. @rem
  406. @rem Set PREFAST_ROOT so PREfast knows where it lives.
  407. @rem
  408. if "%_ArgNoPrefast%" == "true" goto NoPrefast
  409. set PREFAST_ROOT=%RazzleToolPath%\x86\prefast\
  410. :NoPrefast
  411. @rem
  412. @rem update the ACLs if necessary
  413. @rem
  414. if "%_ArgOffline%" == "true" goto NoRazAcl
  415. set SrcSDDLfile=%SDXROOT%\tools\sourceacl.txt
  416. set BinSDDLfile=%SDXROOT%\tools\binariesacl.txt
  417. if exist %_NTDRIVE%%_NTROOT%\developer\%USERNAME%\acl.txt (
  418. set SrcSDDLfile=%_NTDRIVE%%_NTROOT%\developer\%USERNAME%\acl.txt
  419. )
  420. if exist %_NTDRIVE%%_NTROOT%\developer\%USERNAME%\binacl.txt (
  421. set BinSDDLfile=%_NTDRIVE%%_NTROOT%\developer\%USERNAME%\binacl.txt
  422. )
  423. start /min razacl /SDDLfile:%SrcSDDLfile% /root:%SDXROOT%
  424. if "%_ArgOfficial%" == "false" (
  425. if /i not "%_NTTREE%" == "" ( if exist %_NTTREE% start /min razacl /SDDLfile:%BinSDDLfile% /root:%_NTTREE%)
  426. if /i not "%_NTPOSTBLD%" == "" (
  427. if /i not "%_NTPOSTBLD%" == "%_NTTREE%" (
  428. if exist %_NTPOSTBLD% start /min razacl /SDDLfile:%BinSDDLfile% /root:%_NTPOSTBLD%
  429. )
  430. )
  431. )
  432. set SrcSDDLfile=
  433. set BinSDDLfile=
  434. :NoRazAcl
  435. @rem
  436. @rem do this before setenv to allow people to override this slow, buggy cmd script
  437. @rem
  438. if NOT "%_ArgOffline%" == "true" (
  439. set BUILD_POST_PROCESS={Checkout Public Changes}%RazzleToolPath%\edit_public.cmd
  440. )
  441. @rem
  442. if EXIST %_NTDRIVE%%_NTROOT%\batch\setdbg.bat call %_NTDRIVE%%_NTROOT%\batch\setdbg.bat
  443. @rem And defer ntenv for the rest.
  444. call %_NTDRIVE%%_NTROOT%\TOOLS\ntenv.cmd
  445. @rem
  446. @rem Put hook in for ngws environment
  447. @rem
  448. if "%_ArgNgws%" == "true" call %SDXROOT%\proto\tools\ngwsenv.cmd
  449. @rem
  450. @rem Put hook in for dotnet environment
  451. @rem
  452. if "%_ArgDotnet%" == "true" call %SDXROOT%\hailstorm\tools\dotnetenv.cmd
  453. @rem
  454. @rem Now that we have called setenv, see it restricted_path is set. If it is, trim back PATH
  455. @rem
  456. if "%_ArgRestPath%" == "false" goto NoRestrictedPath
  457. path=%BUILD_PATH%
  458. :NoRestrictedPath
  459. if "%_ArgOffline%" == "true" goto NoPublicChangeNums
  460. pushd %_NTDRIVE%%_NTROOT%
  461. if NOT exist public mkdir public
  462. for %%i in (PUBLIC %BINARY_PUBLISH_PROJECTS%) do (
  463. if exist %_NTDRIVE%%_NTROOT%\%%i (
  464. call :GetPubChangeNum %%i
  465. ) else (
  466. echo No project %%i found. Ignoring.
  467. )
  468. )
  469. popd
  470. :NoPublicChangeNums
  471. @rem
  472. @rem Get the branch name for this enlistment
  473. @rem
  474. if "%_ArgOffline%" == "true" (
  475. set _BuildBranch=srckit
  476. ) else (
  477. for /f "eol=# tokens=1,2*" %%i in (%_NTBINDIR%\sd.map) do if "%%i" == "BRANCH" set _BuildBranch=%%k
  478. )
  479. if "%_ArgNoTitle%" == "true" goto NoTitle
  480. title %_BuildBranch% - %_BuildWTitle%
  481. :NoTitle
  482. @rem
  483. @rem Set SDFormEditor var to support Web-based checkin
  484. @rem for testing purposes only, in LAB03_N and LAB03_DEV
  485. @rem
  486. if "%_ArgNoWebCheckin%" == "true" goto NoWebCheckin
  487. if /I "%_BuildBranch%" == "Lab03_DEV" (
  488. if "%SDFORMEDITOR%" == "" (
  489. set SDALTFORMEDITOR=%SDEDITOR%
  490. ) else (
  491. set SDALTFORMEDITOR=%SDFORMEDITOR%
  492. )
  493. set SDFORMEDITOR=webchange.exe http://vbl03/checkin/webcheckin.aspx?key=
  494. )
  495. :NoWebCheckin
  496. @rem
  497. @rem Set the OFFICIAL_BUILD_MACHINE variable if appropriate
  498. @rem
  499. if "%_ArgOfficial%" == "true" call VerifyBuildMachine.cmd
  500. if NOT defined OFFICIAL_BUILD_MACHINE goto NotBuildMachine
  501. set __BUILDMACHINE__=%_BuildBranch%
  502. set NO_PDB_PATHS=1
  503. if /I "%_BuildType%" == "fre" (
  504. if /I "%_BuildBranch%" == "Lab01_N" set _NTPOGODIR=POGO
  505. if /I "%_BuildBranch%" == "Main" set _NTPOGODIR=POGO
  506. if /I "%_BuildBranch%" == "DNSRV" set _NTPOGODIR=POGO
  507. )
  508. goto BuildMachineVarDefined
  509. :NotBuildMachine
  510. @rem
  511. @rem Public build machines (where mutiple people log in via TS and do buddy builds) need a
  512. @rem fixed __BUILDMACHINE__ define, or you get compiler errors when you don't build clean
  513. @rem
  514. @rem Don't set __BUILDMACHINE__ variable when building offline
  515. if "%_ArgOffline%" == "true" goto BuildMachineVarDefined
  516. if NOT "%PUBLIC_BUILD_MACHINE%" == "" set __BUILDMACHINE__=%_BuildBranch%(%COMPUTERNAME%)
  517. if NOT "%PUBLIC_BUILD_MACHINE%" == "" goto BuildMachineVarDefined
  518. set __BUILDMACHINE__=%_BuildBranch%(%USERNAME%)
  519. :BuildMachineVarDefined
  520. @rem call %RazzleToolPath%\BuildStrLen.cmd
  521. @rem
  522. @rem Verify that temp/tmp don't contain spaces (many build scripts don't handle this).
  523. @rem
  524. set __NoSpaceTemp=%TEMP: =%
  525. if "%__NoSpaceTemp%" == "%TEMP%" goto VerifyTmp
  526. echo ERROR: TEMP environment variable "%TEMP%"
  527. echo ERROR: contains spaces - Please remove
  528. pause
  529. exit
  530. :VerifyTmp
  531. set __NoSpaceTemp=%TMP: =%
  532. if "%__NoSpaceTemp%" == "%TMP%" goto TempOK
  533. echo ERROR: TMP environment variable "%TMP%"
  534. echo ERROR: contains spaces - Please remove
  535. pause
  536. exit
  537. :TempOK
  538. set __NoSpaceTemp=
  539. @rem
  540. @rem Start a remote session
  541. @rem
  542. if not "%_ArgRemoteServer%" == "true" goto NoRemote
  543. for /F "delims=\: tokens=1-3" %%a in ('echo %SDXROOT%') do set RemoteName=%%a_%%b
  544. remote /s cmd %RemoteName% /V %RemoteIDsAccepted%
  545. :NoRemote
  546. if "%_ArgCheckDepots%" == "true" call checkdepots.cmd
  547. :Cleanup
  548. @rem
  549. @rem Cleanup local variables
  550. @rem
  551. for /f "delims==" %%a in ('set _Arg') do set %%a=
  552. @rem
  553. @rem Remaining optional parameters to this script are command line to execute.
  554. @rem Use a name not starting with "_Arg" so it won't be cleaned up above.
  555. @rem
  556. if "%_ExecParams%" == "true" set _ExecParams=&%1 %2 %3 %4 %5 %6 %7 %8 %9
  557. set _ExecParams=
  558. set RazzleScriptName=
  559. goto :eof
  560. :GetPubChangeNum
  561. @rem Make sure there's a public change# available for this user.
  562. if exist %_NTDRIVE%%_NTROOT%\public\%1_CHANGENUM.SD goto :eof
  563. call get_change_num.cmd %1 %1_CHANGENUM.SD "Public Change number - Do not submit this unless you're the build lab for this branch"
  564. attrib +r public\%1_CHANGENUM.SD
  565. goto :eof
  566. :usage
  567. echo.
  568. echo Usage: %RazzleScriptName% ^<arguments^>
  569. echo.
  570. echo where ^<arguments^> can be one or more of:
  571. echo verbose - Enable verbose execution of this script
  572. echo ntttest - Build NT test sources
  573. echo Win64 - Build for Win64 target
  574. echo if on x86 and amd64 defined, build for amd64
  575. echo if on x86 and amd64 undefined build for ia64
  576. echo PocketPC - Build for ARM PocketPC target
  577. echo Emulation - Build PocketPC emulation target
  578. echo free - Build free bits (default is to build checked)
  579. echo chkkernel - Checked kernel/hal/ntdll (use with 'free')
  580. echo no_opt - disable compiler optimizations
  581. echo mui_magic - generate language neutral build
  582. echo no_binaries - disable creation of the binaries^<sepchar^>^<arch^>^<buildtype^> dir.
  583. echo binaries_dir - must specify ^<basepath^> immediately after this switch.
  584. echo Use specified path as binplace dir instead of default.
  585. echo Default value is "binaries".
  586. echo sepchar - overrides default separator character "." placed between
  587. echo the binaries_dir and the arch. Default value is "."
  588. echo Useful for putting binaries under a common parent
  589. echo directory using '\' (don't specify the quotes).
  590. echo postbld_dir - must specify ^<basepath^> immediately after this switch.
  591. echo Use specified path for post build processes.
  592. echo Default is "binaries".
  593. echo For international provide a specific location to facilitate
  594. echo localization.
  595. echo temp - must specify ^<temp_dir^> immediately after this switch.
  596. echo Use specified path as TEMP and TMP values.
  597. echo Default value is set by the system.
  598. echo no_title - don't set the default window title bar.
  599. echo no_certcheck - don't ensure the testroot certificate is installed.
  600. echo no_sdrefresh - don't update sd.exe (for script use only)
  601. echo restricted_path - set path to the same restricted path that build uses
  602. echo (for debugging "why can't build find my tool" problems)
  603. echo officialbuild - Build as one of the official build machines for this branch.
  604. echo The machine and build type must be identified in
  605. echo %RazzleToolPath%\BuildMachines.txt.
  606. echo exec - Optionally execute the remaining command line.
  607. echo If specified, this must be the last razzle parameter
  608. echo specified. The remaining command line parameters are
  609. echo then passed to command prompt as is.
  610. echo Enigma - Will turn on CSP signing and CSP signature checks in advapi
  611. echo VaultSign - Will require that CSP's are vault signed with the Microsoft key
  612. if defined RazzleAlreadyDefined goto Cleanup
  613. set RazzleToolPath=
  614. set _NTDRIVE=
  615. set _NTROOT=
  616. goto Cleanup