How to start

From Lazarus wiki
Jump to navigationJump to search

How to start

Setup the developement environment

  1. Install the most recent FPC release for your operanting system, get it here
  2. Get the lastest FPC source via CVS, read here how to do so.
  3. Test your setup:
  • Change to the directory fpc
  • type make all and test see if it works without problems. If you've problems with the build, check the Build FAQ.
  • If you wish to do so, you can install the newly generated compiler with make install.

Now you're ready to modify the compiler.

Directory layout of the compiler

The compiler sources are located in fpc/compiler and it's subdirectories. fpc/compiler contains the files which are common for all targets processors. The processor specific files are in subdirs, e.g. the PowerPC files can be found in fpc/compiler/powerpc. Other important sub directories are:

  • systems/: It contains the information files for the supported operating systems. The i_*.pas files contain the information which is necessary for either hosting or building a compiler compiling for this target. The t_*.pas files contain the code which is necessary if a compiler is built for compiling for this particular target.
  • msg/: It contains the compiler messages in various languages.
  • utils/: it contains mainly help programs for compiler development. The are usually not important in the beginning.

Building the compiler

To 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.

Building a cross compiler

Building a cross compiler for another processor target is simple as well, just do a make CPU_TARGET=<processor target>. Possible processor targets are: arm, ia64, i386, powerpc, sparc and x86_64. Some of them might not work currently.

Recommended readings

Unfortunately, there is no documentation about the internals of the 1.9.x compiler yet. However, there is a documentation of the internal of the 1.0.x which should give first clues: http://www.stack.nl/~marcov/comparch.pdf

Further, some information about the 1.9.x will be collected here: FPC internals