os2snap.bat 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  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 one is used if both are present).
  22. rem *** Parameter "ppas" forces only PPAS script to be created
  23. rem *** by the compiler and called manually afterwards. This might help
  24. rem *** to resolve LD crashes due to low stack (e.g. under WinXX).
  25. rem *** Parameters _must_ be in lowercase to be recognized correctly,
  26. rem *** unless running under 4dos or compatible (e.g. NDOS).
  27. rem *** Meaning of parameters:
  28. rem *** rtl .......... RTL only, _no_ snapshot created
  29. rem *** compiler ..... compiler only, _no_ snapshot created
  30. rem *** both ......... both RTL and compiler, _no_ snapshot created
  31. rem *** snapshot ..... both RTL and compiler, snapshot _is_ created
  32. rem *** cycle ........ RTL and compiler compiled, the resulting compiler
  33. rem *** is then copied to %FPCTOOLS% (BIN\OS2 by default)
  34. rem *** backing up possible previous version to ppos2.x),
  35. rem *** the whole procedure is started again (RTL is compiled
  36. rem *** with the new compiler version this time) and after
  37. rem *** another cycle (to make sure the new compiler works
  38. rem *** correctly) the snapshot is finally created
  39. rem *** PPC386.EXE is used for the compilation (for the first one only with
  40. rem *** "cycle" option), unless a different compiler name (e.g. PPOS2.EXE)
  41. rem *** is specified in FPCCOMPILER variable. In any case, the compiler should
  42. rem *** reside in the same directory as the other required tools (AS.EXE,
  43. rem *** LD.EXE, etc.).
  44. rem *** Environment variable OTHEROPTS may be used to specify additional
  45. rem *** switches (e.g. setting level of verbosity, etc.).
  46. rem *** Environment variable FPCLOG can specify a file for error logging
  47. rem *** (full path needed). Please, note, that the previous contents of
  48. rem *** file will be overwritten each time the batch file is run.
  49. rem *** Environment variable VERBOSEOPT may be used to specify level of
  50. rem *** verbosity used with "verbose" parameter (-va by default, i.e. show
  51. rem *** everything). Another way would be specifying this in OTHEROPTS
  52. rem *** variable (see above) and not using "verbose" at all.
  53. rem *** Environment variable FPCSNAPPATH may be used to specify path, where
  54. rem *** the compiled files should be placed and possibly the ZIP file
  55. rem *** created.
  56. set FPCERRLOG=%FPCLOG%
  57. if .%FPCERRLOG% == . set FPCERRLOG=CON
  58. if .%FPCERRLOG% == . echo Error: Not enough environment space!!!
  59. if .%FPCERRLOG% == . exit
  60. echo *"Makefile" for OS/2: > %FPCERRLOG%
  61. echo *Setting up environment ... >> %FPCERRLOG%
  62. rem Check whether FPCDIR exists
  63. if .%FPCDIR% == . goto ErrorDir
  64. if exist %FPCDIR% goto DirOK
  65. if exist %FPCDIR%\. goto DirOK
  66. if exist %FPCDIR%\makefile goto DirOK
  67. if exist %FPCDIR%\COMPILER\pp.pas goto DirOK
  68. if exist %FPCDIR%\SOURCE\makefile goto DirOK
  69. if exist %FPCDIR%\SOURCE\COMPILER\pp.pas goto DirOK
  70. goto ErrorDir
  71. :DirOK
  72. rem Set path to the source files
  73. if exist %FPCDIR%\SOURCE goto SrcExists
  74. if exist %FPCDIR%\SOURCE\. goto SrcExists
  75. if exist %FPCDIR%\SOURCE\makefile goto SrcExists
  76. if exist %FPCDIR%\SOURCE\COMPILER\pp.pas goto SrcExists
  77. set FPCSRC=%FPCDIR%
  78. goto SnapDir
  79. :SrcExists
  80. set FPCSRC=%FPCDIR%\SOURCE
  81. :SnapDir
  82. set FPCSNAP=%FPCSNAPPATH%
  83. if .%FPCSNAP% == . set FPCSNAP=%FPCSRC%\SNAPSHOT
  84. if exist %FPCSNAP% goto SnapExists
  85. echo *Creating directories for the snapshot ... >> %FPCERRLOG%
  86. mkdir %FPCSNAP% >> %FPCERRLOG%
  87. if exist %FPCSNAP% goto SnapExists
  88. echo *Error: Cannot create the directory %FPCSNAP%!!
  89. goto End
  90. :SnapExists
  91. if exist %FPCSNAP%\BIN goto BinExists
  92. echo *Creating directories for the snapshot (binaries) ... >> %FPCERRLOG%
  93. mkdir %FPCSNAP%\BIN >> %FPCERRLOG%
  94. if exist %FPCSNAP%\BIN goto BinExists
  95. echo *Error: Cannot create the directory %FPCSNAP%\BIN!!
  96. goto End
  97. :BinExists
  98. set FPCSNAPBIN=%FPCSNAP%\BIN\OS2
  99. if exist %FPCSNAPBIN% goto BinOS2Exists
  100. echo *Creating directories for the snapshot (binaries for OS/2) ... >> %FPCERRLOG%
  101. mkdir %FPCSNAPBIN% >> %FPCERRLOG%
  102. if exist %FPCSNAPBIN% goto BinOS2Exists
  103. echo *Error: Cannot create the directory %FPCSNAPBIN%!!
  104. goto End
  105. :BinOS2Exists
  106. set FPCSNAPMSG=%FPCSNAP%\MSG
  107. if exist %FPCSNAPMSG% goto MsgExists
  108. echo *Creating directories for the snapshot (messages) ... >> %FPCERRLOG%
  109. mkdir %FPCSNAPMSG% >> %FPCERRLOG%
  110. if exist %FPCSNAPMSG% goto MsgExists
  111. echo *Error: Cannot create the directory %FPCSNAPMSG%!!
  112. goto End
  113. :MsgExists
  114. if exist %FPCSNAP%\UNITS goto UnitsExists
  115. echo *Creating directories for the snapshot (units) ... >> %FPCERRLOG%
  116. mkdir %FPCSNAP%\UNITS >> %FPCERRLOG%
  117. if exist %FPCSNAP%\UNITS goto UnitsExists
  118. echo *Error: Cannot create the directory %FPCSNAP%\UNITS!!
  119. goto End
  120. :UnitsExists
  121. if exist %FPCSNAP%\UNITS\OS2 goto UnitsOS2Exists
  122. echo *Creating directories for the snapshot (units for OS/2) ... >> %FPCERRLOG%
  123. mkdir %FPCSNAP%\UNITS\OS2 >> %FPCERRLOG%
  124. if exist %FPCSNAP%\UNITS\OS2 goto UnitsOS2Exists
  125. echo *Error: Cannot create the directory %FPCSNAP%\UNITS\OS2!!
  126. goto End
  127. :UnitsOS2Exists
  128. set FPCSNAPRTL=%FPCSNAP%\UNITS\OS2\RTL
  129. if exist %FPCSNAPRTL% goto OS2RTLExists
  130. echo *Creating directories for the snapshot (units for OS/2 RTL) ... >> %FPCERRLOG%
  131. mkdir %FPCSNAPRTL% >> %FPCERRLOG%
  132. if exist %FPCSNAPRTL% goto OS2RTLExists
  133. echo *Error: Cannot create the directory %FPCSNAPRTL%!!
  134. goto End
  135. :OS2RTLExists
  136. set FPCSNAPDOC=%FPCSNAP%\DOC
  137. if exist %FPCSNAPDOC% goto SetOpts
  138. echo *Creating directories for the snapshot (documentation) ... >> %FPCERRLOG%
  139. mkdir %FPCSNAPDOC% >> %FPCERRLOG%
  140. if exist %FPCSNAPDOC% goto SetOpts
  141. echo *Error: Cannot create the directory %FPCSNAPDOC%!!
  142. goto End
  143. :SetOpts
  144. rem Path to file with options
  145. set OS2OPTF=%FPCSRC%\OS2SNAP.OPT
  146. rem Path for the OS/2 RTL
  147. set OS2RTL=%FPCSRC%\RTL\OS2
  148. rem Path for OS/2 RTL parts compiled from common sources
  149. set OS2RTLC=%FPCSRC%\RTL\INC
  150. rem Path for OS/2 RTL parts compiled from processor dependent sources
  151. set OS2RTLP=%FPCSRC%\RTL\I386
  152. rem Path for OS/2 RTL parts for Object Pascal extensions
  153. set OS2RTLO=%FPCSRC%\RTL\OBJPAS
  154. rem Path to the compiler source
  155. set COMPSPATH=%FPCSRC%\COMPILER
  156. rem Option to skip the default configuration file
  157. set SKIPCFG=-n
  158. rem Common options for OS/2 target
  159. set OS2OPT1=-TOS2
  160. set OS2OPT2=-dGDB
  161. set OS2OPT3=-dI386
  162. set OS2OPT4=-Sg
  163. rem "Release" options (optimizations, strip debug symbols)
  164. set RELEASEOPT1=-Og2p1
  165. set RELEASEOPT2=-Xs
  166. rem "Debug" options (add debug symbols, do all code generation checks)
  167. set DEBUGOPT1=-g
  168. set DEBUGOPT2=-Crtoi
  169. rem "Verbose" options
  170. if .%VERBOSEOPT% == . set VERBOSEOPT=-va
  171. set DOVERBOSE=
  172. rem Place for debug or release options, empty by default
  173. set CURRENTOPT1=
  174. set CURRENTOPT2=
  175. rem Stack size for the compiler
  176. rem set STACKOPT=-Cs64500
  177. set STACKOPT=-Cs256000
  178. rem Path to object files
  179. set OS2OBJP=-Fo%OS2RTL%
  180. rem Path to units
  181. rem set OS2UNITP=-Fu%FPCSNAPRTL%;%OS2RTL%
  182. set OS2UNITP=-Fu%FPCSNAPRTL%
  183. rem Path to compiler units
  184. set COMPUNITP=-Fu%COMPSPATH%
  185. rem Path to compiler include files
  186. set COMPINCP=-Fi%COMPSPATH%
  187. rem Path to compiler object files
  188. set COMPOBJP=-Fo%COMPSPATH%
  189. rem Target path for RTL units
  190. set OS2UNITT=-FU%FPCSNAPRTL%
  191. rem Fake target path for executables for RTL compilation (path for PPAS)
  192. set OS2UNITE=-FE%FPCSNAPRTL%
  193. rem Target path for executables
  194. set OS2EXET=-FE%FPCSNAPBIN%
  195. rem Path to include files
  196. set OS2INCP=-Fi%OS2RTL%;%OS2RTLC%;%OS2RTLO%;%OS2RTLP%
  197. rem PPAS step disabled by default
  198. set FORCEPPAS=
  199. rem Name of the PPAS script
  200. set PPASNAME=PPAS.CMD
  201. rem Default compiler for the first compilation
  202. set CYCLE=0
  203. if not .%CYCLE% == .0 goto EnvErr
  204. set COMPILER=%FPCCOMPILER%
  205. if not .%COMPILER% == .%FPCCOMPILER% goto EnvErr
  206. if .%FPCCOMPILER% == . goto SetCompiler
  207. goto PrgFound
  208. :SetCompiler
  209. set COMPILER=PPC386.EXE
  210. if not .%COMPILER% == .PPC386.EXE goto EnvErr
  211. :PrgFound
  212. echo *Searching for tools ... >> %FPCERRLOG%
  213. set REALTOOLS=%FPCTOOLS%
  214. if %FPCTOOLS%. == . goto SetupTools
  215. goto ToolsOK
  216. :SetupTools
  217. if exist %FPCDIR%\BIN\OS2\%COMPILER% goto Tools1
  218. if exist %FPCDIR%\BIN\OS2\%COMPILER%.EXE goto Tools1
  219. goto NoTools1
  220. :Tools1
  221. if exist %FPCDIR%\BIN\OS2\AS.EXE goto Tools1OK
  222. echo *Warning: %COMPILER% found, but AS.EXE isn't in the same directory! >> %FPCERRLOG%
  223. goto NoTools1
  224. :Tools1OK
  225. set REALTOOLS=%FPCDIR%\BIN\OS2\
  226. goto ToolsOK
  227. :NoTools1
  228. if exist %FPCDIR%\BIN\%COMPILER% goto Tools2
  229. if exist %FPCDIR%\BIN\%COMPILER%.EXE goto Tools2
  230. goto NoTools2
  231. :Tools2
  232. if exist %FPCDIR%\BIN\AS.EXE goto Tools2OK
  233. echo *Warning: %COMPILER% found, but AS.EXE isn't in the same directory! >> %FPCERRLOG%
  234. goto NoTools2
  235. :Tools2OK
  236. set REALTOOLS=%FPCDIR%\BIN\
  237. goto ToolsOK
  238. :NoTools2
  239. echo *Warning: Cannot locate your %COMPILER% and AS.EXE, make sure they're on PATH! >> %FPCERRLOG%
  240. :ToolsOK
  241. echo *Checking parameters >> %FPCERRLOG%
  242. set PARAMS=%1
  243. if .%PARAMS% == . set PARAMS=snapshot
  244. :ParLoop
  245. shift
  246. if %1. == . goto NoPars
  247. if %@EVAL[0] == 0 goto Shl1
  248. if %1 == debug set CURRENTOPT1=%DEBUGOPT1%
  249. if %1 == debug set CURRENTOPT2=%DEBUGOPT2%
  250. if %1 == release set CURRENTOPT1=%RELEASEOPT1%
  251. if %1 == release set CURRENTOPT2=%RELEASEOPT2%
  252. if %1 == verbose set DOVERBOSE=1
  253. if %1 == ppas set FORCEPPAS=1
  254. goto ParLoop
  255. :Shl1
  256. set PARAMS=%@LOWER[%PARAMS%]
  257. if %@LOWER[%1] == debug set CURRENTOPT1=%DEBUGOPT1%
  258. if %@LOWER[%1] == debug set CURRENTOPT2=%DEBUGOPT2%
  259. if %@LOWER[%1] == release set CURRENTOPT1=%RELEASEOPT1%
  260. if %@LOWER[%1] == release set CURRENTOPT2=%RELEASEOPT2%
  261. if %@LOWER[%1] == verbose set DOVERBOSE=1
  262. if %@LOWER[%1] == ppas set FORCEPPAS=1
  263. goto ParLoop
  264. :NoPars
  265. if %PARAMS% == clean goto CleanRTL
  266. if %PARAMS% == both goto CleanRTL
  267. if %PARAMS% == snapshot goto CleanRTL
  268. if %PARAMS% == rtl goto CleanRTL
  269. if %PARAMS% == cycle goto CleanRTL
  270. if %PARAMS% == compiler goto CleanCompiler
  271. echo *Error: Unknown parameter - %PARAMS% >> %FPCERRLOG%
  272. goto End
  273. :CleanRTL
  274. if %@eval[0] == 0 goto JPCleanRTL
  275. echo *Cleaning up the RTL (error messages are OK here) ... >> %FPCERRLOG%
  276. del %OS2OPTF% >> %FPCERRLOG%
  277. del %OS2RTL%\*.ppo >> %FPCERRLOG%
  278. del %OS2RTL%\*.oo2 >> %FPCERRLOG%
  279. del %OS2RTL%\ppas.bat >> %FPCERRLOG%
  280. del %OS2RTL%\ppas.cmd >> %FPCERRLOG%
  281. del %OS2RTL%\link.res >> %FPCERRLOG%
  282. del %FPCSNAPRTL%\*.ppo >> %FPCERRLOG%
  283. del %FPCSNAPRTL%\*.oo2 >> %FPCERRLOG%
  284. del %FPCSNAPRTL%\ppas.bat >> %FPCERRLOG%
  285. del %FPCSNAPRTL%\ppas.cmd >> %FPCERRLOG%
  286. del %FPCSNAPRTL%\link.res >> %FPCERRLOG%
  287. goto ContCleanRTL
  288. :JPCleanRTL
  289. echo *Cleaning up the RTL ... >> %FPCERRLOG%
  290. del %OS2OPTF% >& nul >> %FPCERRLOG%
  291. del %OS2RTL%\*.ppo >& nul >> %FPCERRLOG%
  292. del %OS2RTL%\*.oo2 >& nul >> %FPCERRLOG%
  293. del %OS2RTL%\ppas.bat >& nul >> %FPCERRLOG%
  294. del %OS2RTL%\ppas.cmd >& nul >> %FPCERRLOG%
  295. del %OS2RTL%\link.res >& nul >> %FPCERRLOG%
  296. del %FPCSNAPRTL%\*.ppo >& nul >> %FPCERRLOG%
  297. del %FPCSNAPRTL%\*.oo2 >& nul >> %FPCERRLOG%
  298. del %FPCSNAPRTL%\ppas.bat >& nul >> %FPCERRLOG%
  299. del %FPCSNAPRTL%\ppas.cmd >& nul >> %FPCERRLOG%
  300. del %FPCSNAPRTL%\link.res >& nul >> %FPCERRLOG%
  301. :ContCleanRTL
  302. if %PARAMS% == rtl goto Branches
  303. :CleanCompiler
  304. if %@eval[0] == 0 goto JPCleanComp
  305. echo *Cleaning up the compiler (error messages are OK here) ... >> %FPCERRLOG%
  306. del %OS2OPTF% >> %FPCERRLOG%
  307. del %COMPSPATH%\*.ppo >> %FPCERRLOG%
  308. del %COMPSPATH%\*.oo2 >> %FPCERRLOG%
  309. del %COMPSPATH%\pp >> %FPCERRLOG%
  310. del %COMPSPATH%\pp.exe >> %FPCERRLOG%
  311. del %COMPSPATH%\ppos2.exe >> %FPCERRLOG%
  312. del %COMPSPATH%\ppas.bat >> %FPCERRLOG%
  313. del %COMPSPATH%\ppas.cmd >> %FPCERRLOG%
  314. del %COMPSPATH%\link.res >> %FPCERRLOG%
  315. del %FPCSNAPBIN%\*.ppo >> %FPCERRLOG%
  316. del %FPCSNAPBIN%\*.oo2 >> %FPCERRLOG%
  317. del %FPCSNAPBIN%\pp >> %FPCERRLOG%
  318. del %FPCSNAPBIN%\pp.exe >> %FPCERRLOG%
  319. del %FPCSNAPBIN%\ppos2.exe >> %FPCERRLOG%
  320. del %FPCSNAPBIN%\ppas.bat >> %FPCERRLOG%
  321. del %FPCSNAPBIN%\ppas.cmd >> %FPCERRLOG%
  322. del %FPCSNAPBIN%\link.res >> %FPCERRLOG%
  323. goto ContCleanComp
  324. :JPCleanComp
  325. echo *Cleaning up the compiler ... >> %FPCERRLOG%
  326. del %OS2OPTF% >& nul >> %FPCERRLOG%
  327. del %COMPSPATH%\*.ppo >& nul >> %FPCERRLOG%
  328. del %COMPSPATH%\*.oo2 >& nul >> %FPCERRLOG%
  329. del %COMPSPATH%\pp >& nul >> %FPCERRLOG%
  330. del %COMPSPATH%\pp.exe >& nul >> %FPCERRLOG%
  331. del %COMPSPATH%\ppos2.exe >& nul >> %FPCERRLOG%
  332. del %COMPSPATH%\ppas.bat >& nul >> %FPCERRLOG%
  333. del %COMPSPATH%\ppas.cmd >& nul >> %FPCERRLOG%
  334. del %COMPSPATH%\link.res >& nul >> %FPCERRLOG%
  335. del %FPCSNAPBIN%\*.ppo >& nul >> %FPCERRLOG%
  336. del %FPCSNAPBIN%\*.oo2 >& nul >> %FPCERRLOG%
  337. del %FPCSNAPBIN%\pp >& nul >> %FPCERRLOG%
  338. del %FPCSNAPBIN%\pp.exe >& nul >> %FPCERRLOG%
  339. del %FPCSNAPBIN%\ppos2.exe >& nul >> %FPCERRLOG%
  340. del %FPCSNAPBIN%\ppas.bat >& nul >> %FPCERRLOG%
  341. del %FPCSNAPBIN%\ppas.cmd >& nul >> %FPCERRLOG%
  342. del %FPCSNAPBIN%\link.res >& nul >> %FPCERRLOG%
  343. :ContCleanComp
  344. if %PARAMS% == compiler goto Branches
  345. if %PARAMS% == both goto Branches
  346. :CleanSnapshot
  347. if %@eval[0] == 0 goto JPCleanSnap
  348. echo *Deleting the old snapshot (error messages are OK here) ... >> %FPCERRLOG%
  349. del %FPCSNAPDOC%\*.txt >> %FPCERRLOG%
  350. del %FPCSNAPDOC%\*.htm* >> %FPCERRLOG%
  351. del %FPCSNAPDOC%\copying.* >> %FPCERRLOG%
  352. del %FPCSNAPMSG%\*.msg >> %FPCERRLOG%
  353. del %FPCSNAP%\baseemx.zip >> %FPCERRLOG%
  354. goto ContCleanSnap
  355. :JPCleanSnap
  356. echo *Deleting the old snapshot ... >> %FPCERRLOG%
  357. del %FPCSNAP%\baseemx.zip >& nul >> %FPCERRLOG%
  358. del %FPCSNAPDOC%\*.txt >& nul >> %FPCERRLOG%
  359. del %FPCSNAPDOC%\*.htm* >& nul >> %FPCERRLOG%
  360. del %FPCSNAPDOC%\copying.* >& nul >> %FPCERRLOG%
  361. del %FPCSNAPMSG%\*.msg >& nul >> %FPCERRLOG%
  362. :ContCleanSnap
  363. if %PARAMS% == clean goto End
  364. :Branches
  365. if %PARAMS% == both goto RTL1
  366. if %PARAMS% == snapshot goto RTL1
  367. if %PARAMS% == compiler goto Compiler
  368. if %PARAMS% == rtl goto RTL1
  369. if %PARAMS% == cycle goto RTL1
  370. echo *Error: Unknown parameter - %PARAMS% >> %FPCERRLOG%
  371. goto End
  372. :RTL1
  373. echo *Creating file with all the needed options and paths for RTL ... >> %FPCERRLOG%
  374. echo %SKIPCFG% > %OS2OPTF%
  375. echo %OS2OPT1% >> %OS2OPTF%
  376. echo %OS2OPT2% >> %OS2OPTF%
  377. echo %OS2OPT3% >> %OS2OPTF%
  378. echo %OS2OPT4% >> %OS2OPTF%
  379. echo %OS2OBJP% >> %OS2OPTF%
  380. echo %OS2UNITP% >> %OS2OPTF%
  381. echo %OS2INCP% >> %OS2OPTF%
  382. echo %OS2UNITT% >> %OS2OPTF%
  383. echo %OS2UNITE% >> %OS2OPTF%
  384. echo -FD%REALTOOLS% >> %OS2OPTF%
  385. if not .%CURRENTOPT1% == . echo %CURRENTOPT1% >> %OS2OPTF%
  386. if not .%CURRENTOPT2% == . echo %CURRENTOPT2% >> %OS2OPTF%
  387. if not .%FPCLOG% == . echo -Fe%FPCERRLOG% >> %OS2OPTF%
  388. if not .%FORCEPPAS% == . echo -a >> %OS2OPTF%
  389. if not .%FORCEPPAS% == . echo -s >> %OS2OPTF%
  390. if .%DOVERBOSE% == .1 echo %VERBOSEOPT% >> %OS2OPTF%
  391. if not .%DOVERBOSE% == .1 goto CompStart1
  392. echo *Start of basic options used for compilation >> %FPCERRLOG%
  393. type %OS2OPTF% >> %FPCERRLOG%
  394. echo *End of basic options used for compilation >> %FPCERRLOG%
  395. if not .%OTHEROPTS% == . echo *User specified options: %OTHEROPTS% >> %FPCERRLOG%
  396. :CompStart1
  397. echo *Assembling the helpers ... >> %FPCERRLOG%
  398. %REALTOOLS%\as -o %FPCSNAPRTL%\prt0.oo2 %OS2RTL%\prt0.as >> %FPCERRLOG%
  399. %REALTOOLS%\as -o %FPCSNAPRTL%\prt1.oo2 %OS2RTL%\prt1.as >> %FPCERRLOG%
  400. %REALTOOLS%\as -o %FPCSNAPRTL%\code2.oo2 %OS2RTL%\code2.as >> %FPCERRLOG%
  401. %REALTOOLS%\as -o %FPCSNAPRTL%\code3.oo2 %OS2RTL%\code3.as >> %FPCERRLOG%
  402. echo *Compiling the system unit ... >> %FPCERRLOG%
  403. %REALTOOLS%%COMPILER% @%OS2OPTF% -Us %OTHEROPTS% %OS2RTL%\SYSOS2.PAS
  404. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  405. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  406. echo *Compiling unit Objects ... >> %FPCERRLOG%
  407. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\OBJECTS.PP
  408. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  409. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  410. echo *Compiling unit Strings ... >> %FPCERRLOG%
  411. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\STRINGS.PP
  412. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  413. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  414. echo *Compiling unit HeapTrace ... >> %FPCERRLOG%
  415. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\HEAPTRC.PP
  416. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  417. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  418. echo *Compiling unit CPU ... >> %FPCERRLOG%
  419. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\CPU.PP
  420. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  421. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  422. echo *Compiling unit MMX ... >> %FPCERRLOG%
  423. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\MMX.PP
  424. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  425. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  426. echo *Compiling unit DosCalls ... >> %FPCERRLOG%
  427. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOSCALLS.PAS
  428. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  429. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  430. echo *Compiling unit DOS ... >> %FPCERRLOG%
  431. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOS.PAS
  432. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  433. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  434. echo *Compiling unit SysUtils ... >> %FPCERRLOG%
  435. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\SYSUTILS.PP
  436. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  437. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  438. echo *Compiling unit TypInfo ... >> %FPCERRLOG%
  439. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\TYPINFO.PP
  440. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  441. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  442. echo *Compiling unit CRT ... >> %FPCERRLOG%
  443. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\CRT.PAS
  444. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  445. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  446. echo *Compiling unit Printer ... >> %FPCERRLOG%
  447. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PRINTER.PAS
  448. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  449. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  450. echo *Compiling unit Math ... >> %FPCERRLOG%
  451. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\MATH.PP
  452. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  453. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  454. echo *Compiling unit UComplex ... >> %FPCERRLOG%
  455. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\UCOMPLEX.PP
  456. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  457. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  458. echo *Compiling unit GetOpts ... >> %FPCERRLOG%
  459. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\GETOPTS.PP
  460. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  461. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  462. echo *Compiling unit KbdCalls ... >> %FPCERRLOG%
  463. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\KBDCALLS.PAS
  464. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  465. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  466. echo *Compiling unit MouCalls ... >> %FPCERRLOG%
  467. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MOUCALLS.PAS
  468. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  469. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  470. echo *Compiling unit VioCalls ... >> %FPCERRLOG%
  471. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\VIOCALLS.PAS
  472. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  473. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  474. echo *Compiling unit MonCalls ... >> %FPCERRLOG%
  475. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MONCALLS.PAS
  476. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  477. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  478. echo *Compiling unit Ports ... >> %FPCERRLOG%
  479. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PORTS.PAS
  480. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  481. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  482. echo *Compiling PM units ... >> %FPCERRLOG%
  483. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMWIN.PAS
  484. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  485. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  486. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMBITMAP.PAS
  487. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  488. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  489. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMGPI.PAS
  490. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  491. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  492. echo *Compiling MMOS2 units ... >> %FPCERRLOG%
  493. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DIVE.PAS
  494. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  495. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  496. if .%FORCEPPAS% == .1 echo * Deleting the PPAS script >> %FPCERRLOG%
  497. if .%FORCEPPAS% == .1 del %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  498. if %PARAMS% == rtl goto End
  499. :Compiler
  500. echo *Creating file with all the needed options and paths for the compiler ... >> %FPCERRLOG%
  501. echo %SKIPCFG% > %OS2OPTF%
  502. echo %OS2OPT1% >> %OS2OPTF%
  503. echo %OS2OPT2% >> %OS2OPTF%
  504. echo %OS2OPT3% >> %OS2OPTF%
  505. echo %OS2OPT4% >> %OS2OPTF%
  506. echo %OS2OBJP% >> %OS2OPTF%
  507. echo %OS2UNITP% >> %OS2OPTF%
  508. echo -FD%REALTOOLS% >> %OS2OPTF%
  509. echo %COMPUNITP% >> %OS2OPTF%
  510. echo %COMPINCP% >> %OS2OPTF%
  511. echo %COMPOBJP% >> %OS2OPTF%
  512. echo %STACKOPT% >> %OS2OPTF%
  513. echo %OS2EXET% >> %OS2OPTF%
  514. if not .%CURRENTOPT1% == . echo %CURRENTOPT1% >> %OS2OPTF%
  515. if not .%CURRENTOPT2% == . echo %CURRENTOPT2% >> %OS2OPTF%
  516. if not .%FPCLOG% == . echo -Fe%FPCERRLOG% >> %OS2OPTF%
  517. if not .%FORCEPPAS% == . echo -a >> %OS2OPTF%
  518. if not .%FORCEPPAS% == . echo -s >> %OS2OPTF%
  519. if .%DOVERBOSE% == .1 echo %VERBOSEOPT% >> %OS2OPTF%
  520. if not .%DOVERBOSE% == .1 goto CompStart2
  521. echo *Start of basic options used for compilation >> %FPCERRLOG%
  522. type %OS2OPTF% >> %FPCERRLOG%
  523. echo *End of basic options used for compilation >> %FPCERRLOG%
  524. if not .%OTHEROPTS% == . echo *User specified options: %OTHEROPTS% >> %FPCERRLOG%
  525. :CompStart2
  526. echo *Compiling the compiler ... >> %FPCERRLOG%
  527. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %COMPSPATH%\PP.PAS
  528. if .%FORCEPPAS% == .1 echo * Calling the PPAS script >> %FPCERRLOG%
  529. if .%FORCEPPAS% == .1 call %FPCSNAPBIN%\%PPASNAME% >> %FPCERRLOG%
  530. if .%FORCEPPAS% == .1 echo * Deleting the PPAS script >> %FPCERRLOG%
  531. if .%FORCEPPAS% == .1 del %FPCSNAPBIN%\%PPASNAME% >> %FPCERRLOG%
  532. if .%FORCEPPAS% == .1 del %FPCSNAPBIN%\link.res >> %FPCERRLOG%
  533. :Comp2
  534. ren %FPCSNAPBIN%\pp.exe ppos2.exe >> %FPCERRLOG%
  535. if exist %FPCSNAPBIN%\ppos2.exe goto OKCompiler
  536. if not exist %FPCSNAPBIN%\pp goto C2Cont
  537. if exist %FPCSNAPBIN%\ppas.bat goto PPasBat
  538. if exist %FPCSNAPBIN%\ppas.cmd goto PPasCmd
  539. :C2Cont
  540. echo *Error: The compiler wasn't compiled!! >> %FPCERRLOG%
  541. goto End
  542. :PPasCmd
  543. ren %FPCSNAPBIN%\ppas.cmd ppas.bat >> %FPCERRLOG%
  544. :PPasBat
  545. echo *Automatic binding failed, trying again ... >> %FPCERRLOG%
  546. call %FPCSNAPBIN%\ppas.bat
  547. del %FPCSNAPBIN%\ppas.bat >> %FPCERRLOG%
  548. goto Comp2
  549. :OKCompiler
  550. if %PARAMS% == compiler goto End
  551. if %PARAMS% == both goto End
  552. if %PARAMS% == cycle goto Cycle
  553. goto CopyFiles
  554. :Cycle
  555. rem Another loop?
  556. if %CYCLE% == 2 goto CopyFiles
  557. echo *Backing up previous compiler version to ppos2.%CYCLE% ... >> %FPCERRLOG%
  558. copy %REALTOOLS%ppos2.exe %REALTOOLS%ppos2.%CYCLE% >> %FPCERRLOG%
  559. echo *Copying the newly created compiler to %REALTOOLS% ... >> %FPCERRLOG%
  560. copy %FPCSNAPBIN%\ppos2.exe %REALTOOLS%. >> %FPCERRLOG%
  561. if %CYCLE% == 1 goto Cycle2
  562. set COMPILER=PPOS2.EXE
  563. set CYCLE=1
  564. goto NoPars
  565. :Cycle2
  566. set CYCLE=2
  567. goto NoPars
  568. :CopyFiles
  569. set FPCSNAPTXT=%FPCSNAPDOC%\snapshot.txt
  570. echo *Copying the documentation ... >> %FPCERRLOG%
  571. copy %FPCSRC%\INSTALL\DOC\*.txt %FPCSNAPDOC% >> %FPCERRLOG%
  572. copy %FPCSRC%\INSTALL\DOC\*.htm* %FPCSNAPDOC% >> %FPCERRLOG%
  573. copy %FPCSRC%\INSTALL\DOC\copying.* %FPCSNAPDOC% >> %FPCERRLOG%
  574. echo *Creating the snapshot readme file ... >> %FPCERRLOG%
  575. echo This is a FPC snapshot for OS/2. It contains compilation of the most current >> %FPCSNAPTXT%
  576. echo developers' sources as of time of its creation. It contains the latest fixes >> %FPCSNAPTXT%
  577. echo but might contain some new bugs as well, since it's less tested than regular >> %FPCSNAPTXT%
  578. echo releases. Please, send your error reports to [email protected] >> %FPCSNAPTXT%
  579. echo mailing list (and don't forget to mention the fact you're not subscribed to >> %FPCSNAPTXT%
  580. echo the list in your e-mail, if it's the case). >> %FPCSNAPTXT%
  581. echo The snapshot has the same structure as the release ZIP files, so it may be >> %FPCSNAPTXT%
  582. echo installed using the normal installer (INSTALL.EXE and INSTALL.DAT must be >> %FPCSNAPTXT%
  583. echo in the same directory) or directly unzipped into your FPC tree. >> %FPCSNAPTXT%
  584. echo *Copying the message files ... >> %FPCERRLOG%
  585. copy %COMPSPATH%\*.msg %FPCSNAPMSG% >> %FPCERRLOG%
  586. if %@EVAL[0] == 0 goto Pack
  587. echo *Warning: Packing in this environment might fail. >> %FPCERRLOG%
  588. echo *You should press Ctrl-Break now if the current drive is different from that >> %FPCERRLOG%
  589. echo *of %FPCSNAP%; otherwise press any key to continue. >> %FPCERRLOG%
  590. if not %FPCERRLOG% == CON echo *Warning: Packing in this environment might fail.
  591. if not %FPCERRLOG% == CON echo *You should press Ctrl-Break now if the current drive is different from that
  592. if not %FPCERRLOG% == CON echo *of %FPCDIR%; otherwise press any key to continue.
  593. pause>nul
  594. cd %FPCSNAP%
  595. :Pack
  596. echo *Packing the snapshot ... >> %FPCERRLOG%
  597. if %@EVAL[0] == 0 goto SHL2
  598. goto Cmd2
  599. :Shl2
  600. pushd
  601. cdd %FPCSNAP%
  602. :Cmd2
  603. rem ZIP.EXE must be on the PATH
  604. zip -9 -r baseemx.zip bin\os2\ppos2.exe doc\*.* msg\*.* units\os2\rtl\*.ppo units\os2\rtl\*.oo2 units\os2\rtl\*.ao2 >> %FPCERRLOG%
  605. if exist baseemx.zip goto ZipOK
  606. echo *Error: The ZIP file hasn't been created!! >> %FPCERRLOG%
  607. :ZipOK
  608. if %@EVAL[0] == 0 popd
  609. echo *Done. >> %FPCERRLOG%
  610. goto End
  611. :ErrorDir
  612. echo *Error: Environment variable FPCDIR must point to your base FPC directory!!! >> %FPCERRLOG%
  613. goto End
  614. :EnvErr
  615. echo *Error: Not enough environment space!!! >> %FPCERRLOG%
  616. goto End
  617. $Log$
  618. Revision 1.12 2000-03-12 18:29:40 hajny
  619. * wrong order corrected
  620. Revision 1.11 2000/03/12 13:37:24 hajny
  621. * support for calling PPAS script, compiler stack increased
  622. Revision 1.10 2000/03/06 17:38:39 hajny
  623. * little omission (ZIP parameters)
  624. Revision 1.9 2000/03/05 19:13:25 hajny
  625. * new snapshot structure
  626. Revision 1.8 2000/01/29 16:24:01 hajny
  627. * logging enhanced, verbose support, error for non-4dos fixed
  628. Revision 1.7 2000/01/26 22:34:36 hajny
  629. * support for error logging added
  630. Revision 1.6 2000/01/16 18:44:21 hajny
  631. * got rid of PPC386.CFG dependency
  632. Revision 1.3 1999/10/01 09:00:21 hajny
  633. + PMGPI and DIVE added
  634. Revision 1.2 1999/09/15 07:31:49 hajny
  635. + some units added, OTHEROPTS variable support
  636. :End