FPC recompilation automation: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: FPC recompilation automation
| Old | New | Line | |
|---|---|---|---|
| 1 | + | When you want to change something in FPC, you will have to repeat several commands many times to rebuild FPC and test your changes. Here is a script to automate this process. | |
| 2 | + | ||
| 3 | + | # FPC rebuilding script for Windows | |
| 4 | + | ||
| 5 | + | Save the following script as **rebuild-trunk.bat**. Tested on Windows 10 x64, FPC 3.3.1 with 3.2.2 bootstrap, and 32 bit FPCUPDELUXE 1.8.2u. | |
| 6 | + | ||
| 7 | + | ```dos | |
| 8 | + | @echo off | |
| 9 | + | ||
| 10 | + | echo *************************************************************************** | |
| 11 | + | echo * * | |
| 12 | + | echo * TRUNK REBUILDER 1.0 * | |
| 13 | + | echo * by Zeljko Avramovic (c) 2021 * | |
| 14 | + | echo * * | |
| 15 | + | echo * used for easy FPC RTL changes recompilation automation * | |
| 16 | + | echo * * | |
| 17 | + | echo * 1. Download FPC and LAZ trunks with FPCUPDELUXE * | |
| 18 | + | echo * 2. Set FPCUPDELUXEDIR, BOOTSTRAPDIR and THREADS variables in BAT file * | |
| 19 | + | echo * 3. Change RTL or any other FPC source files * | |
| 20 | + | echo * 4. Run this BAT file to rebuild FPC * | |
| 21 | + | echo * 5. Rebuild Lazarus if needed (only if your changes affect it) * | |
| 22 | + | echo * * | |
| 23 | + | echo *************************************************************************** | |
| 24 | + | ||
| 25 | + | REM adjust these variables according to your system: | |
| 26 | + | set BOOTSTRAPDIR=c:\Prg\Lazarus\fpc.3.2.2\bin\i386-win32 | |
| 27 | + | set FPCUPDELUXEDIR=c:\Prg\Lazarus\TrunkAll | |
| 28 | + | set THREADS=8 | |
| 29 | + | ||
| 30 | + | set FPCDIR=%FPCUPDELUXEDIR%\fpc | |
| 31 | + | set STARTDIR=%cd% | |
| 32 | + | set STARTTIME=%time% | |
| 33 | + | ||
| 34 | + | cd /d %FPCUPDELUXEDIR%\fpcsrc | |
| 35 | + | ||
| 36 | + | echo. | |
| 37 | + | echo ***************** | |
| 38 | + | echo * 1. CLEAN * | |
| 39 | + | echo ***************** | |
| 40 | + | echo. | |
| 41 | + | %BOOTSTRAPDIR%\make.exe distclean -j %THREADS% FPMAKEOPT="-T %THREADS%" | |
| 42 | + | set ERR=1 (CLEAN) | |
| 43 | + | if %ERRORLEVEL% neq 0 goto :error | |
| 44 | + | ||
| 45 | + | echo. | |
| 46 | + | echo ***************** | |
| 47 | + | echo * 2. MAKE * | |
| 48 | + | echo ***************** | |
| 49 | + | echo. | |
| 50 | + | %BOOTSTRAPDIR%\make.exe all -j %THREADS% FPMAKEOPT="-T %THREADS%" | |
| 51 | + | set ERR=2 (MAKE) | |
| 52 | + | if %ERRORLEVEL% neq 0 goto :error | |
| 53 | + | ||
| 54 | + | echo. | |
| 55 | + | echo ***************** | |
| 56 | + | echo * 3. INSTALL * | |
| 57 | + | echo ***************** | |
| 58 | + | echo. | |
| 59 | + | %BOOTSTRAPDIR%\make.exe install INSTALL_PREFIX=%FPCDIR% -j %THREADS% FPMAKEOPT="-T %THREADS%" | |
| 60 | + | set ERR=3 (INSTALL) | |
| 61 | + | if %ERRORLEVEL% neq 0 goto :error | |
| 62 | + | ||
| 63 | + | echo. | |
| 64 | + | echo ***************** | |
| 65 | + | echo * 4. FINISHED * | |
| 66 | + | echo ***************** | |
| 67 | + | echo. | |
| 68 | + | echo %STARTTIME% | |
| 69 | + | echo %TIME% | |
| 70 | + | set ERR=0 (OK) | |
| 71 | + | goto :end | |
| 72 | + | ||
| 73 | + | :error | |
| 74 | + | echo {} | |
| 75 | + | ||
| 76 | + | :end | |
| 77 | + | cd %STARTDIR% | |
| 78 | + | ||
| 79 | + | REM beep | |
| 80 | + | echo � | |
| 81 | + | ``` | |
| 82 | + | ||
| 83 | + | # FPC rebuilding script for Linux | |
| 84 | + | ||
| 85 | + | T.B.D. | |
| 86 | + | ||
| 87 | + | --- | |
| 88 | + | *From the Free Pascal wiki, page "FPC recompilation automation", as it stood on 2022-05-29 after a change by Avra, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
