I think I've worked out how to build fpc and fp 2.0.4 for SPARC starting off from 2.0.0, many thanks in particular to Jonas. The next question, before I try moving the result to a virgin machine, is how to add gdb support.
I eventually found the libraries at
ftp://ftp.freepascal.org/pub/fpc/contrib/libgdb/v6.3/ and figured I'd try using them rather than ploughing my way through the toolchain sources which looked like a 60Mb download for Debian "Sarge". After a certain amount of trial and error I worked out that the files needed to be put in /fpcsrc/libgdb/linux for make to use them.
It looks as though the point at which they are initially used is OK:
make -C gdbint smart
make[4]: Entering directory `/fpcsrc/packages/base/gdbint' make all LINKSMART=1 CREATESMART=1
make[5]: Entering directory `/fpcsrc/packages/base/gdbint' /bin/mkdir -p units/sparc-linux
/fpcsrc/compiler/ppcsparc -XX -CX -Ur -Xs -n -Fu/fpcsrc/rtl/units/sparc-linux -Fl/fpcsrc/libgdb/linux -Fo/fpcsrc/libgdb/linux -FE. -FUunits/sp /usr/bin/ar: creating units/sparc-linux/libpgdbver.a make gdbint.ppu GOTGDBVER=1
make[6]: Entering directory `/fpcsrc/packages/base/gdbint' Using GDB GDB_V603
/fpcsrc/compiler/ppcsparc -XX -CX -Ur -Xs -n -Fu/fpcsrc/rtl/units/sparc-linux -Fl/fpcsrc/libgdb/linux -Fo/fpcsrc/libgdb/linux -FE. -FUunits/sp /bin/rm -f gdbver gdbver.o
make[6]: Leaving directory `/fpcsrc/packages/base/gdbint' /fpcsrc/compiler/ppcsparc -XX -CX -Ur -Xs -n -Fu/fpcsrc/rtl/units/sparc-linux -Fl/fpcsrc/libgdb/linux -Fo/fpcsrc/libgdb/linux -FE. -FUunits/sp /usr/bin/ar: creating units/sparc-linux/libpgdbcon.a make[5]: Leaving directory `/fpcsrc/packages/base/gdbint' make[4]: Leaving directory `/fpcsrc/packages/base/gdbint'
(Sorry, that's slightly truncated by my telnet client).
However further on things go badly wrong:
/bin/mkdir -p /fpcsrc/ide/units/sparc-linux
/fpcsrc/compiler/ppcsparc -dBrowserCol -dGDB -Ur -Xs -n -Ur -dNOCATCH -Fu/fpcsrc/compiler -Fu/fpcsrc/compiler/sparc -Fu/fpcsrc/compiler/targes make[5]: Leaving directory `/fpcsrc/ide/compiler'
make[4]: Leaving directory `/fpcsrc/ide'
make testgdb
make[4]: Entering directory `/fpcsrc/ide'
LibGDB found in /fpcsrc/libgdb/linux/libgdb.a
make[4]: Leaving directory `/fpcsrc/ide'
make fpc_all
make[4]: Entering directory `/fpcsrc/ide'
/fpcsrc/compiler/ppcsparc -Fl/fpcsrc/libgdb/linux -Ur -Xs -n -Sg -Fu/fpcsrc/rtl/units/sparc-linux -Fu/fpcsrc/fv/units/sparc-linux -Fu/fpcsrc/s /fpcsrc/libgdb/linux/libgdb.a(gdbtypes.o)(.text+0x1154): In function `create_array_type':
/mnt/hda1/florian/gdb-6.3.woody/gdb/gdbtypes.c:752: undefined reference to `__muldi3'
/fpcsrc/libgdb/linux/libgdb.a(ada-lang.o)(.text+0x1098): In function `max_of_size':
/mnt/hda1/florian/gdb-6.3.woody/gdb/ada-lang.c:519: undefined reference to `__ashldi3'
And so on. The obvious questions are:
i) Are precompiled binaries of the gdb interface library available for Debian Sarge? So far I can't track down an appropriate standard package.
ii) Can I compile them myself without breaking my toolchain, and if so what configure parameters etc. do I need?
iii) What am I missing that is blindingly obvious? :-)
