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.

141 lines
3.8 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM MkTabCab.cmd - dougpa
  4. @REM Generate TabletPC.cab file.
  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. sub Usage { print<<USAGE; exit(1) }
  19. MkTabCab.cmd [-l <language>]
  20. This sript creates TabletPC.cab. This cabinet contains files which
  21. are only installed on Windows XP TabletPC edition.
  22. USAGE
  23. parseargs('?' => \&Usage);
  24. # *** TEMPLATE CODE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. @:CPCBegin
  28. @set _CPCMAGIC=
  29. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. @if not defined DEBUG echo off
  31. @REM Only build this .cab for x86
  32. if not defined x86 goto :End
  33. call logmsg.cmd "MkTabCab: Start TabletPC postbuild..."
  34. @REM
  35. @REM Use Iexpress.exe to generate the .cab
  36. @REM
  37. REM
  38. set DoubledPath=%_NTPostBld:\=\\%
  39. set NewSedFile=%Temp%\TabletPC.sed
  40. if exist %NewSedFile% del /f %NewSedFile%
  41. perl %~dp0\MkTabSed.pl < %_NTPostBld%\Tabletpc.inf > %NewSedFile%
  42. if not exist %NewSedFile% (
  43. call errmsg.cmd "File %NewSedFile% not found."
  44. goto :End
  45. )
  46. @REM
  47. @REM Generate TabletPC.cat
  48. REM
  49. set TabletPCTmp=%_NTPostBld%\TabletPC.tmp
  50. rd /s /q %TabletPCTmp%
  51. md %TabletPCTmp%
  52. set SourceFiles0=%_NTPOSTBLD%
  53. set SourceFiles1=%_NTPOSTBLD%
  54. if defined LANG if /i not "%LANG%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANG%
  55. if defined LANGUAGE if /i not "%LANGUAGE%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANGUAGE%
  56. set set SourceDir=%SourceFiles0%
  57. set CopyFile=
  58. for /f "tokens=1" %%a in (%NewSedFile%) do (
  59. if /i "%%a"=="[SourceFiles0]" (
  60. set CopyFile=1
  61. set SourceDir=%SourceFiles0%
  62. ) else (
  63. if /i "%%a"=="[SourceFiles1]" (
  64. set CopyFile=1
  65. set SourceDir=%SourceFiles1%
  66. ) else (
  67. if /i "!copyFile!"=="1" (
  68. set File=%%a
  69. set File=!File:~0,-1!
  70. copy /y !SourceDir!\!File! %TabletPCTmp%\!File!
  71. if errorlevel 1 (
  72. call errmsg.cmd "Could not copy %_NTPostBld%\!File!"
  73. set CopyErrors=1
  74. )
  75. )
  76. )
  77. )
  78. )
  79. if defined CopyErrors goto :End
  80. call deltacat %TabletPCTmp%
  81. if not exist %TabletPCTmp%\delta.cat (
  82. call errmsg.cmd "Could not find %TabletPCTmp%\delta.cat> Deltacat failed."
  83. goto :End
  84. )
  85. if exist %TabletPCTmp%\TabletPC.cat del /f /q %TabletPCTmp%\tabletpc.cat
  86. ren %TabletPCTmp%\Delta.cat TabletPC.cat
  87. if errorlevel 1 (
  88. call errmsg.cmd "Could not rename delta.cat to TabletPC.cat"
  89. goto :End
  90. )
  91. copy %TabletPCTmp%\TabletPC.cat %_NTPostBld%\TabletPC.cat
  92. if errorlevel 1 (
  93. call errmsg.cmd "Could not copy %TabletPCTmp%\TabletPC.cat to %_NTPostBld%"
  94. goto :End
  95. )
  96. REM
  97. REM Now generated TabletPC.cab
  98. REM
  99. if exist %_NTPostBld%\TabletPC.cab del /f %_NTPostBld%\TabletPC.cab
  100. REM
  101. REM Munge the path so we use the correct wextract.exe to build the package with...
  102. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  103. REM
  104. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\loc\%LANG%
  105. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  106. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  107. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %NewSedFile%"
  108. REM
  109. REM Return the path to what it was before...
  110. REM
  111. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  112. if not exist %_NtPostBld%\TabletPC.cab (
  113. call errmsg.cmd "IExpress.exe failed on %NewSedFile%. One or more files may be missing."
  114. goto :End
  115. )
  116. :End
  117. if defined TabletPCTmp if exist %TabletPCTmp% rd /s /q %TabletPCTmp%
  118. if "%errors%" == "" set errors=0
  119. seterror.exe %errors%& goto :EOF