os2snap.bat 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. @echo off
  2. rem *** $Id$
  3. rem *** Batch file for creating of FPC snapshot for OS/2.
  4. rem *** FPCDIR variable must be set to your base FPC directory and
  5. rem *** must _not_ contain forward slashes (only backslashes allowed).
  6. rem *** Please, note, that you need to have enough space for environment
  7. rem *** variables to run this batch - something like 2 kB should be enough
  8. rem *** unless path to FPC source is long (don't try to run it under Norton
  9. rem *** Commander or similar programs under DOS with COMMAND.COM as shell).
  10. rem *** Your compiler (PPC386.EXE per default) and AS.EXE must be somewhere
  11. rem *** on PATH (unless you set path to them explicitly using FPCTOOLS
  12. rem *** variable, which must end with \ if present). However, be sure which
  13. rem *** version of AS.EXE, etc. gets called if several such files exist.
  14. rem *** One of the following parameters may be specified: rtl, compiler,
  15. rem *** both, cycle and snapshot ("snapshot" being the default), optionally
  16. rem *** followed by parameters "debug" (causing debugging symbols not to be
  17. rem *** stripped from the created compiler), "release" (code optimization,
  18. rem *** debug info stripped out), and "verbose" (compiler messages are
  19. rem *** shown; the same can be accomplished with setting environment
  20. rem *** variable DOVERBOSE to 1). Parameters "debug" and "release" are
  21. rem *** mutually exclusive (the later is used if both are present).
  22. rem *** Parameters _must_ be in lowercase to be recognized correctly,
  23. rem *** unless running under 4dos or compatible (e.g. NDOS).
  24. rem *** Meaning of parameters:
  25. rem *** rtl .......... RTL only, _no_ snapshot created
  26. rem *** compiler ..... compiler only, _no_ snapshot created
  27. rem *** both ......... both RTL and compiler, _no_ snapshot created
  28. rem *** snapshot ..... both RTL and compiler, snapshot _is_ created
  29. rem *** cycle ........ RTL and compiler compiled, the resulting compiler
  30. rem *** is then copied to %FPCTOOLS% (BIN\OS2 by default)
  31. rem *** backing up possible previous version to ppos2.x),
  32. rem *** the whole procedure is started again (RTL is compiled
  33. rem *** with the new compiler version this time) and after
  34. rem *** another cycle (to make sure the new compiler works
  35. rem *** correctly) the snapshot is finally created
  36. rem *** PPC386.EXE is used for the compilation (for the first one only with
  37. rem *** "cycle" option), unless a different compiler name (e.g. PPOS2.EXE)
  38. rem *** is specified in FPCCOMPILER variable. In any case, the compiler should
  39. rem *** reside in the same directory as the other required tools (AS.EXE,
  40. rem *** LD.EXE, etc.).
  41. rem *** Environment variable OTHEROPTS may be used to specify additional
  42. rem *** switches (e.g. setting level of verbosity, etc.).
  43. rem *** Environment variable FPCERRLOG can specify a file for error logging
  44. rem *** (full path needed). Please, note, that the previous contents of
  45. rem *** file will be overwritten each time the batch file is run.
  46. rem *** Environment variable VERBOSEOPT may be used to specify level of
  47. rem *** verbosity used with "verbose" parameter (-va by default, i.e. show
  48. rem *** everything). Another way would be specifying this in OTHEROPTS
  49. rem *** variable (see above) and not using "verbose" at all.
  50. if .%FPCERRLOG% == . set FPCERRLOG=CON
  51. if .%FPCERRLOG% == . echo Error: Not enough environment space!!!
  52. if .%FPCERRLOG% == . exit
  53. echo *"Makefile" for OS/2: > %FPCERRLOG%
  54. echo *Setting up environment ... >> %FPCERRLOG%
  55. rem Check whether FPCDIR exists
  56. if %FPCDIR%. == . goto ErrorDir
  57. if exist %FPCDIR% goto DirOK
  58. if exist %FPCDIR%\. goto DirOK
  59. if exist %FPCDIR%\makefile goto DirOK
  60. if exist %FPCDIR%\COMPILER\pp.pas goto DirOK
  61. if exist %FPCDIR%\SOURCE\makefile goto DirOK
  62. if exist %FPCDIR%\SOURCE\COMPILER\pp.pas goto DirOK
  63. goto ErrorDir
  64. :DirOK
  65. rem Set path to the source files
  66. if exist %FPCDIR%\SOURCE goto SrcExists
  67. if exist %FPCDIR%\SOURCE\. goto SrcExists
  68. if exist %FPCDIR%\SOURCE\makefile goto SrcExists
  69. if exist %FPCDIR%\SOURCE\COMPILER\pp.pas goto SrcExists
  70. set FPCSRC=%FPCDIR%
  71. goto SetOpts
  72. :SrcExists
  73. set FPCSRC=%FPCDIR%\SOURCE
  74. :SetOpts
  75. rem Path to file with options
  76. set OS2OPTF=%FPCSRC%\OS2SNAP.OPT
  77. rem Path for the OS/2 RTL
  78. set OS2RTL=%FPCSRC%\RTL\OS2
  79. rem Path for OS/2 RTL parts compiled from common sources
  80. set OS2RTLC=%FPCSRC%\RTL\INC
  81. rem Path for OS/2 RTL parts compiled from processor dependent sources
  82. set OS2RTLP=%FPCSRC%\RTL\I386
  83. rem Path for OS/2 RTL parts for Object Pascal extensions
  84. set OS2RTLO=%FPCSRC%\RTL\OBJPAS
  85. rem Path to the compiler source
  86. set COMPSPATH=%FPCSRC%\COMPILER
  87. rem Option to skip the default configuration file
  88. set SKIPCFG=-n
  89. rem Common options for OS/2 target
  90. set OS2OPT1=-TOS2
  91. set OS2OPT2=-dGDB
  92. set OS2OPT3=-dI386
  93. set OS2OPT4=-Sg
  94. rem "Release" options (optimizations, strip debug symbols)
  95. set RELEASEOPT1=-Og2p1
  96. set RELEASEOPT2=-Xs
  97. rem "Debug" options (add debug symbols, do all code generation checks)
  98. set DEBUGOPT1=-g
  99. set DEBUGOPT2=-Crtoi
  100. rem "Verbose" options
  101. if .%VERBOSEOPT% == . set VERBOSEOPT=-va
  102. set DOVERBOSE=
  103. rem Place for debug or release options, empty by default
  104. set CURRENTOPT1=
  105. set CURRENTOPT2=
  106. rem Stack size for the compiler
  107. set STACKOPT=-Cs64500
  108. rem Path to object files
  109. set OS2OBJP=-Fo%OS2RTL%
  110. rem Path to units
  111. set OS2UNITP=-Fu%OS2RTL%
  112. rem Path to compiler units
  113. set COMPUNITP=-Fu%COMPSPATH%
  114. rem Path to compiler include files
  115. set COMPINCP=-Fi%COMPSPATH%
  116. rem Path to compiler object files
  117. set COMPOBJP=-Fo%COMPSPATH%
  118. rem Target path for units
  119. set OS2UNITT=-FU%OS2RTL%
  120. rem Target path for executables
  121. set OS2EXET=-FE%COMPSPATH%
  122. rem Path to include files
  123. set OS2INCP=-Fi%OS2RTL%;%OS2RTLC%;%OS2RTLO%;%OS2RTLP%
  124. rem Default compiler for the first compilation
  125. set CYCLE=0
  126. if not .%CYCLE% == .0 goto EnvErr
  127. set COMPILER=%FPCCOMPILER%
  128. if not .%COMPILER% == .%FPCCOMPILER% goto EnvErr
  129. if .%FPCCOMPILER% == . goto SetCompiler
  130. goto PrgFound
  131. :SetCompiler
  132. set COMPILER=PPC386.EXE
  133. if not .%COMPILER% == .PPC386.EXE goto EnvErr
  134. :PrgFound
  135. echo *Searching for tools ... >> %FPCERRLOG%
  136. set REALTOOLS=%FPCTOOLS%
  137. if %FPCTOOLS%. == . goto SetupTools
  138. goto ToolsOK
  139. :SetupTools
  140. if exist %FPCDIR%\BIN\OS2\%COMPILER% goto Tools1
  141. if exist %FPCDIR%\BIN\OS2\%COMPILER%.EXE goto Tools1
  142. goto NoTools1
  143. :Tools1
  144. if exist %FPCDIR%\BIN\OS2\AS.EXE goto Tools1OK
  145. echo *Warning: %COMPILER% found, but AS.EXE isn't in the same directory! >> %FPCERRLOG%
  146. goto NoTools1
  147. :Tools1OK
  148. set REALTOOLS=%FPCDIR%\BIN\OS2\
  149. goto ToolsOK
  150. :NoTools1
  151. if exist %FPCDIR%\BIN\%COMPILER% goto Tools2
  152. if exist %FPCDIR%\BIN\%COMPILER%.EXE goto Tools2
  153. goto NoTools2
  154. :Tools2
  155. if exist %FPCDIR%\BIN\AS.EXE goto Tools2OK
  156. echo *Warning: %COMPILER% found, but AS.EXE isn't in the same directory! >> %FPCERRLOG%
  157. goto NoTools2
  158. :Tools2OK
  159. set REALTOOLS=%FPCDIR%\BIN\
  160. goto ToolsOK
  161. :NoTools2
  162. echo *Warning: Cannot locate your %COMPILER% and AS.EXE, make sure they're on PATH! >> %FPCERRLOG%
  163. :ToolsOK
  164. echo *Checking parameters >> %FPCERRLOG%
  165. set PARAMS=%1
  166. if .%PARAMS% == . set PARAMS=snapshot
  167. :ParLoop
  168. shift
  169. if %1. == . goto NoPars
  170. if %@EVAL[0] == 0 goto Shl1
  171. if %1 == debug set CURRENTOPT1=%DEBUGOPT1%
  172. if %1 == debug set CURRENTOPT2=%DEBUGOPT2%
  173. if %1 == release set CURRENTOPT1=%RELEASEOPT1%
  174. if %1 == release set CURRENTOPT2=%RELEASEOPT2%
  175. if %1 == verbose set DOVERBOSE=1
  176. goto ParLoop
  177. :Shl1
  178. set PARAMS=%@LOWER[%PARAMS%]
  179. if %@LOWER[%1] == debug set CURRENTOPT1=%DEBUGOPT1%
  180. if %@LOWER[%1] == debug set CURRENTOPT2=%DEBUGOPT2%
  181. if %@LOWER[%1] == release set CURRENTOPT1=%RELEASEOPT1%
  182. if %@LOWER[%1] == release set CURRENTOPT2=%RELEASEOPT2%
  183. if %@LOWER[%1] == verbose set DOVERBOSE=1
  184. goto ParLoop
  185. :NoPars
  186. if %PARAMS% == clean goto CleanRTL
  187. if %PARAMS% == both goto CleanRTL
  188. if %PARAMS% == snapshot goto CleanRTL
  189. if %PARAMS% == rtl goto CleanRTL
  190. if %PARAMS% == cycle goto CleanRTL
  191. if %PARAMS% == compiler goto CleanCompiler
  192. echo *Error: Unknown parameter - %PARAMS% >> %FPCERRLOG%
  193. goto End
  194. :CleanRTL
  195. if %@eval[0] == 0 goto JPCleanRTL
  196. echo *Cleaning up the RTL (error messages are OK here) ... >> %FPCERRLOG%
  197. del %OS2OPTF% >> %FPCERRLOG%
  198. del %OS2RTL%\*.ppo >> %FPCERRLOG%
  199. del %OS2RTL%\*.oo2 >> %FPCERRLOG%
  200. del %OS2RTL%\ppas.bat >> %FPCERRLOG%
  201. del %OS2RTL%\ppas.cmd >> %FPCERRLOG%
  202. del %OS2RTL%\link.res >> %FPCERRLOG%
  203. goto ContCleanRTL
  204. :JPCleanRTL
  205. echo *Cleaning up the RTL ... >> %FPCERRLOG%
  206. del %OS2OPTF% >& nul >> %FPCERRLOG%
  207. del %OS2RTL%\*.ppo >& nul >> %FPCERRLOG%
  208. del %OS2RTL%\*.oo2 >& nul >> %FPCERRLOG%
  209. del %OS2RTL%\ppas.bat >& nul >> %FPCERRLOG%
  210. del %OS2RTL%\ppas.cmd >& nul >> %FPCERRLOG%
  211. del %OS2RTL%\link.res >& nul >> %FPCERRLOG%
  212. :ContCleanRTL
  213. if %PARAMS% == rtl goto Branches
  214. :CleanCompiler
  215. if %@eval[0] == 0 goto JPCleanComp
  216. echo *Cleaning up the compiler (error messages are OK here) ... >> %FPCERRLOG%
  217. del %OS2OPTF% >> %FPCERRLOG%
  218. del %COMPSPATH%\*.ppo >> %FPCERRLOG%
  219. del %COMPSPATH%\*.oo2 >> %FPCERRLOG%
  220. del %COMPSPATH%\pp >> %FPCERRLOG%
  221. del %COMPSPATH%\pp.exe >> %FPCERRLOG%
  222. del %COMPSPATH%\ppos2.exe >> %FPCERRLOG%
  223. del %COMPSPATH%\ppas.bat >> %FPCERRLOG%
  224. del %COMPSPATH%\ppas.cmd >> %FPCERRLOG%
  225. del %COMPSPATH%\link.res >> %FPCERRLOG%
  226. goto ContCleanComp
  227. :JPCleanComp
  228. echo *Cleaning up the compiler ... >> %FPCERRLOG%
  229. del %OS2OPTF% >& nul >> %FPCERRLOG%
  230. del %COMPSPATH%\*.ppo >& nul >> %FPCERRLOG%
  231. del %COMPSPATH%\*.oo2 >& nul >> %FPCERRLOG%
  232. del %COMPSPATH%\pp >& nul >> %FPCERRLOG%
  233. del %COMPSPATH%\pp.exe >& nul >> %FPCERRLOG%
  234. del %COMPSPATH%\ppos2.exe >& nul >> %FPCERRLOG%
  235. del %COMPSPATH%\ppas.bat >& nul >> %FPCERRLOG%
  236. del %COMPSPATH%\ppas.cmd >& nul >> %FPCERRLOG%
  237. del %COMPSPATH%\link.res >& nul >> %FPCERRLOG%
  238. :ContCleanComp
  239. if %PARAMS% == compiler goto Branches
  240. if %PARAMS% == both goto Branches
  241. :CleanSnapshot
  242. if %@eval[0] == 0 goto JPCleanSnap
  243. echo *Deleting the old snapshot (error messages are OK here) ... >> %FPCERRLOG%
  244. del %FPCSRC%\snap-os2.zip >> %FPCERRLOG%
  245. goto ContCleanSnap
  246. :JPCleanSnap
  247. echo *Deleting the old snapshot ... >> %FPCERRLOG%
  248. del %FPCSRC%\snap-os2.zip >& nul >> %FPCERRLOG%
  249. :ContCleanSnap
  250. if %PARAMS% == clean goto End
  251. :Branches
  252. if %PARAMS% == both goto RTL1
  253. if %PARAMS% == snapshot goto RTL1
  254. if %PARAMS% == compiler goto Compiler
  255. if %PARAMS% == rtl goto RTL1
  256. if %PARAMS% == cycle goto RTL1
  257. echo *Error: Unknown parameter - %PARAMS% >> %FPCERRLOG%
  258. goto End
  259. :RTL1
  260. echo *Creating file with all the needed options and paths for RTL ... >> %FPCERRLOG%
  261. echo %SKIPCFG% > %OS2OPTF%
  262. echo %OS2OPT1% >> %OS2OPTF%
  263. echo %OS2OPT2% >> %OS2OPTF%
  264. echo %OS2OPT3% >> %OS2OPTF%
  265. echo %OS2OPT4% >> %OS2OPTF%
  266. echo %OS2OBJP% >> %OS2OPTF%
  267. echo %OS2UNITP% >> %OS2OPTF%
  268. echo %OS2INCP% >> %OS2OPTF%
  269. echo %OS2UNITT% >> %OS2OPTF%
  270. echo -FD%REALTOOLS% >> %OS2OPTF%
  271. if not .%CURRENTOPT1% == . echo %CURRENTOPT1% >> %OS2OPTF%
  272. if not .%CURRENTOPT2% == . echo %CURRENTOPT2% >> %OS2OPTF%
  273. if not .%FPCERRLOG% == . echo -Fe%FPCERRLOG% >> %OS2OPTF%
  274. if .%DOVERBOSE% == .1 echo %VERBOSEOPT% >> %OS2OPTF%
  275. if not .%DOVERBOSE% == .1 goto CompStart1
  276. echo *Start of options used for compilation >> %FPCERRLOG%
  277. type %OS2OPTF% >> %FPCERRLOG%
  278. echo *End of options used for compilation >> %FPCERRLOG%
  279. :CompStart1
  280. echo *Assembling the helpers ... >> %FPCERRLOG%
  281. %REALTOOLS%\as -o %OS2RTL%\prt0.oo2 %OS2RTL%\prt0.as
  282. %REALTOOLS%\as -o %OS2RTL%\prt1.oo2 %OS2RTL%\prt1.as
  283. %REALTOOLS%\as -o %OS2RTL%\code2.oo2 %OS2RTL%\code2.as
  284. %REALTOOLS%\as -o %OS2RTL%\code3.oo2 %OS2RTL%\code3.as
  285. echo *Compiling the system unit ... >> %FPCERRLOG%
  286. %REALTOOLS%%COMPILER% @%OS2OPTF% -Us %OTHEROPTS% %OS2RTL%\SYSOS2.PAS
  287. echo *Compiling unit Objects ... >> %FPCERRLOG%
  288. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\OBJECTS.PP
  289. echo *Compiling unit Strings ... >> %FPCERRLOG%
  290. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\STRINGS.PP
  291. echo *Compiling unit HeapTrace ... >> %FPCERRLOG%
  292. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\HEAPTRC.PP
  293. echo *Compiling unit CPU ... >> %FPCERRLOG%
  294. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\CPU.PP
  295. echo *Compiling unit MMX ... >> %FPCERRLOG%
  296. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\MMX.PP
  297. echo *Compiling unit TypInfo ... >> %FPCERRLOG%
  298. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\TYPINFO.PP
  299. echo *Compiling unit DosCalls ... >> %FPCERRLOG%
  300. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOSCALLS.PAS
  301. echo *Compiling unit DOS ... >> %FPCERRLOG%
  302. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOS.PAS
  303. echo *Compiling unit CRT ... >> %FPCERRLOG%
  304. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\CRT.PAS
  305. echo *Compiling unit Printer ... >> %FPCERRLOG%
  306. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PRINTER.PAS
  307. echo *Compiling unit SysUtils ... >> %FPCERRLOG%
  308. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\SYSUTILS.PP
  309. echo *Compiling unit Math ... >> %FPCERRLOG%
  310. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\MATH.PP
  311. echo *Compiling unit UComplex ... >> %FPCERRLOG%
  312. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\UCOMPLEX.PP
  313. echo *Compiling unit GetOpts ... >> %FPCERRLOG%
  314. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\GETOPTS.PP
  315. echo *Compiling unit KbdCalls ... >> %FPCERRLOG%
  316. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\KBDCALLS.PAS
  317. echo *Compiling unit MouCalls ... >> %FPCERRLOG%
  318. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MOUCALLS.PAS
  319. echo *Compiling unit VioCalls ... >> %FPCERRLOG%
  320. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\VIOCALLS.PAS
  321. echo *Compiling unit MonCalls ... >> %FPCERRLOG%
  322. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MONCALLS.PAS
  323. echo *Compiling unit Ports ... >> %FPCERRLOG%
  324. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PORTS.PAS
  325. echo *Compiling PM units ... >> %FPCERRLOG%
  326. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMWIN.PAS
  327. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMBITMAP.PAS
  328. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMGPI.PAS
  329. echo *Compiling MMOS2 units ... >> %FPCERRLOG%
  330. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DIVE.PAS
  331. if %PARAMS% == rtl goto End
  332. :Compiler
  333. echo *Creating file with all the needed options and paths for the compiler ... >> %FPCERRLOG%
  334. echo %SKIPCFG% > %OS2OPTF%
  335. echo %OS2OPT1% >> %OS2OPTF%
  336. echo %OS2OPT2% >> %OS2OPTF%
  337. echo %OS2OPT3% >> %OS2OPTF%
  338. echo %OS2OPT4% >> %OS2OPTF%
  339. echo %OS2OBJP% >> %OS2OPTF%
  340. echo %OS2UNITP% >> %OS2OPTF%
  341. echo -FD%REALTOOLS% >> %OS2OPTF%
  342. echo %COMPUNITP% >> %OS2OPTF%
  343. echo %COMPINCP% >> %OS2OPTF%
  344. echo %COMPOBJP% >> %OS2OPTF%
  345. echo %STACKOPT% >> %OS2OPTF%
  346. echo %OS2EXET% >> %OS2OPTF%
  347. if not .%CURRENTOPT1% == . echo %CURRENTOPT1% >> %OS2OPTF%
  348. if not .%CURRENTOPT2% == . echo %CURRENTOPT2% >> %OS2OPTF%
  349. if not .%FPCERRLOG% == . echo -Fe%FPCERRLOG% >> %OS2OPTF%
  350. if .%DOVERBOSE% == .1 echo %VERBOSEOPT% >> %OS2OPTF%
  351. if not .%DOVERBOSE% == .1 goto CompStart2
  352. echo *Start of options used for compilation >> %FPCERRLOG%
  353. type %OS2OPTF% >> %FPCERRLOG%
  354. echo *End of options used for compilation >> %FPCERRLOG%
  355. :CompStart2
  356. echo *Compiling the compiler ... >> %FPCERRLOG%
  357. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %COMPSPATH%\PP.PAS
  358. :Comp2
  359. ren %COMPSPATH%\pp.exe ppos2.exe >> %FPCERRLOG%
  360. if exist %COMPSPATH%\ppos2.exe goto OKCompiler
  361. if not exist %COMPSPATH%\pp goto C2Cont
  362. if exist %COMPSPATH%\ppas.bat goto PPasBat
  363. if exist %COMPSPATH%\ppas.cmd goto PPasCmd
  364. :C2Cont
  365. echo *Error: The compiler wasn't compiled!! >> %FPCERRLOG%
  366. goto End
  367. :PPasCmd
  368. ren %COMPSPATH%\ppas.cmd ppas.bat >> %FPCERRLOG%
  369. :PPasBat
  370. echo *Automatic binding failed, trying again ... >> %FPCERRLOG%
  371. call %COMPSPATH%\ppas.bat
  372. del %COMPSPATH%\ppas.bat >> %FPCERRLOG%
  373. goto Comp2
  374. :OKCompiler
  375. if %PARAMS% == compiler goto End
  376. if %PARAMS% == both goto End
  377. if %PARAMS% == cycle goto Cycle
  378. goto CheckEnv
  379. :Cycle
  380. rem Another loop?
  381. if %CYCLE% == 2 goto CheckEnv
  382. echo *Backing up previous compiler version ... >> %FPCERRLOG%
  383. copy %REALTOOLS%ppos2.exe %REALTOOLS%ppos2.%CYCLE% >> %FPCERRLOG%
  384. echo *Copying the newly created compiler to %REALTOOLS% ... >> %FPCERRLOG%
  385. copy %COMPSPATH%\ppos2.exe %REALTOOLS%. >> %FPCERRLOG%
  386. if %CYCLE% == 1 goto Cycle2
  387. set COMPILER=PPOS2.EXE
  388. set CYCLE=1
  389. goto NoPars
  390. :Cycle2
  391. set CYCLE=2
  392. goto NoPars
  393. :CheckEnv
  394. if %@EVAL[0] == 0 goto Pack
  395. echo *Warning: Packing in this environment might fail. >> %FPCERRLOG%
  396. echo *You should press Ctrl-Break now if the current drive is different from that >> %FPCERRLOG%
  397. echo *of %FPCDIR%; otherwise press any key to continue. >> %FPCERRLOG%
  398. if not %FPCERRLOG% == CON echo *Warning: Packing in this environment might fail.
  399. if not %FPCERRLOG% == CON echo *You should press Ctrl-Break now if the current drive is different from that
  400. if not %FPCERRLOG% == CON echo *of %FPCDIR%; otherwise press any key to continue.
  401. pause>nul
  402. cd %FPCSRC%
  403. :Pack
  404. echo *Packing the snapshot ... >> %FPCERRLOG%
  405. if %@EVAL[0] == 0 goto SHL2
  406. goto Cmd2
  407. :Shl2
  408. pushd
  409. cdd %FPCSRC%
  410. :Cmd2
  411. rem ZIP.EXE must be on the PATH
  412. zip -9 -r snap-os2.zip compiler\ppos2.exe rtl\os2\*.ppo rtl\os2\*.oo2 rtl\os2\*.ao2 >> %FPCERRLOG%
  413. if exist snap-os2.zip goto ZipOK
  414. echo *Error: The ZIP file hasn't been created!! >> %FPCERRLOG%
  415. :ZipOK
  416. if %@EVAL[0] == 0 popd
  417. echo *Done. >> %FPCERRLOG%
  418. goto End
  419. :ErrorDir
  420. echo *Error: Environment variable FPCDIR must point to your base FPC directory!!! >> %FPCERRLOG%
  421. goto End
  422. :EnvErr
  423. echo *Error: Not enough environment space!!! >> %FPCERRLOG%
  424. goto End
  425. $Log$
  426. Revision 1.8 2000-01-29 16:24:01 hajny
  427. * logging enhanced, verbose support, error for non-4dos fixed
  428. Revision 1.7 2000/01/26 22:34:36 hajny
  429. * support for error logging added
  430. Revision 1.6 2000/01/16 18:44:21 hajny
  431. * got rid of PPC386.CFG dependency
  432. Revision 1.3 1999/10/01 09:00:21 hajny
  433. + PMGPI and DIVE added
  434. Revision 1.2 1999/09/15 07:31:47 hajny
  435. + some units added, OTHEROPTS variable support
  436. :End