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.

117 lines
2.8 KiB

  1. REM
  2. REM We're building the 'asms.cab' file for the current language
  3. REM and processor architecture.
  4. REM
  5. setlocal
  6. setlocal DISABLEDELAYEDEXPANSION
  7. setlocal ENABLEEXTENSIONS
  8. set cablist=
  9. set comptype=-m NONE
  10. REM
  11. REM Baseline cab and the cab for this language
  12. REM
  13. set cablist=%cablist% asms.%_BuildArch%%_BuildType%.asms.cab
  14. if "%lang%" == "" set lang=usa
  15. set cablist=%cablist% asms.%_BuildArch%%_BuildType%.%lang%.cab
  16. REM
  17. REM On ia64 builds, we have to add the x86 assemblies as well.
  18. REM
  19. if "%_buildarch%" == "ia64" goto x86Wasms
  20. if "%_buildarch%" == "amd64" goto x86Wasms
  21. goto NoWasms
  22. :x86Wasms
  23. set cablist=%cablist% asms.x86%_BuildType%.asms.cab
  24. set cablist=%cablist% asms.x86%_BuildType%.wow6432.cab
  25. set cablist=%cablist% asms.%_BuildArch%%_BuildType%.wow6432.cab
  26. set cablist=%cablist% asms.x86%_BuildArch%%_BuildType%.%lang%.cab
  27. :NoWasms
  28. set CabTempPath=%temp%\sxs_cabmerge.%RANDOM%\
  29. mkdir %cabtemppath%
  30. call :ExpandCabs %cabtemppath% %cablist%
  31. call :MergeCabs %cabtemppath% %_ntpostbld%\asms.cab
  32. rmdir /s /q %cabtemppath%
  33. REM
  34. REM Short-circuit all this goop if there's on asms directory
  35. REM
  36. if not exist "%_ntpostbld%\asms" goto :EOF
  37. setlocal
  38. setlocal DISABLEDELAYEDEXPANSION
  39. setlocal ENABLEEXTENSIONS
  40. set nextcabfilenumber=
  41. REM
  42. REM First, go create a temporary directory for us to work in.
  43. REM
  44. set ExistingCabsExpansion=%temp%\sxs_current_cabs.%random%
  45. set BuiltAsmsList=%temp%\sxs_built_asms.%random%
  46. mkdir %existingcabsexpansion%
  47. mkdir %BuiltAsmsList%
  48. :FindNext
  49. if not exist %_ntpostbld%\asms%nextcabfilenumber%.cab goto NoMore
  50. set /a nextcabfilenumber=%nextcabfilenumber%+1
  51. goto :FindNext
  52. :NoMore
  53. REM
  54. REM Set up the built asms directory like it should be in a cab
  55. REM
  56. sxs_cabhelper -sourcepath %_ntpostbld%\asms -targetpath %BuiltAsmsList%
  57. if "%dopatching%"=="yes" (
  58. call :ExpandExistingCabs %_ntpostbld% %existingcabsexpansion%
  59. call :CreatePatches %BuiltAsmsList% %ExistingCabsExpansion%
  60. )
  61. for /f %%f in ('dir /b /ad %BuiltAsmsList%') do echo %%f\* >> %BuiltAsmsList%\list
  62. pushd %BuiltAsmsList%
  63. cabarc -p -r -P %BuiltAsmsList% %comptype% N %_ntpostbld%\asms%nextcabfilenumber%.cab @%BuiltAsmsList%\list
  64. popd
  65. rem rmdir /s /q %BuiltAsmsList%
  66. rem rmdir /s /q %ExistingCabsExpansion%
  67. goto :EOF
  68. :ExpandExistingCabs
  69. REM %1 = source of cabs
  70. REM %2 = target of cabs
  71. set localnumber=
  72. :ExpandAgain
  73. if not exist "%1\asms%localnumber%.cab" goto ExpandNoMore
  74. cabarc -p X "%1\asms%localnumber%.cab" * %2\
  75. set /a localnumber=%localnumber%+1
  76. goto :ExpandAgain
  77. :ExpandNoMore
  78. goto :EOF
  79. :ExpandCabs
  80. :Again
  81. cabarc -p X %_ntpostbld%\%2 * %1
  82. shift /2
  83. if not "%2" == "" goto :Again
  84. goto :EOF
  85. :MergeCabs
  86. pushd %1
  87. if exist "listing" delete "listing"
  88. for /f %%f in ('dir /b /ad') do echo %%f\* >> listing
  89. cabarc -p -P %CD% -r %comptype% -s 8192 N %2 @listing
  90. popd
  91. goto :EOF