os2snap.cmd 27 KB

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