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.

369 lines
13 KiB

  1. @if "%_echo%" == "" echo off
  2. REM --------------------------------------------------------------------------
  3. REM --------------------------------------------------------------------------
  4. REM
  5. REM Master build script for generating a DX 8.0 DDK Image
  6. REM
  7. REM See :Usage for details of command line parameters
  8. REM
  9. REM TODO: Explicitly locate the build number and point files via source path?
  10. REM TODO: Use temporary directory for version file?
  11. REM TODO: Blow away temporary build location
  12. REM
  13. REM --------------------------------------------------------------------------
  14. REM --------------------------------------------------------------------------
  15. setlocal ENABLEEXTENSIONS
  16. setlocal ENABLEDELAYEDEXPANSION
  17. REM --------------------------------------------------------------------------
  18. REM --------------------------------------------------------------------------
  19. REM
  20. REM Step 1: Check parameters
  21. REM
  22. REM See :Usage for a description of the command line parameters of this
  23. REM command file
  24. REM
  25. REM --------------------------------------------------------------------------
  26. REM --------------------------------------------------------------------------
  27. REM Required parameters
  28. if {%1}=={} goto :Usage
  29. if {%2}=={} goto :Usage
  30. if {%3}=={} goto :Usage
  31. if {%4}=={} goto :Usage
  32. if {%5}=={} goto :Usage
  33. if {%6)=={} goto :Usage
  34. REM Give the parameters better names
  35. set TARGETDXDDKPATH=%1
  36. set PLATDDKPATH=%2
  37. set TMPDXDDKPATH=%3
  38. set SRCPATH=%4
  39. set DRIVERSRCPATH=%SRCPATH%\multimedia\DirectX\dxddk\video
  40. set WIN9XDRIVERSRCPATH=%SRCPATH%\multimedia\DirectX\dxddk\mill
  41. set SDKBINDIR=%5
  42. set SETUPPATH=%6
  43. set SYNCOPTIONS=%7
  44. set INCOPTIONS=%8
  45. REM Check that the directories that have to exist actually exist
  46. if not exist %PLATDDKPATH% (
  47. echo Error: Platform DDK root directory "%PLATDDKPATH%" does not exist
  48. goto :Usage
  49. )
  50. if not exist %SRCPATH% (
  51. echo Error: Source root directory "%SRCPATH%" directory does not exist
  52. goto :Usage
  53. )
  54. if not exist %DRIVERSRCPATH% (
  55. echo Error: Driver source root directory "%DRIVERSRCPATH%" directory does not exist
  56. goto :Usage
  57. )
  58. if not exist %WIN9XDRIVERSRCPATH% (
  59. echo Error: Win9x driver source root directory "%WIN9XDRIVERSRCPATH%" directory does not exist
  60. goto :Usage
  61. )
  62. REM Check the sync options
  63. set SYNC=
  64. if not "%SYNCOPTIONS%"=="" (
  65. if /i "%SYNCOPTIONS%"=="sync" (
  66. REM Sync sources prior to build
  67. set SYNC=1
  68. )
  69. )
  70. REM Check the build increment options
  71. if not "%INCOPTIONS%"=="" (
  72. if /i "%INCOPTIONS%"=="build" (
  73. REM Bump the build number
  74. set INCBLDNUM=1
  75. ) else (
  76. if /i "%INCOPTIONS%"=="point" (
  77. REM Bump the point build number
  78. set INCPNTNUM=1
  79. )
  80. )
  81. )
  82. if defined INCBLDNUM (
  83. echo Incrementing the build number
  84. )
  85. if defined INCPNTNUM (
  86. echo Incrementing the point build number
  87. )
  88. REM --------------------------------------------------------------------------
  89. REM --------------------------------------------------------------------------
  90. REM
  91. REM Step 2: Fetch (and increment if necessary) the build and point build
  92. REM numbers
  93. REM
  94. REM Notes On Version Number Generation
  95. REM
  96. REM This script can be used to automatically increment build and point build
  97. REM numbers. The current build and, optionally, point build numbers are stored
  98. REM in two data files in the same directory as this script files.
  99. REM
  100. REM These two data files are as follows:
  101. REM
  102. REM ddkbldno.txt Holds the current build number
  103. REM ddkpntno.txt Holds the current point build number
  104. REM
  105. REM In both cases the files contain a single decimal integer in ASCII text
  106. REM format.
  107. REM
  108. REM Whether these build and point build revision numbers are incremented is
  109. REM controlled by the variables INCBLDNUM and INCPNTNUM which are in turn
  110. REM set from the command line parameter
  111. REM
  112. REM --------------------------------------------------------------------------
  113. REM --------------------------------------------------------------------------
  114. REM Get the major build number
  115. call :GetBldNum
  116. REM Increment the build number (if the command invoker asked us to)
  117. REM Silly double if test syntax to avoid script limitation
  118. if defined INCBLDNUM (
  119. set /a BLDNUM=%BLDNUM%+1
  120. )
  121. if defined INCBLDNUM (
  122. echo %BLDNUM% >ddkbldno.txt
  123. )
  124. REM Get the point build number (if any)
  125. call :GetPntBldNum
  126. REM Increment the build number (if the command invoker asked us to)
  127. REM Silly double if test syntax to avoid script limitation
  128. if defined INCPNTNUM (
  129. set /a PNTBLDNUM=%PNTBLDNUM%+1
  130. )
  131. if defined INCPNTNUM (
  132. echo %PNTBLDNUM% >ddkpntno.txt
  133. )
  134. REM --------------------------------------------------------------------------
  135. REM --------------------------------------------------------------------------
  136. REM
  137. REM Step 3: Generate the version number file which we propogate to the DX DDK
  138. REM distribution (so people know what version of the DDK they have)
  139. REM
  140. REM --------------------------------------------------------------------------
  141. REM --------------------------------------------------------------------------
  142. set VERBANNER=Microsoft DirectX DDK Version 8.1
  143. if defined BLDNUM (
  144. if defined PNTBLDNUM (
  145. REM Build has a point number...
  146. echo %VERBANNER%.%BLDNUM%.%PNTBLDNUM% >dxddkver.txt
  147. ) else (
  148. REM No point number, build number only...
  149. echo %VERBANNER%.%BLDNUM% >dxddkver.txt
  150. )
  151. ) else (
  152. REM No build number file. Dump an unknown build number
  153. echo %VERBANNER%.****UNKNOWN**** > dxddkver.txt
  154. )
  155. REM Add the build number to the target build location
  156. if defined BLDNUM (
  157. set TARGETDXDDKPATH=%TARGETDXDDKPATH%
  158. )
  159. REM Display a banner in the log file
  160. type dxddkver.txt
  161. REM --------------------------------------------------------------------------
  162. REM --------------------------------------------------------------------------
  163. REM
  164. REM Step 4: If the command line specified that the sources should be sync'd
  165. REM up prior to building do that now.
  166. REM
  167. REM --------------------------------------------------------------------------
  168. REM --------------------------------------------------------------------------
  169. if not defined SYNC goto :NoSync
  170. REM sync up the main multimedia sources
  171. REM NOTE: This is normally to be disabled. We assume the DDK is built after
  172. REM the SDK and that the main SDK build syncs the multimedia depot and
  173. REM publishes the headers we need.
  174. REM cd /d %SRCPATH%\MultiMedia
  175. REM sd sync
  176. REM sync up the driver sources
  177. cd /d %SRCPATH%\\multimedia\DirectX\dxddk
  178. sd sync ...
  179. cd /d %SRCPATH%\Multimedia\DirectX\dxg\ddk
  180. :NoSync
  181. REM --------------------------------------------------------------------------
  182. REM --------------------------------------------------------------------------
  183. REM
  184. REM Step 4: Copy the DX DDK files to a temporary distribution location. This
  185. REM is the location from which we will build the binaries we distribute with
  186. REM the DDK
  187. REM
  188. REM --------------------------------------------------------------------------
  189. REM --------------------------------------------------------------------------
  190. call cpntddk.bat %TMPDXDDKPATH% %SRCPATH%
  191. REM --------------------------------------------------------------------------
  192. REM --------------------------------------------------------------------------
  193. REM
  194. REM Step 5: Build both debug and retail in the temporary location we just
  195. REM created
  196. REM
  197. REM --------------------------------------------------------------------------
  198. REM --------------------------------------------------------------------------
  199. cd /d %SRCPATH%\multimedia\DirectX\public\tools\bldscripts
  200. perl ddk_build.pl
  201. cd /d %SRCPATH%\Multimedia\DirectX\dxg\ddk
  202. cmd /C bldntddk.bat %PLATDDKPATH% %TMPDXDDKPATH% checked
  203. cmd /C bldntddk.bat %PLATDDKPATH% %TMPDXDDKPATH% free
  204. REM --------------------------------------------------------------------------
  205. REM --------------------------------------------------------------------------
  206. REM
  207. REM Step 6: Again copy the DX DDK files to this time to the actual target
  208. REM location.
  209. REM
  210. REM --------------------------------------------------------------------------
  211. REM --------------------------------------------------------------------------
  212. call cpntddk.bat %TARGETDXDDKPATH% %SRCPATH% %SDKBINDIR%
  213. REM --------------------------------------------------------------------------
  214. REM --------------------------------------------------------------------------
  215. REM
  216. REM Step 7: Copy the binaries we built in the temporary location to the target
  217. REM location
  218. REM
  219. REM --------------------------------------------------------------------------
  220. REM --------------------------------------------------------------------------
  221. call cpntbin.bat %TARGETDXDDKPATH% %TMPDXDDKPATH%
  222. REM --------------------------------------------------------------------------
  223. REM --------------------------------------------------------------------------
  224. REM
  225. REM Step 8: Generate the setup .msi and place it in the target location
  226. REM
  227. REM --------------------------------------------------------------------------
  228. REM --------------------------------------------------------------------------
  229. cd /d %SRCPATH%\multimedia\DirectX\public\tools\bldscripts
  230. perl ddk_wise.pl
  231. cd /d %SRCPATH%\Multimedia\DirectX\dxg\ddk
  232. call ntsetup.bat %SETUPPATH% %SRCPATH%\multimedia\DirectX\dxg\ddk\setup %TARGETDXDDKPATH% %TARGETDXDDKPATH%
  233. REM --------------------------------------------------------------------------
  234. REM --------------------------------------------------------------------------
  235. REM
  236. REM Step 9: Done
  237. REM
  238. REM --------------------------------------------------------------------------
  239. REM --------------------------------------------------------------------------
  240. goto :EOF
  241. REM --------------------------------------------------------------------------
  242. REM --------------------------------------------------------------------------
  243. REM
  244. REM :GetBldNum
  245. REM
  246. REM Extract the current build number from the build number data file and set
  247. REM the variable BLDNUM to that value
  248. REM
  249. REM --------------------------------------------------------------------------
  250. REM --------------------------------------------------------------------------
  251. :GetBldNum
  252. if exist ddkbldno.txt (
  253. for /f %%I in (ddkbldno.txt) do call :SetBldNumVar %%I
  254. )
  255. goto :EOF
  256. REM --------------------------------------------------------------------------
  257. REM --------------------------------------------------------------------------
  258. REM
  259. REM :SetBldNumVar
  260. REM
  261. REM Sets the build number variable (BLDNUM) to the value given by %1
  262. REM
  263. REM This procedure is only necessary due to stupid script limitations
  264. REM
  265. REM --------------------------------------------------------------------------
  266. REM --------------------------------------------------------------------------
  267. :SetBldNumVar
  268. set BLDNUM=%1
  269. goto :EOF
  270. REM --------------------------------------------------------------------------
  271. REM --------------------------------------------------------------------------
  272. REM
  273. REM :GetPntBldNum
  274. REM
  275. REM Extract the current point build number from the build number data file and
  276. REM set the variable PNTBLDNUM to that value
  277. REM
  278. REM --------------------------------------------------------------------------
  279. REM --------------------------------------------------------------------------
  280. :GetPntBldNum
  281. if exist ddkpntno.txt (
  282. for /f %%I in (ddkpntno.txt) do call :SetPntBldNumVar %%I
  283. )
  284. goto :EOF
  285. REM --------------------------------------------------------------------------
  286. REM --------------------------------------------------------------------------
  287. REM
  288. REM :SetPntBldNumVar
  289. REM
  290. REM Sets the point build number variable (PNTBLDNUM) to the value given by %1
  291. REM
  292. REM This procedure is only necessary due to stupid script limitations
  293. REM
  294. REM --------------------------------------------------------------------------
  295. REM --------------------------------------------------------------------------
  296. :SetPntBldNumVar
  297. set PNTBLDNUM=%1
  298. goto :EOF
  299. REM --------------------------------------------------------------------------
  300. REM --------------------------------------------------------------------------
  301. REM
  302. REM :Usage
  303. REM
  304. REM Display usage for this batch file
  305. REM
  306. REM --------------------------------------------------------------------------
  307. REM --------------------------------------------------------------------------
  308. :Usage
  309. echo usage: dxntddk ^<Target Dir^> ^<Platform DDK Dir^> ^<DX DDK Tmp Dir^>
  310. echo ^<Source Dir^> ^<DInput Mapper Dir^> ^<Setup Program Dir^>
  311. echo ^[sync ^| nosync^] ^[build ^| point^]
  312. echo where:
  313. echo ^<Target Dir^> is the target location of the DDK build
  314. echo ^<Plafrom DDK Dir^> is the root of the Platform DDK installation
  315. echo ^<DX DDK Tmp Dir^> is the temporary DX DDK location for building
  316. echo ^<Source Dir^> is the root of the SD sources
  317. echo ^<SDK Bin Dir^> is the location of binaries built by the SDK
  318. echo ^<Setup Program Dir^> is the location of the Setup generation program
  319. echo ^[sync ^| nosync^] sync to sync sources before building
  320. echo ^[build ^| point^] build to bump build number, point to bump point revision