os2snap.cmd 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  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. :ParLoop
  235. shift
  236. if %1. == . goto NoPars
  237. if %@EVAL[0] == 0 goto Shl1
  238. if %1 == debug set CURRENTOPT1=%DEBUGOPT1%
  239. if %1 == debug set CURRENTOPT2=%DEBUGOPT2%
  240. if %1 == release set CURRENTOPT1=%RELEASEOPT1%
  241. if %1 == release set CURRENTOPT2=%RELEASEOPT2%
  242. if %1 == verbose set DOVERBOSE=1
  243. if %1 == ppas set FORCEPPAS=1
  244. goto ParLoop
  245. :Shl1
  246. set PARAMS=%@LOWER[%PARAMS%]
  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 Objects ... >> %FPCERRLOG%
  397. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\OBJECTS.PP
  398. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  399. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  400. echo *Compiling unit Strings ... >> %FPCERRLOG%
  401. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\STRINGS.PP
  402. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  403. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  404. echo *Compiling unit HeapTrace ... >> %FPCERRLOG%
  405. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\HEAPTRC.PP
  406. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  407. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  408. echo *Compiling unit CPU ... >> %FPCERRLOG%
  409. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\CPU.PP
  410. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  411. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  412. echo *Compiling unit MMX ... >> %FPCERRLOG%
  413. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLP%\MMX.PP
  414. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  415. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  416. echo *Compiling unit DosCalls ... >> %FPCERRLOG%
  417. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOSCALLS.PAS
  418. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  419. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  420. echo *Compiling unit DOS ... >> %FPCERRLOG%
  421. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DOS.PAS
  422. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  423. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  424. echo *Compiling unit SysUtils ... >> %FPCERRLOG%
  425. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\SYSUTILS.PP
  426. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  427. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  428. echo *Compiling unit TypInfo ... >> %FPCERRLOG%
  429. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\TYPINFO.PP
  430. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  431. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  432. echo *Compiling unit CRT ... >> %FPCERRLOG%
  433. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\CRT.PAS
  434. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  435. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  436. echo *Compiling unit Printer ... >> %FPCERRLOG%
  437. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PRINTER.PAS
  438. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  439. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  440. echo *Compiling unit Math ... >> %FPCERRLOG%
  441. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLO%\MATH.PP
  442. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  443. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  444. echo *Compiling unit UComplex ... >> %FPCERRLOG%
  445. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\UCOMPLEX.PP
  446. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  447. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  448. echo *Compiling unit GetOpts ... >> %FPCERRLOG%
  449. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTLC%\GETOPTS.PP
  450. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  451. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  452. echo *Compiling unit KbdCalls ... >> %FPCERRLOG%
  453. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\KBDCALLS.PAS
  454. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  455. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  456. echo *Compiling unit MouCalls ... >> %FPCERRLOG%
  457. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MOUCALLS.PAS
  458. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  459. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  460. echo *Compiling unit VioCalls ... >> %FPCERRLOG%
  461. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\VIOCALLS.PAS
  462. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  463. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  464. echo *Compiling unit MonCalls ... >> %FPCERRLOG%
  465. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\MONCALLS.PAS
  466. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  467. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  468. echo *Compiling unit Ports ... >> %FPCERRLOG%
  469. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PORTS.PAS
  470. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  471. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  472. echo *Compiling PM units ... >> %FPCERRLOG%
  473. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMWIN.PAS
  474. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  475. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  476. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMBITMAP.PAS
  477. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  478. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  479. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\PMGPI.PAS
  480. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  481. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  482. echo *Compiling MMOS2 units ... >> %FPCERRLOG%
  483. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %OS2RTL%\DIVE.PAS
  484. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  485. if .%FORCEPPAS% == .1 call %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  486. if .%FORCEPPAS% == .1 echo * Deleting the PPAS script >> %FPCERRLOG%
  487. if .%FORCEPPAS% == .1 del %FPCSNAPRTL%\%PPASNAME% >> %FPCERRLOG%
  488. if %PARAMS% == rtl goto End
  489. :Compiler
  490. echo *Creating file with all the needed options and paths for the compiler ... >> %FPCERRLOG%
  491. echo %SKIPCFG% > %OS2OPTF%
  492. echo %OS2OPT1% >> %OS2OPTF%
  493. echo %OS2OPT2% >> %OS2OPTF%
  494. echo %OS2OPT3% >> %OS2OPTF%
  495. echo %OS2OPT4% >> %OS2OPTF%
  496. echo %OS2OBJP% >> %OS2OPTF%
  497. echo %OS2UNITP% >> %OS2OPTF%
  498. echo -FD%REALTOOLS% >> %OS2OPTF%
  499. echo %COMPUNITP% >> %OS2OPTF%
  500. echo %COMPINCP% >> %OS2OPTF%
  501. echo %COMPOBJP% >> %OS2OPTF%
  502. echo %STACKOPT% >> %OS2OPTF%
  503. echo %OS2EXET% >> %OS2OPTF%
  504. if not .%CURRENTOPT1% == . echo %CURRENTOPT1% >> %OS2OPTF%
  505. if not .%CURRENTOPT2% == . echo %CURRENTOPT2% >> %OS2OPTF%
  506. if not .%FPCLOG% == . echo -Fe%FPCERRLOG% >> %OS2OPTF%
  507. if not .%FORCEPPAS% == . echo -a >> %OS2OPTF%
  508. if not .%FORCEPPAS% == . echo -s >> %OS2OPTF%
  509. if .%DOVERBOSE% == .1 echo %VERBOSEOPT% >> %OS2OPTF%
  510. if not .%DOVERBOSE% == .1 goto CompStart2
  511. echo *Start of basic options used for compilation >> %FPCERRLOG%
  512. type %OS2OPTF% >> %FPCERRLOG%
  513. echo *End of basic options used for compilation >> %FPCERRLOG%
  514. if not .%OTHEROPTS% == . echo *User specified options: %OTHEROPTS% >> %FPCERRLOG%
  515. :CompStart2
  516. echo *Compiling the compiler ... >> %FPCERRLOG%
  517. %REALTOOLS%%COMPILER% @%OS2OPTF% %OTHEROPTS% %COMPSPATH%\PP.PAS
  518. if .%FORCEPPAS% == .1 echo *Calling the PPAS script >> %FPCERRLOG%
  519. if .%FORCEPPAS% == .1 call %FPCSNAPBIN%\%PPASNAME% >> %FPCERRLOG%
  520. if .%FORCEPPAS% == .1 echo * Deleting the PPAS script >> %FPCERRLOG%
  521. if .%FORCEPPAS% == .1 del %FPCSNAPBIN%\%PPASNAME% >> %FPCERRLOG%
  522. if .%FORCEPPAS% == .1 del %FPCSNAPBIN%\link.res >> %FPCERRLOG%
  523. :Comp2
  524. ren %FPCSNAPBIN%\pp.exe ppos2.exe >> %FPCERRLOG%
  525. if exist %FPCSNAPBIN%\ppos2.exe goto OKCompiler
  526. if not exist %FPCSNAPBIN%\pp goto C2Cont
  527. if exist %FPCSNAPBIN%\ppas.bat goto PPasBat
  528. if exist %FPCSNAPBIN%\ppas.cmd goto PPasCmd
  529. :C2Cont
  530. echo *Error: The compiler wasn't compiled!! >> %FPCERRLOG%
  531. goto End
  532. :PPasCmd
  533. echo *Automatic binding failed, trying again ... >> %FPCERRLOG%
  534. call %FPCSNAPBIN%\ppas.cmd
  535. del %FPCSNAPBIN%\ppas.cmd >> %FPCERRLOG%
  536. goto Comp2
  537. :PPasBat
  538. echo *Automatic binding failed, trying again ... >> %FPCERRLOG%
  539. call %FPCSNAPBIN%\ppas.bat
  540. del %FPCSNAPBIN%\ppas.bat >> %FPCERRLOG%
  541. goto Comp2
  542. :OKCompiler
  543. if %PARAMS% == compiler goto End
  544. if %PARAMS% == both goto End
  545. if %PARAMS% == cycle goto Cycle
  546. goto CopyFiles
  547. :Cycle
  548. rem Another loop?
  549. if %CYCLE% == 2 goto CopyFiles
  550. echo *Backing up previous compiler version to ppos2.%CYCLE% ... >> %FPCERRLOG%
  551. copy %REALTOOLS%ppos2.exe %REALTOOLS%ppos2.%CYCLE% >> %FPCERRLOG%
  552. echo *Copying the newly created compiler to %REALTOOLS% ... >> %FPCERRLOG%
  553. copy %FPCSNAPBIN%\ppos2.exe %REALTOOLS%. >> %FPCERRLOG%
  554. if %CYCLE% == 1 goto Cycle2
  555. set COMPILER=PPOS2.EXE
  556. set CYCLE=1
  557. goto NoPars
  558. :Cycle2
  559. set CYCLE=2
  560. goto NoPars
  561. :CopyFiles
  562. set FPCSNAPTXT=%FPCSNAPDOC%\snapshot.txt
  563. echo *Copying the documentation ... >> %FPCERRLOG%
  564. copy %FPCSRC%\INSTALL\DOC\*.txt %FPCSNAPDOC% >> %FPCERRLOG%
  565. copy %FPCSRC%\INSTALL\DOC\*.htm* %FPCSNAPDOC% >> %FPCERRLOG%
  566. copy %FPCSRC%\INSTALL\DOC\copying.* %FPCSNAPDOC% >> %FPCERRLOG%
  567. echo *Creating the snapshot readme file ... >> %FPCERRLOG%
  568. echo This is a FPC snapshot for OS/2. It contains compilation of the most current >> %FPCSNAPTXT%
  569. echo developers' sources as of time of its creation. It contains the latest fixes >> %FPCSNAPTXT%
  570. echo but might contain some new bugs as well, since it's less tested than regular >> %FPCSNAPTXT%
  571. echo releases. Please, send your error reports to [email protected] >> %FPCSNAPTXT%
  572. echo mailing list (and don't forget to mention the fact you're not subscribed to >> %FPCSNAPTXT%
  573. echo the list in your e-mail, if it's the case). >> %FPCSNAPTXT%
  574. echo The snapshot has the same structure as the release ZIP files, so it may be >> %FPCSNAPTXT%
  575. echo installed using the normal installer (INSTALL.EXE and INSTALL.DAT must be >> %FPCSNAPTXT%
  576. echo in the same directory) or directly unzipped into your FPC tree. >> %FPCSNAPTXT%
  577. echo *Copying the message files ... >> %FPCERRLOG%
  578. copy %COMPSPATH%\*.msg %FPCSNAPMSG% >> %FPCERRLOG%
  579. if %@EVAL[0] == 0 goto Pack
  580. echo *Warning: Packing in this environment might fail. >> %FPCERRLOG%
  581. echo *You should press Ctrl-Break now if the current drive is different from that >> %FPCERRLOG%
  582. echo *of %FPCSNAP%; otherwise press any key to continue. >> %FPCERRLOG%
  583. if not %FPCERRLOG% == CON echo *Warning: Packing in this environment might fail.
  584. if not %FPCERRLOG% == CON echo *You should press Ctrl-Break now if the current drive is different from that
  585. if not %FPCERRLOG% == CON echo *of %FPCDIR%; otherwise press any key to continue.
  586. pause>nul
  587. cd %FPCSNAP%
  588. :Pack
  589. echo *Packing the snapshot ... >> %FPCERRLOG%
  590. if %@EVAL[0] == 0 goto SHL2
  591. goto Cmd2
  592. :Shl2
  593. pushd
  594. cdd %FPCSNAP%
  595. :Cmd2
  596. rem ZIP.EXE must be on the PATH
  597. zip -9 -r baseemx.zip bin\os2\ppos2.exe doc\* msg\* units\os2\rtl\*.ppo units\os2\rtl\*.oo2 units\os2\rtl\*.ao2 >> %FPCERRLOG%
  598. if exist baseemx.zip goto ZipOK
  599. echo *Error: The ZIP file hasn't been created!! >> %FPCERRLOG%
  600. :ZipOK
  601. if %@EVAL[0] == 0 popd
  602. echo *Done. >> %FPCERRLOG%
  603. goto End
  604. :ErrorDir
  605. echo *Error: Environment variable FPCDIR must point to your base FPC directory!!! >> %FPCERRLOG%
  606. goto End
  607. $Log$
  608. Revision 1.13 2000-03-16 19:43:36 hajny
  609. * fix for COMMAND.COM, order, etc.
  610. Revision 1.12 2000/03/12 18:29:40 hajny
  611. * wrong order corrected
  612. Revision 1.11 2000/03/12 13:42:00 hajny
  613. * cosmetic change for easier synchronization
  614. Revision 1.10 2000/03/12 13:37:24 hajny
  615. * support for calling PPAS script, compiler stack increased
  616. Revision 1.9 2000/03/05 19:13:25 hajny
  617. * new snapshot structure
  618. Revision 1.8 2000/01/29 16:24:01 hajny
  619. * logging enhanced, verbose support, error for non-4dos fixed
  620. Revision 1.7 2000/01/26 22:34:36 hajny
  621. * support for error logging added
  622. Revision 1.6 2000/01/16 18:44:21 hajny
  623. * got rid of PPC386.CFG dependency
  624. Revision 1.3 1999/10/01 09:00:21 hajny
  625. + PMGPI and DIVE added
  626. Revision 1.2 1999/09/15 07:31:49 hajny
  627. + some units added, OTHEROPTS variable support
  628. :End