Sign in Join
Wiki copytemporary

How to start: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# How to start
22
33## Setting up the development environment
44
551. Install the most recent official FPC release for your operating system, get it [here](http://www.freepascal.org/sdown.html)
662. Get the latest FPC source from the repository, read [here](http://www.freepascal.org/develop.html) how to do so.
773. Test your setup:
88 1. Change to the directory `fpc`
99 2. type `make all` and test see if it works without problems. If you've problems with the build, or for a general background info for the process, be sure to check the [[buildfaq]].
1010 3. If you wish to do so, you can install the newly generated compiler with `make install` (This may need sudo).
1111
1212Now you're ready to modify the compiler.
1313
1414## Directory layout of the compiler
1515
1616The compiler sources are located in fpc/compiler and its subdirectories.
1717
1818- `fpc/` the main directory
1919 - `compiler/` files common for all target processors.
2020 - The processor specific files are in subdirectories `alpha, arm, powerpc, i386` (i386 only), `ia64, m68k, mips, powerpc, powerpc64, sparc, x86` (x86 general) and `x86-64` (x86-64 only).
2121 - `systems/` information files for the supported operating systems.
2222
2323 The `i_*.pas` files contain the information that is necessary for either hosting or building a compiler compiling for this target.
2424
2525 The `t_*.pas` files contain the code which is necessary if a compiler is built for compiling for this particular target.
2626 - `msg/` compiler messages in various languages.
2727 - `utils/` mainly help programs for compiler development. The are usually not important at the beginning.
2828
2929## Building the compiler
3030
3131To build the compiler only, a `make` in fpc/compiler is enough. However, if you want to test the generated compiler and you aren't building a cross compiler, better do a `make cycle`. This tests if the modified compiler can compile itself and the rtl.
3232
3333### Building a cross compiler
3434
3535See [[Cross compiling]].
3636
3737## Testing changes
3838
3939When doing changes, it is always good to test these changes, for example by running the testsuite.
4040
4141### Running the testsuite
4242
4343The readme file in the fpc/tests directory contains more complete test suite instructions.
4444
45-` cd fpc`\
46-` make clean all`\
47-` cd tests`\
48-` make clean all digest`
45+```text
46+ cd fpc
47+ make clean all
48+ cd tests
49+ make clean all digest
50+```
4951
5052You'll get something like this at the end:
5153
52-` ...`\
53-` /FPC/home/fpc/bin/digest output/i386-linux/log`\
54-` Total = 2975 (28:2947)`\
55-` Total number of compilations = 1692 (12:1680)`\
56-` Successfully compiled = 1361`\
57-` Successfully failed = 319`\
58-` Compilation failures = 12`\
59-` Compilation that did not fail while they should = 0`\
60-` Total number of runs = 1283 (16:1267)`\
61-` Successful runs = 1267`\
62-` Failed runs = 16`\
63-` ...`
54+```text
55+ ...
56+ /FPC/home/fpc/bin/digest output/i386-linux/log
57+ Total = 2975 (28:2947)
58+ Total number of compilations = 1692 (12:1680)
59+ Successfully compiled = 1361
60+ Successfully failed = 319
61+ Compilation failures = 12
62+ Compilation that did not fail while they should = 0
63+ Total number of runs = 1283 (16:1267)
64+ Successful runs = 1267
65+ Failed runs = 16
66+ ...
67+```
6468
6569The important line is
6670
67-` Total = 2975 (28:2947)`
71+```text
72+ Total = 2975 (28:2947)
73+```
6874
6975It shows how much tests were run: 2975, how much failed: 28 and now much succeded: 2947. If you want to know what failed, see `fpc/tests/output/<target>/longlog` and `fpc/tests/output/<target>/log`.
7076
7177## Recommended readings
7278
7379Unfortunately, there is no documentation about the internals of the 2.x.x compiler yet. However, there is a documentation of the internals of 1.0.x which should give first clues: <http://www.stack.nl/~marcov/comparch.pdf>
7480
7581Further, some information about the 2.x.x will be collected here: [[FPC internals]]
7682
7783# See also
7884
7985- [[Control Pascal Tutorial]] - a simple way to start with no installation needed
8086- [[Compilers]] - another way to start with an installation
8187
8288---
8389*From the Free Pascal wiki, page "How to start", as it stood on 2022-09-11 after a change by PierceNg, 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).*
8490Category: Control Pascal
8591Category: FPC
8692Category: Tutorials

Back to history