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.

200 lines
4.6 KiB

  1. @ echo off
  2. @ REM ========================================================================
  3. @ REM Copyright (c) 1996 Microsoft Corporation
  4. @ REM
  5. @ REM Module Name:
  6. @ REM
  7. @ REM build.bat
  8. @ REM
  9. @ REM Abstract:
  10. @ REM
  11. @ REM This batch file builds the Calais DDK kit.
  12. @ REM
  13. @ REM Author:
  14. @ REM
  15. @ REM Doug Barlow (dbarlow) 3/26/1997
  16. @ REM
  17. @ REM Updated
  18. @ REM
  19. @ REM Klaus U. Schutz 8/4/97
  20. @ REM
  21. @ REM ========================================================================
  22. setlocal ENABLEEXTENSIONS
  23. @ REM
  24. @ REM Initialize the working variables.
  25. @ REM
  26. set arch=
  27. if "%PROCESSOR_ARCHITECTURE%" == "x86" set arch=i386
  28. if "%PROCESSOR_ARCHITECTURE%" == "alpha" set arch=alpha
  29. if "%PROCESSOR_ARCHITECTURE%" == "mips" set arch=mips
  30. if "%PROCESSOR_ARCHITECTURE%" == "ppc" set arch=ppc
  31. if "%arch%" == "" goto noArchitecture
  32. set ntbindir=%_NTDRIVE%\%_NTROOT%
  33. @ REM
  34. @ REM Initialize special pointers
  35. @ REM
  36. set IEDrive=C:
  37. set IEPath=\Program Files\Internet Express
  38. set Calais=%_NTDRIVE%%_NTROOT%\Private\ISPU\Calais
  39. set ClDocs=%_NTDRIVE%%_NTROOT%\Private\ISPUdocs
  40. set KitDir=%Calais%\Tools\kits\DDK
  41. @ REM
  42. @ REM Make sure the target paths exist.
  43. @ REM
  44. if not exist "%IEDrive%%IEPath%\IExpress.exe" goto noIExpress
  45. if not exist %KitDir%\%tdir% mkdir %KitDir%\%tdir%
  46. if not exist %KitDir%\%tdir%\%arch% mkdir %KitDir%\%tdir%\%arch%
  47. if exist %KitDir%\%tdir%\%arch%\setup.exe del %KitDir%\%tdir%\%arch%\setup.exe
  48. if exist %KitDir%\%tdir%\%arch%\readme.txt del %KitDir%\%tdir%\%arch%\readme.txt
  49. @ REM
  50. @ REM Copy the files to cabdir
  51. @ REM
  52. mkdir cabdir
  53. for /f "tokens=1,2,3,4,5,6 delims=," %%i in (build.inf) do call :CopyToCabdir %%i %%k %%l %%m
  54. @ REM
  55. @ REM Build the cab inf file
  56. @ REM
  57. type scddk.mdf > temp
  58. set Num=0
  59. call :BuildCabInfFileP1 scddk.inf
  60. for /f "tokens=1,2,3,4,5,6 delims=," %%i in (build.inf) do call :BuildCabInfFileP1 %%l %%m
  61. echo [SourceFiles] >> temp
  62. echo SourceFiles0=%kitdir%\cabdir\ >> temp
  63. echo [SourceFiles0] >> temp
  64. set Num=0
  65. call :BuildCabInfFileP2
  66. for /f "tokens=1,2,3,4,5,6 delims=," %%i in (build.inf) do call :BuildCabInfFileP2
  67. @ REM
  68. @ REM build the inf file
  69. @ REM
  70. type scddk.inf > tmp.inf
  71. for /f "tokens=1,2,3,4,5,6 delims=," %%i in (build.inf) do call :BuildInfFile %%j %%l %%m %%n
  72. sed -e s/{ARCH}/%arch%/g tmp.inf > cabdir\scddk.inf
  73. @ REM
  74. @ REM Build the kit.
  75. @ REM
  76. sed -e s/{NTBINDIR}/%ntbindir%/g -e s/{DIR}/%tdir%/g -e s/{ARCH}/%arch%/g temp > temp.sed
  77. if not "%1" == "" goto stopBuild
  78. %IEDrive%
  79. cd "%IEPath%"
  80. IExpress.exe %KitDir%\temp.sed /N /Q
  81. %_NTDRIVE%
  82. cd %KitDir%
  83. del temp.sed
  84. rmdir /s /q cabdir
  85. goto end
  86. @ rem @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  87. @ rem soubroutines
  88. @ rem @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  89. @ rem
  90. @ rem %1 - file type
  91. @ rem %2 - path
  92. @ rem %3 - original file name
  93. @ rem %4 - cab file name
  94. @ rem
  95. :CopyToCabdir
  96. if %1 == 1 set SourceFile=%_NTDRIVE%%_NTROOT%\private\%2\%3
  97. if %1 == 2 set SourceFile=%_NTDRIVE%%_NTROOT%\private\%2\obj\%arch%\%3
  98. if %1 == 3 set SourceFile=%_NTDRIVE%%_NTROOT%\private\%2\objd\%arch%\%3
  99. if not exist %SourceFile% echo *** WARNING *** && echo File %SourceFile% does not exist && pause
  100. set DstFile=%4
  101. if "%4" == "" set DstFile=%3
  102. copy %SourceFile% cabdir\%DstFile% > NUL
  103. goto :eof
  104. @ rem
  105. @ rem %1 - component name
  106. @ rem %2 - original file name
  107. @ rem %3 - cab file name (can be empty)
  108. @ rem %4 - new file name (can be empty)
  109. @ rem
  110. :BuildInfFile
  111. set CabfileName=
  112. set NewfileName=
  113. if not "%ComponentName%" == "%1" echo [%1Files] >> tmp.inf && set ComponentName=%1
  114. set CabfileName=%3
  115. if "%CabfileName%" == "" set CabfileName=%2
  116. set NewfileName=%4
  117. if "%NewfileName%" == "" set NewfileName=%2
  118. echo %NewfileName%,%CabfileName%,,0x0004 >> tmp.inf
  119. goto :eof
  120. @ rem
  121. @ rem %1 - original file name
  122. @ rem %2 - cab file name
  123. @ rem
  124. :BuildCabInfFileP1
  125. set FileName=%2
  126. if "%2" == "" set FileName=%1
  127. echo FILE%Num%="%FileName%" >> temp
  128. set /a Num=%Num%+1
  129. goto :eof
  130. :BuildCabInfFileP2
  131. echo %%FILE%Num%%%= >> temp
  132. set /a Num=%Num%+1
  133. goto :eof
  134. @ REM
  135. @ REM Error processing.
  136. @ REM
  137. :stopBuild
  138. echo Processing has been terminated with all temporary files intact.
  139. echo Don't supply the "%1" parameter to build the kit.
  140. goto end
  141. :noDebug
  142. echo ERROR: NTDEBUG is undefined.
  143. goto end
  144. :noArchitecture
  145. echo ERROR: PROCESSOR_ARCHITECTURE is unset or unrecognized.
  146. goto end
  147. :noIExpress
  148. echo ERROR: IExpress is not installed in the default location.
  149. goto end
  150. :end
  151. endlocal