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.

218 lines
5.5 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. use Logmsg;
  19. sub Usage { print<<USAGE; exit(1) }
  20. MkTabCab.cmd [-l <language>]
  21. This sript creates TabletPC.cab. This cabinet contains files which
  22. are only installed on Windows XP TabletPC edition.
  23. USAGE
  24. sub Dependencies {
  25. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  26. errmsg("Unable to open dependency list file.");
  27. die;
  28. }
  29. # Files in the usa inf are added to this list automatically, along with some intl files.
  30. # The rest need to be put in manually.
  31. print DEPEND<<DEPENDENCIES;
  32. \[$0\]
  33. IF { tabletpc.cab tabletpc.cat }
  34. ADD {
  35. mui\\drop\\tabletpc\\tabletmui.inf
  36. dicjp.bin
  37. dicjp.dll
  38. imchslm.dll
  39. imjplm.dll
  40. microsoft.ink.delaysigned.dll
  41. microsoft.ink.resources.delaysigned.dll
  42. mshwchs.dll
  43. mshwchsr.dll
  44. mshwcht.dll
  45. mshwchtr.dll
  46. mshwdeu.dll
  47. mshwfra.dll
  48. mshwjpn.dll
  49. mshwjpnr.dll
  50. mshwkor.dll
  51. mshwkorr.dll
  52. DEPENDENCIES
  53. my $file;
  54. $file = "$ENV{_NTTREE}\\tabletpc.inf";
  55. $file = "$ENV{__NTFILTER}\\tabletpc.inf" if !-f $file;
  56. sys("copy $file $ENV{TEMP}\\tabletpc.inf >nul 2>nul");
  57. my @files = `perl $ENV{RAZZLETOOLPATH}\\sp\\MkTabSed.pl -plan < $ENV{TEMP}\\tabletpc.inf`;
  58. for (@files) {
  59. print DEPEND lc $_;
  60. if ( /1033/ ) {
  61. my $file;
  62. ($file = $_) =~ s/1033/1041/;
  63. print DEPEND lc $file;
  64. ($file = $_) =~ s/1033/2052/;
  65. print DEPEND lc $file;
  66. }
  67. }
  68. print DEPEND "}\n\n";
  69. close DEPEND;
  70. exit($?);
  71. }
  72. sub sys {
  73. my $cmd = shift;
  74. logmsg("Running: $cmd");
  75. system($cmd);
  76. if ($?) {
  77. errmsg "$cmd ($?)";
  78. die;
  79. }
  80. }
  81. my $qfe;
  82. parseargs('?' => \&Usage,
  83. 'plan' => \&Dependencies,
  84. 'qfe:' => \$qfe);
  85. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  86. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  87. errmsg("Unable to open skip list file.");
  88. die;
  89. }
  90. while (<SKIP>) {
  91. chomp;
  92. exit if lc$_ eq lc$0;
  93. }
  94. close SKIP;
  95. }
  96. # *** TEMPLATE CODE ***
  97. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  98. __END__
  99. @:CPCBegin
  100. @set _CPCMAGIC=
  101. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  102. @if not defined DEBUG echo off
  103. @REM Only build this .cab for x86
  104. if not defined x86 goto :End
  105. call logmsg.cmd "MkTabCab: Start TabletPC postbuild..."
  106. @REM
  107. @REM Use Iexpress.exe to generate the .cab
  108. @REM
  109. REM
  110. set DoubledPath=%_NTPostBld:\=\\%
  111. set NewSedFile=%Temp%\TabletPC.sed
  112. if exist %NewSedFile% del /f %NewSedFile%
  113. perl %~dp0\MkTabSed.pl < %_NTPostBld%\Tabletpc.inf > %NewSedFile%
  114. if not exist %NewSedFile% (
  115. call errmsg.cmd "File %NewSedFile% not found."
  116. goto :End
  117. )
  118. @REM
  119. @REM Generate TabletPC.cat
  120. REM
  121. set TabletPCTmp=%_NTPostBld%\TabletPC.tmp
  122. rd /s /q %TabletPCTmp%
  123. md %TabletPCTmp%
  124. set SourceFiles0=%_NTPOSTBLD%
  125. set SourceFiles1=%_NTPOSTBLD%
  126. if defined LANG if /i not "%LANG%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANG%
  127. if defined LANGUAGE if /i not "%LANGUAGE%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANGUAGE%
  128. set set SourceDir=%SourceFiles0%
  129. set CopyFile=
  130. for /f "tokens=1" %%a in (%NewSedFile%) do (
  131. if /i "%%a"=="[SourceFiles0]" (
  132. set CopyFile=1
  133. set SourceDir=%SourceFiles0%
  134. ) else (
  135. if /i "%%a"=="[SourceFiles1]" (
  136. set CopyFile=1
  137. set SourceDir=%SourceFiles1%
  138. ) else (
  139. if /i "!copyFile!"=="1" (
  140. set File=%%a
  141. set File=!File:~0,-1!
  142. copy /y !SourceDir!\!File! %TabletPCTmp%\!File!
  143. if errorlevel 1 (
  144. call errmsg.cmd "Could not copy %_NTPostBld%\!File!"
  145. set CopyErrors=1
  146. )
  147. )
  148. )
  149. )
  150. )
  151. if defined CopyErrors goto :End
  152. call deltacat %TabletPCTmp%
  153. if not exist %TabletPCTmp%\delta.cat (
  154. call errmsg.cmd "Could not find %TabletPCTmp%\delta.cat> Deltacat failed."
  155. goto :End
  156. )
  157. if exist %TabletPCTmp%\TabletPC.cat del /f /q %TabletPCTmp%\tabletpc.cat
  158. ren %TabletPCTmp%\Delta.cat TabletPC.cat
  159. if errorlevel 1 (
  160. call errmsg.cmd "Could not rename delta.cat to TabletPC.cat"
  161. goto :End
  162. )
  163. copy %TabletPCTmp%\TabletPC.cat %_NTPostBld%\TabletPC.cat
  164. if errorlevel 1 (
  165. call errmsg.cmd "Could not copy %TabletPCTmp%\TabletPC.cat to %_NTPostBld%"
  166. goto :End
  167. )
  168. REM
  169. REM Now generated TabletPC.cab
  170. REM
  171. if exist %_NTPostBld%\TabletPC.cab del /f %_NTPostBld%\TabletPC.cab
  172. REM
  173. REM Munge the path so we use the correct wextract.exe to build the package with...
  174. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  175. REM
  176. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\loc\%LANG%
  177. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  178. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  179. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %NewSedFile%"
  180. REM
  181. REM Return the path to what it was before...
  182. REM
  183. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  184. if not exist %_NtPostBld%\TabletPC.cab (
  185. call errmsg.cmd "IExpress.exe failed on %NewSedFile%. One or more files may be missing."
  186. goto :End
  187. )
  188. :End
  189. if defined TabletPCTmp if exist %TabletPCTmp% rd /s /q %TabletPCTmp%
  190. if "%errors%" == "" set errors=0
  191. seterror.exe %errors%& goto :EOF