Bootstrapping FPC for a new architecture

On the bootstrapping machine

1. Check out FPC from SVN:

   $ svn co http://svn.freepascal.org/svn/fpc/trunk/

2. Install the gcc cross toolchain for the target architecture:

   $ apt install gcc-m68k-linux-gnu g++-m68k-linux-gnu cpp-m68k-linux-gnu

4. Enter FPC source directory and build a cross-compiler:

   $ BINUTILSPREFIX=m68k-linux-gnu- make crossall crossinstall CPU_TARGET=m68k CROSSOPT="-Cp68020 -Cf68881 -CaDEFAULT" OS_TARGET=linux FPC=/usr/lib/fpc/3.0.0/ppcx64 INSTALL_PREFIX=/home/glaubitz/fpc-m68k/

5. Build the native compiler:

   $ BINUTILSPREFIX=m68k-linux-gnu- make compiler CPU_TARGET=m68k OS_TARGET=linux FPC=/root/fpc-m68k/lib/fpc/3.1.1/ppcross68k CROSSOPT="-Cp68020 -Cf68881 -CaDEFAULT -Fu/root/fpc-m68k/lib/fpc/3.1.1/units/*

6. Copy target compiler into directory of cross-compiler:

   $ cp -av compiler/ppc68k /home/glaubitz/fpc-m68k/lib/fpc/3.1.1/

7. Tar the target compiler up to transport it to the target machine:

   $ tar czf fpc-m68k.tgz /home/glaubitz/fpc-m68k

On the target machine

1. Check out FPC from SVN:

   $ svn co http://svn.freepascal.org/svn/fpc/trunk/

2. Untar cross-compiled target compiler:

   $ tar xf fpc-m68k.tgz

3. Build FPC with the bootstrapped FPC:

   $ make FPC=/path/to/ppcbinary OVERRIDEVERSIONCHECK=1