I’d quite like to try cross-compiling to z80 with FPC/Lazarus, so I need to build the cross-compiler. I’ve cloned the source into GitHub Desktop from:
https://gitlab.com/freepascal.org/fpc/source.git…and I have a build script from the
FreePascal Wiki:
#!/bin/sh
set -e
FPC_Z80_DIR= ... /some/new/folder
STARTPP= ... /fpc/bin/aarch64-darwin/fpc
BINUTILSPREFIX=
CROSSOPT=-O-1
export CROSSOPT
OPT="-CX -XXs"
if [ -n "$EXTRAOPT" ]
then
OPT+=" $EXTRAOPT"
fi
export OPT
export CPU_TARGET=z80
export OS_TARGET=zxspectrum
export OS_SOURCE=`$STARTPP -iSO`
export CPU_SOURCE=`$STARTPP -iSP`
cd $FPC_Z80_DIR/fpc
alias nproc="sysctl -n hw.logicalcpu"
make -j `nproc` clean PP=$STARTPP BINUTILSPREFIX=$BINUTILSPREFIX
make -j `nproc` all PP=$STARTPP BINUTILSPREFIX=$BINUTILSPREFIX
make -j `nproc` crossinstall PP=$FPC_Z80_DIR/fpc/compiler/ppcrossz80 INSTALL_PREFIX=$FPC_Z80_DIR/zxspectrum-snapshot BINUTILSPREFIX=$BINUTILSPREFIX
…but after a couple of hours rubbing them both together I’ve yet to see any smoke, let alone fire.
I added an alias to workaround lack of nproc:
alias nproc="sysctl -n hw.logicalcpu" (thank you Google)
STARTAPP is set to …/MyNativeFpc/fpc/bin/aarch64-darwin/fpc - I'm running on an M4 chip, so that's the location of the native fpc compiler previously set up with FpcUpDeluxe - is that correct?
I’ve tried copying and executing the above build script in various folders in the fpc source code, but wherever I put it, it chokes on line 24 with the error:
make: *** No rule to make target 'clean'. Stop.
What should the variable FPC_Z80_DIR be set to? It needs to be a folder containing an 'fpc' subfolder in order to satisfy line 22 of the build script (cd $FPC_Z80_DIR/fpc), so either an existing fpc folder, or a new empty folder for output (?).
Any insight welcome
