Not thoroughly tested, but seems working fine. The script must be placed in the same place as fpc source folder. e.g. if you put it in ~/Sources/build-fpc-cross-all.sh then there should also be ~/Sources/fpc containing the full fpc source (directories: compiler, rtl, packages, utils, etc.). Feel free to modify the script according to your needs (bash >4.0 skill required). The script also assumes everything from fpc.cfg (e.g. the cross assembler and linker depends on whatever settings set in fpc.cfg).